Class: OpenAI::Models::Responses::CustomTool

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

Defined Under Namespace

Modules: AllowedCaller

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 ⇒ CustomTool

Returns a new instance of CustomTool.

Parameters:

  • name —

    The name of the custom tool, used to identify it in tool calls.

  • allowed_callers —

    The tool invocation context(s).

  • async —

    Whether the tool response can be returned asynchronously versus immediately returned on next response creation.

  • defer_loading —

    Whether this tool should be deferred and discovered via tool search.

  • description —

    Optional description of the custom tool, used to provide more context.

  • format_ —

    The input format for the custom tool. Default is unconstrained text.

  • type —

    The type of the custom tool. Always custom.

  • name: (String)
  • allowed_callers: (::Array[OpenAI::Models::Responses::CustomTool::allowed_caller], nil)
  • async: (Boolean)
  • defer_loading: (Boolean)
  • description: (String)
  • format_: (OpenAI::Models::custom_tool_input_format)
  • type: (:custom)


68
69
70
71
72
73
74
75
76
# File 'sig/openai/models/responses/custom_tool.rbs', line 68

def initialize: (
  name: String,
  ?allowed_callers: ::Array[OpenAI::Models::Responses::CustomTool::allowed_caller]?,
  ?async: bool,
  ?defer_loading: bool,
  ?description: String,
  ?format_: OpenAI::Models::custom_tool_input_format,
  ?type: :custom
) -> void

Instance Attribute Details

#allowed_callers ⇒ ::Array[OpenAI::Models::Responses::CustomTool::allowed_caller]?

The tool invocation context(s).

Returns:

  • (::Array[OpenAI::Models::Responses::CustomTool::allowed_caller], nil)


23
24
25
26
27
# File 'lib/openai/models/responses/custom_tool.rb', line 23

optional(
  :allowed_callers,
  -> { OpenAI::Internal::Type::ArrayOf[enum: OpenAI::Responses::CustomTool::AllowedCaller] },
  nil?: true
)

#async ⇒ Boolean?

Whether the tool response can be returned asynchronously versus immediately returned on next response creation.

Returns:



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

optional :async, OpenAI::Internal::Type::Boolean

#defer_loading ⇒ Boolean?

Whether this tool should be deferred and discovered via tool search.

Returns:



40
# File 'lib/openai/models/responses/custom_tool.rb', line 40

optional :defer_loading, OpenAI::Internal::Type::Boolean

#description ⇒ String?

Optional description of the custom tool, used to provide more context.

Returns:

  • (String, nil)


46
# File 'lib/openai/models/responses/custom_tool.rb', line 46

optional :description, String

#format_ ⇒ OpenAI::Models::custom_tool_input_format?

The input format for the custom tool. Default is unconstrained text.

Returns:

  • (OpenAI::Models::custom_tool_input_format, nil)


52
# File 'lib/openai/models/responses/custom_tool.rb', line 52

optional :format_, union: -> { OpenAI::CustomToolInputFormat }, api_name: :format

#name ⇒ String

The name of the custom tool, used to identify it in tool calls.

Returns:

  • (String)


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

required :name, String

#type ⇒ :custom

The type of the custom tool. Always custom.

Returns:

  • (:custom)


17
# File 'lib/openai/models/responses/custom_tool.rb', line 17

required :type, const: :custom

Instance Method Details

#to_hash ⇒ { name: String, ?type: :custom, ?allowed_callers: ::Array[OpenAI::Models::Responses::CustomTool::allowed_caller]?, ?async: bool, ?defer_loading: bool, ?description: String, ?format_: OpenAI::Models::custom_tool_input_format }

Returns:

  • ({ name: String, ?type: :custom, ?allowed_callers: ::Array[OpenAI::Models::Responses::CustomTool::allowed_caller]?, ?async: bool, ?defer_loading: bool, ?description: String, ?format_: OpenAI::Models::custom_tool_input_format })


78
79
80
81
82
83
84
85
86
# File 'sig/openai/models/responses/custom_tool.rbs', line 78

def to_hash: -> {
  name: String,
  ?type: :custom,
  ?allowed_callers: ::Array[OpenAI::Models::Responses::CustomTool::allowed_caller]?,
  ?async: bool,
  ?defer_loading: bool,
  ?description: String,
  ?format_: OpenAI::Models::custom_tool_input_format
}