Class: OpenAI::Models::Responses::FunctionTool

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

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, 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(name: , parameters: , strict: , description: nil, type: :function) ⇒ Object

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

Defines a function in your own code the model can choose to call. Learn more about [function calling](platform.openai.com/docs/guides/function-calling).

Parameters:

  • name (String) (defaults to: )

    The name of the function to call.

  • parameters (Hash{Symbol=>Object}, nil) (defaults to: )

    A JSON schema object describing the parameters of the function.

  • strict (Boolean, nil) (defaults to: )

    Whether to enforce strict parameter validation. Default ‘true`.

  • description (String, nil) (defaults to: nil)

    A description of the function. Used by the model to determine whether or not to

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

    The type of the function tool. Always ‘function`.



# File 'lib/openai/models/responses/function_tool.rb', line 43

Instance Attribute Details

#descriptionString?

A description of the function. Used by the model to determine whether or not to call the function.

Returns:

  • (String, nil)


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

optional :description, String, nil?: true

#nameString

The name of the function to call.

Returns:

  • (String)


11
# File 'lib/openai/models/responses/function_tool.rb', line 11

required :name, String

#parametersHash{Symbol=>Object}?

A JSON schema object describing the parameters of the function.

Returns:

  • (Hash{Symbol=>Object}, nil)


17
18
19
20
21
22
# File 'lib/openai/models/responses/function_tool.rb', line 17

required :parameters,
union: OpenAI::UnionOf[
  OpenAI::Internal::Type::HashOf[OpenAI::Internal::Type::Unknown],
  OpenAI::StructuredOutput::JsonSchemaConverter
],
nil?: true

#strictBoolean?

Whether to enforce strict parameter validation. Default ‘true`.

Returns:



28
# File 'lib/openai/models/responses/function_tool.rb', line 28

required :strict, OpenAI::Internal::Type::Boolean, nil?: true

#typeSymbol, :function

The type of the function tool. Always ‘function`.

Returns:

  • (Symbol, :function)


34
# File 'lib/openai/models/responses/function_tool.rb', line 34

required :type, const: :function