Class: OpenAI::Models::Responses::ToolChoiceAllowed

Inherits:
Internal::Type::BaseModel show all
Defined in:
lib/openai/models/responses/tool_choice_allowed.rb

Defined Under Namespace

Modules: Mode

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Internal::Type::BaseModel

==, #==, #[], coerce, #deconstruct_keys, #deep_to_h, dump, fields, hash, #hash, inherited, inspect, #inspect, known_fields, optional, recursively_to_h, required, #to_h, #to_json, #to_s, to_sorbet_type, #to_yaml

Methods included from Internal::Type::Converter

#coerce, coerce, #dump, dump, inspect, #inspect, meta_info, new_coerce_state, type_info

Methods included from Internal::Util::SorbetRuntimeSupport

#const_missing, #define_sorbet_constant!, #sorbet_constant_defined?, #to_sorbet_type, to_sorbet_type

Constructor Details

#initialize(mode:, tools:, type: :allowed_tools) ⇒ Object

Some parameter documentations has been truncated, see OpenAI::Models::Responses::ToolChoiceAllowed for more details.

Constrains the tools available to the model to a pre-defined set.

Parameters:

  • mode (Symbol, OpenAI::Models::Responses::ToolChoiceAllowed::Mode)

    Constrains the tools available to the model to a pre-defined set.

  • tools (Array<Hash{Symbol=>Object}>)

    A list of tool definitions that the model should be allowed to call.

  • type (Symbol, :allowed_tools) (defaults to: :allowed_tools)

    Allowed tool configuration type. Always ‘allowed_tools`.



# File 'lib/openai/models/responses/tool_choice_allowed.rb', line 41

Instance Attribute Details

#modeSymbol, OpenAI::Models::Responses::ToolChoiceAllowed::Mode

Constrains the tools available to the model to a pre-defined set.

‘auto` allows the model to pick from among the allowed tools and generate a message.

‘required` requires the model to call one or more of the allowed tools.



16
# File 'lib/openai/models/responses/tool_choice_allowed.rb', line 16

required :mode, enum: -> { OpenAI::Responses::ToolChoiceAllowed::Mode }

#toolsArray<Hash{Symbol=>Object}>

A list of tool definitions that the model should be allowed to call.

For the Responses API, the list of tool definitions might look like:

“‘json [

{ "type": "function", "name": "get_weather" },
{ "type": "mcp", "server_label": "deepwiki" },
{ "type": "image_generation" }

] “‘

Returns:

  • (Array<Hash{Symbol=>Object}>)


32
33
# File 'lib/openai/models/responses/tool_choice_allowed.rb', line 32

required :tools,
OpenAI::Internal::Type::ArrayOf[OpenAI::Internal::Type::HashOf[OpenAI::Internal::Type::Unknown]]

#typeSymbol, :allowed_tools

Allowed tool configuration type. Always ‘allowed_tools`.

Returns:

  • (Symbol, :allowed_tools)


39
# File 'lib/openai/models/responses/tool_choice_allowed.rb', line 39

required :type, const: :allowed_tools