Class: OpenAI::Models::Beta::BetaWebSearchPreviewTool

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

Defined Under Namespace

Modules: SearchContentType, SearchContextSize, Type Classes: 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(type:, search_content_types: nil, search_context_size: nil, user_location: nil) ⇒ BetaWebSearchPreviewTool

Returns a new instance of BetaWebSearchPreviewTool.

Parameters:

  • type —

    The type of the web search tool. One of web_search_preview or web_search_preview_2025_03_11.

  • search_context_size (defaults to: nil) —

    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 (defaults to: nil) —

    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::BetaWebSearchPreviewTool::type_)
  • search_content_types: (::Array[OpenAI::Models::Beta::BetaWebSearchPreviewTool::search_content_type]) (defaults to: nil)
  • search_context_size: (OpenAI::Models::Beta::BetaWebSearchPreviewTool::search_context_size) (defaults to: nil)
  • user_location: (OpenAI::Beta::BetaWebSearchPreviewTool::UserLocation, nil) (defaults to: nil)


# File 'lib/openai/models/beta/beta_web_search_preview_tool.rb', line 37


Instance Attribute Details

#search_content_types ⇒ Array<Symbol, OpenAI::Models::Beta::BetaWebSearchPreviewTool::SearchContentType>?

Parameters:

  • (::Array[OpenAI::Models::Beta::BetaWebSearchPreviewTool::search_content_type])

Returns:



17
18
19
20
# File 'lib/openai/models/beta/beta_web_search_preview_tool.rb', line 17

optional(
  :search_content_types,
  -> { OpenAI::Internal::Type::ArrayOf[enum: OpenAI::Beta::BetaWebSearchPreviewTool::SearchContentType] }
)

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


27
# File 'lib/openai/models/beta/beta_web_search_preview_tool.rb', line 27

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

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

The type of the web search tool. One of web_search_preview or web_search_preview_2025_03_11.

Returns:

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


12
# File 'lib/openai/models/beta/beta_web_search_preview_tool.rb', line 12

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

#user_location ⇒ OpenAI::Beta::BetaWebSearchPreviewTool::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::BetaWebSearchPreviewTool::UserLocation, nil)


35
# File 'lib/openai/models/beta/beta_web_search_preview_tool.rb', line 35

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

Class Method Details

.values ⇒ Array<Symbol>

Returns:

  • (Array<Symbol>)


# File 'lib/openai/models/beta/beta_web_search_preview_tool.rb', line 67


Instance Method Details

#to_hash ⇒ { type: OpenAI::Models::Beta::BetaWebSearchPreviewTool::type_, ?search_content_types: ::Array[OpenAI::Models::Beta::BetaWebSearchPreviewTool::search_content_type], ?search_context_size: OpenAI::Models::Beta::BetaWebSearchPreviewTool::search_context_size, ?user_location: OpenAI::Beta::BetaWebSearchPreviewTool::UserLocation? }

Returns:

  • ({ type: OpenAI::Models::Beta::BetaWebSearchPreviewTool::type_, ?search_content_types: ::Array[OpenAI::Models::Beta::BetaWebSearchPreviewTool::search_content_type], ?search_context_size: OpenAI::Models::Beta::BetaWebSearchPreviewTool::search_context_size, ?user_location: OpenAI::Beta::BetaWebSearchPreviewTool::UserLocation? })


57
58
59
60
61
62
# File 'sig/openai/models/beta/beta_web_search_preview_tool.rbs', line 57

def to_hash: -> {
  type: OpenAI::Models::Beta::BetaWebSearchPreviewTool::type_,
  ?search_content_types: ::Array[OpenAI::Models::Beta::BetaWebSearchPreviewTool::search_content_type],
  ?search_context_size: OpenAI::Models::Beta::BetaWebSearchPreviewTool::search_context_size,
  ?user_location: OpenAI::Beta::BetaWebSearchPreviewTool::UserLocation?
}