Class: OpenAI::Models::Live::FunctionTool

Inherits:
Internal::Type::BaseModel show all
Defined in:
lib/openai/models/live/function_tool.rb,
sig/openai/models/live/function_tool.rbs

Instance Attribute Summary collapse

Attributes inherited from Internal::Type::BaseModel

#last_response

Instance Method Summary collapse

Methods inherited from Internal::Type::BaseModel

==, #==, #[], #_request_id, #_set_last_response, coerce, #deconstruct_keys, #deep_to_h, dump, #encode_with, 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, coerce_cached, coerce_with_error, #dump, dump, #inspect, inspect, meta_info, new_coerce_state, resolve_type, 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:, description: nil, parameters: nil, strict: nil, type: :function) ⇒ FunctionTool

Returns a new instance of FunctionTool.

Parameters:

  • name —

    The name the delegated Responses model uses when calling this function.

  • description (defaults to: nil) —

    What the function does and when the delegated Responses model should call it.

  • parameters (defaults to: nil) —

    A JSON Schema object describing the arguments accepted by the function.

  • strict (defaults to: nil) —

    Whether the delegated Responses model must follow the function’s parameter schema exactly.

  • type (defaults to: :function) —

    The tool type. Always function.

  • name: (String)
  • description: (String, nil) (defaults to: nil)
  • parameters: (::Hash[Symbol, top], nil) (defaults to: nil)
  • strict: (Boolean, nil) (defaults to: nil)
  • type: (:function) (defaults to: :function)


# File 'lib/openai/models/live/function_tool.rb', line 38

Instance Attribute Details

#description ⇒ String?

What the function does and when the delegated Responses model should call it.

Returns:

  • (String, nil)


23
# File 'lib/openai/models/live/function_tool.rb', line 23

optional :description, String, nil?: true

#name ⇒ String

The name the delegated Responses model uses when calling this function.

Returns:

  • (String)


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

required :name, String

#parameters ⇒ ::Hash[Symbol, top]?

A JSON Schema object describing the arguments accepted by the function.

Returns:

  • (::Hash[Symbol, top], nil)


29
# File 'lib/openai/models/live/function_tool.rb', line 29

optional :parameters, OpenAI::Internal::Type::HashOf[OpenAI::Internal::Type::Unknown], nil?: true

#strict ⇒ Boolean?

Whether the delegated Responses model must follow the function’s parameter schema exactly.

Returns:



36
# File 'lib/openai/models/live/function_tool.rb', line 36

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

#type ⇒ :function

The tool type. Always function.

Returns:

  • (:function)


17
# File 'lib/openai/models/live/function_tool.rb', line 17

required :type, const: :function

Instance Method Details

#to_hash ⇒ { name: String, ?type: :function, ?description: String?, ?parameters: ::Hash[Symbol, top]?, ?strict: bool? }

Returns:

  • ({ name: String, ?type: :function, ?description: String?, ?parameters: ::Hash[Symbol, top]?, ?strict: bool? })


49
50
51
52
53
54
55
# File 'sig/openai/models/live/function_tool.rbs', line 49

def to_hash: -> {
  name: String,
  ?type: :function,
  ?description: String?,
  ?parameters: ::Hash[Symbol, top]?,
  ?strict: bool?
}