Class: Anthropic::Models::WebSearchTool20260318

Inherits:
Internal::Type::BaseModel show all
Defined in:
lib/anthropic/models/web_search_tool_20260318.rb,
sig/anthropic/models/web_search_tool_20260318.rbs

Defined Under Namespace

Modules: AllowedCaller, ResponseInclusion

Instance Attribute Summary collapse

Class Method 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(allowed_callers: nil, allowed_domains: nil, blocked_domains: nil, cache_control: nil, defer_loading: nil, max_uses: nil, response_inclusion: nil, strict: nil, user_location: nil, name: :web_search, type: :web_search_20260318) ⇒ Object

Some parameter documentations has been truncated, see Anthropic::Models::WebSearchTool20260318 for more details.

Parameters:

  • allowed_callers (Array<Symbol, Anthropic::Models::WebSearchTool20260318::AllowedCaller>) (defaults to: nil)
  • allowed_domains (Array<String>, nil) (defaults to: nil)

    If provided, only these domains will be included in results. Cannot be used alon

  • blocked_domains (Array<String>, nil) (defaults to: nil)

    If provided, these domains will never appear in results. Cannot be used alongsid

  • cache_control (Anthropic::Models::CacheControlEphemeral, nil) (defaults to: nil)

    Create a cache control breakpoint at this content block.

  • defer_loading (Boolean) (defaults to: nil)

    If true, tool will not be included in initial system prompt. Only loaded when re

  • max_uses (Integer, nil) (defaults to: nil)

    Maximum number of times the tool can be used in the API request.

  • response_inclusion (Symbol, Anthropic::Models::WebSearchTool20260318::ResponseInclusion) (defaults to: nil)

    How this tool's result blocks appear in the API response when the result was con

  • strict (Boolean) (defaults to: nil)

    When true, guarantees schema validation on tool names and inputs

  • user_location (Anthropic::Models::UserLocation, nil) (defaults to: nil)

    Parameters for the user's location. Used to provide more relevant search results

  • name (Symbol, :web_search) (defaults to: :web_search)

    Name of the tool.

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


# File 'lib/anthropic/models/web_search_tool_20260318.rb', line 82

Instance Attribute Details

#allowed_callersArray<Symbol, Anthropic::Models::WebSearchTool20260318::AllowedCaller>?



22
23
# File 'lib/anthropic/models/web_search_tool_20260318.rb', line 22

optional :allowed_callers,
-> { Anthropic::Internal::Type::ArrayOf[enum: Anthropic::WebSearchTool20260318::AllowedCaller] }

#allowed_domainsArray<String>?

If provided, only these domains will be included in results. Cannot be used alongside blocked_domains.

Parameters:

  • value (::Array[String], nil)

Returns:

  • (Array<String>, nil)


30
# File 'lib/anthropic/models/web_search_tool_20260318.rb', line 30

optional :allowed_domains, Anthropic::Internal::Type::ArrayOf[String], nil?: true

#blocked_domainsArray<String>?

If provided, these domains will never appear in results. Cannot be used alongside allowed_domains.

Parameters:

  • value (::Array[String], nil)

Returns:

  • (Array<String>, nil)


37
# File 'lib/anthropic/models/web_search_tool_20260318.rb', line 37

optional :blocked_domains, Anthropic::Internal::Type::ArrayOf[String], nil?: true

#cache_controlAnthropic::Models::CacheControlEphemeral?

Create a cache control breakpoint at this content block.



43
# File 'lib/anthropic/models/web_search_tool_20260318.rb', line 43

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

#defer_loadingBoolean?

If true, tool will not be included in initial system prompt. Only loaded when returned via tool_reference from tool search.

Parameters:

Returns:



50
# File 'lib/anthropic/models/web_search_tool_20260318.rb', line 50

optional :defer_loading, Anthropic::Internal::Type::Boolean

#max_usesInteger?

Maximum number of times the tool can be used in the API request.

Parameters:

  • value (Integer, nil)

Returns:

  • (Integer, nil)


56
# File 'lib/anthropic/models/web_search_tool_20260318.rb', line 56

optional :max_uses, Integer, nil?: true

#nameSymbol, :web_search

Name of the tool.

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

Parameters:

  • value (:web_search)

Returns:

  • (Symbol, :web_search)


12
# File 'lib/anthropic/models/web_search_tool_20260318.rb', line 12

required :name, const: :web_search

#response_inclusionSymbol, ...

How this tool's result blocks appear in the API response when the result was consumed by a completed code_execution call in the same turn. 'full' returns the complete content (default). 'excluded' drops the nested server_tool_use and result block pair entirely. Results from direct calls, or from code_execution calls that paused before completing, are always returned in full so they can be sent back on the next turn.



67
# File 'lib/anthropic/models/web_search_tool_20260318.rb', line 67

optional :response_inclusion, enum: -> { Anthropic::WebSearchTool20260318::ResponseInclusion }

#strictBoolean?

When true, guarantees schema validation on tool names and inputs

Parameters:

Returns:



73
# File 'lib/anthropic/models/web_search_tool_20260318.rb', line 73

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

#typeSymbol, :web_search_20260318

Parameters:

  • value (:web_search_20260318)

Returns:

  • (Symbol, :web_search_20260318)


17
# File 'lib/anthropic/models/web_search_tool_20260318.rb', line 17

required :type, const: :web_search_20260318

#user_locationAnthropic::Models::UserLocation?

Parameters for the user's location. Used to provide more relevant search results.

Parameters:

Returns:



80
# File 'lib/anthropic/models/web_search_tool_20260318.rb', line 80

optional :user_location, -> { Anthropic::UserLocation }, nil?: true

Class Method Details

.valuesArray<Symbol>

Returns:

  • (Array<Symbol>)


# File 'lib/anthropic/models/web_search_tool_20260318.rb', line 123

Instance Method Details

#to_hash{

Returns:

  • ({)


67
# File 'sig/anthropic/models/web_search_tool_20260318.rbs', line 67

def to_hash: -> {