Class: OpenAI::Models::Responses::WebSearchTool

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

Defined Under Namespace

Modules: SearchContextSize, Type Classes: Filters, UserLocation

Instance Attribute Summary collapse

Attributes inherited from Internal::Type::BaseModel

#last_response

Class Method Summary collapse

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_with_error, 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_domains: nil) ⇒ Object

Parameters:

  • type

    The type of the web search tool. One of web_search or web_search_2025_08_26.

  • external_web_access

    Allow live internet access for web search. Defaults to true when omitted. When false, the web search tool runs in offline/cache-only mode and will not fetch new external content.

  • filters

    Filters for the search.

  • search_context_size

    High level guidance for the amount of context window space to use for the search. One of low, medium, or high. medium is the default.

  • user_location

    The approximate location of the user.



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


Instance Attribute Details

#external_web_accessBoolean?

Allow live internet access for web search. Defaults to true when omitted. When false, the web search tool runs in offline/cache-only mode and will not fetch new external content.

Returns:



19
# File 'lib/openai/models/responses/web_search_tool.rb', line 19

optional :external_web_access, OpenAI::Internal::Type::Boolean

#filtersOpenAI::Responses::WebSearchTool::Filters?

Filters for the search.

Returns:

  • (OpenAI::Responses::WebSearchTool::Filters, nil)


25
# File 'lib/openai/models/responses/web_search_tool.rb', line 25

optional :filters, -> { OpenAI::Responses::WebSearchTool::Filters }, nil?: true

#search_context_sizeOpenAI::Models::Responses::WebSearchTool::search_context_size?

High level guidance for the amount of context window space to use for the search. One of low, medium, or high. medium is the default.

Returns:

  • (OpenAI::Models::Responses::WebSearchTool::search_context_size, nil)


32
# File 'lib/openai/models/responses/web_search_tool.rb', line 32

optional :search_context_size, enum: -> { OpenAI::Responses::WebSearchTool::SearchContextSize }

#typeOpenAI::Models::Responses::WebSearchTool::type_

The type of the web search tool. One of web_search or web_search_2025_08_26.

Returns:

  • (OpenAI::Models::Responses::WebSearchTool::type_)


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

required :type, enum: -> { OpenAI::Responses::WebSearchTool::Type }

#user_locationOpenAI::Responses::WebSearchTool::UserLocation?

The approximate location of the user.

Returns:

  • (OpenAI::Responses::WebSearchTool::UserLocation, nil)


38
# File 'lib/openai/models/responses/web_search_tool.rb', line 38

optional :user_location, -> { OpenAI::Responses::WebSearchTool::UserLocation }, nil?: true

Class Method Details

.valuesArray<Symbol>

Returns:

  • (Array<Symbol>)


# File 'lib/openai/models/responses/web_search_tool.rb', line 71


Instance Method Details

#to_hash{

Returns:

  • ({)


64
# File 'sig/openai/models/responses/web_search_tool.rbs', line 64

def to_hash: -> {