Class: Anthropic::Models::Tool

Inherits:
Internal::Type::BaseModel show all
Defined in:
lib/anthropic/models/tool.rb

Defined Under Namespace

Modules: Type Classes: InputSchema

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(properties: nil, required: nil, type: :object) ⇒ void

JSON schema for this tool's input.

This defines the shape of the input that your tool accepts and that the model will produce.

Parameters:

  • properties (Hash{Symbol=>Object}, nil) (defaults to: nil)
  • required (Array<String>, nil) (defaults to: nil)
  • type (Symbol, :object) (defaults to: :object)


# File 'lib/anthropic/models/tool.rb', line 61


Instance Attribute Details

#cache_controlAnthropic::Models::CacheControlEphemeral?

Create a cache control breakpoint at this content block.



27
# File 'lib/anthropic/models/tool.rb', line 27

optional :cache_control, -> { Anthropic::CacheControlEphemeral }, nil?: true

#descriptionString?

Description of what this tool does.

Tool descriptions should be as detailed as possible. The more information that the model has about what the tool is and how to use it, the better it will perform. You can use natural language descriptions to reinforce important aspects of the tool input JSON schema.

Returns:

  • (String, nil)


38
# File 'lib/anthropic/models/tool.rb', line 38

optional :description, String

#eager_input_streamingBoolean?

Enable eager input streaming for this tool. When true, tool input parameters will be streamed incrementally as they are generated, and types will be inferred on-the-fly rather than buffering the full JSON output. When false, streaming is disabled for this tool even if the fine-grained-tool-streaming beta is active. When null (default), uses the default behavior based on beta headers.

Returns:



48
# File 'lib/anthropic/models/tool.rb', line 48

optional :eager_input_streaming, Anthropic::Internal::Type::Boolean, nil?: true

#input_schemaAnthropic::Models::Tool::InputSchema

JSON schema for this tool's input.

This defines the shape of the input that your tool accepts and that the model will produce.



13
# File 'lib/anthropic/models/tool.rb', line 13

required :input_schema, -> { Anthropic::Tool::InputSchema }

#nameString

Name of the tool.

This is how the tool will be called by the model and in tool_use blocks.

Returns:

  • (String)


21
# File 'lib/anthropic/models/tool.rb', line 21

required :name, String

#strictBoolean?

When true, guarantees schema validation on tool names and inputs

Returns:



54
# File 'lib/anthropic/models/tool.rb', line 54

optional :strict, Anthropic::Internal::Type::Boolean

#typeSymbol, ...

Returns:



59
# File 'lib/anthropic/models/tool.rb', line 59

optional :type, enum: -> { Anthropic::Tool::Type }, nil?: true