Class: OpenAI::Models::Beta::BetaWebSearchTool

Inherits:
Internal::Type::BaseModel show all
Defined in:
lib/openai/models/beta/beta_web_search_tool.rb,
sig/openai/models/beta/beta_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_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(allowed_domains: nil) ⇒ BetaWebSearchTool

Returns a new instance of BetaWebSearchTool.

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. If omitted or null, defaults to the United States. To avoid this fallback, pass {"type": "approximate"} without location fields. To localize results, provide the relevant location fields.

  • type: (OpenAI::Models::Beta::BetaWebSearchTool::type_)
  • external_web_access: (Boolean)
  • filters: (OpenAI::Beta::BetaWebSearchTool::Filters, nil)
  • search_context_size: (OpenAI::Models::Beta::BetaWebSearchTool::search_context_size)
  • user_location: (OpenAI::Beta::BetaWebSearchTool::UserLocation, nil)


# File 'lib/openai/models/beta/beta_web_search_tool.rb', line 42

Instance Attribute Details

#external_web_access ⇒ Boolean?

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/beta/beta_web_search_tool.rb', line 19

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

#filters ⇒ OpenAI::Beta::BetaWebSearchTool::Filters?

Filters for the search.

Returns:

  • (OpenAI::Beta::BetaWebSearchTool::Filters, nil)


25
# File 'lib/openai/models/beta/beta_web_search_tool.rb', line 25

optional :filters, -> { OpenAI::Beta::BetaWebSearchTool::Filters }, nil?: true

#search_context_size ⇒ OpenAI::Models::Beta::BetaWebSearchTool::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::Beta::BetaWebSearchTool::search_context_size, nil)


32
# File 'lib/openai/models/beta/beta_web_search_tool.rb', line 32

optional :search_context_size, enum: -> { OpenAI::Beta::BetaWebSearchTool::SearchContextSize }

#type ⇒ OpenAI::Models::Beta::BetaWebSearchTool::type_

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

Returns:

  • (OpenAI::Models::Beta::BetaWebSearchTool::type_)


11
# File 'lib/openai/models/beta/beta_web_search_tool.rb', line 11

required :type, enum: -> { OpenAI::Beta::BetaWebSearchTool::Type }

#user_location ⇒ OpenAI::Beta::BetaWebSearchTool::UserLocation?

The approximate location of the user. If omitted or null, defaults to the United States. To avoid this fallback, pass {"type": "approximate"} without location fields. To localize results, provide the relevant location fields.

Returns:

  • (OpenAI::Beta::BetaWebSearchTool::UserLocation, nil)


40
# File 'lib/openai/models/beta/beta_web_search_tool.rb', line 40

optional :user_location, -> { OpenAI::Beta::BetaWebSearchTool::UserLocation }, nil?: true

Class Method Details

.values ⇒ Array<Symbol>

Returns:

  • (Array<Symbol>)


# File 'lib/openai/models/beta/beta_web_search_tool.rb', line 75

Instance Method Details

#to_hash ⇒ { type: OpenAI::Models::Beta::BetaWebSearchTool::type_, ?external_web_access: bool, ?filters: OpenAI::Beta::BetaWebSearchTool::Filters?, ?search_context_size: OpenAI::Models::Beta::BetaWebSearchTool::search_context_size, ?user_location: OpenAI::Beta::BetaWebSearchTool::UserLocation? }

Returns:

  • ({ type: OpenAI::Models::Beta::BetaWebSearchTool::type_, ?external_web_access: bool, ?filters: OpenAI::Beta::BetaWebSearchTool::Filters?, ?search_context_size: OpenAI::Models::Beta::BetaWebSearchTool::search_context_size, ?user_location: OpenAI::Beta::BetaWebSearchTool::UserLocation? })


70
71
72
73
74
75
76
# File 'sig/openai/models/beta/beta_web_search_tool.rbs', line 70

def to_hash: -> {
  type: OpenAI::Models::Beta::BetaWebSearchTool::type_,
  ?external_web_access: bool,
  ?filters: OpenAI::Beta::BetaWebSearchTool::Filters?,
  ?search_context_size: OpenAI::Models::Beta::BetaWebSearchTool::search_context_size,
  ?user_location: OpenAI::Beta::BetaWebSearchTool::UserLocation?
}