Class: Stagehand::Models::ModelConfig

Inherits:
Internal::Type::BaseModel show all
Defined in:
lib/stagehand/models/model_config.rb

Defined Under Namespace

Modules: Provider

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(model_name:, api_key: nil, base_url: nil, headers: nil, provider: nil) ⇒ Object

Parameters:

  • model_name (String)

    Model name string with provider prefix (e.g., ‘openai/gpt-5-nano’)

  • api_key (String) (defaults to: nil)

    API key for the model provider

  • base_url (String) (defaults to: nil)

    Base URL for the model provider

  • headers (Hash{Symbol=>String}) (defaults to: nil)

    Custom headers sent with every request to the model provider

  • provider (Symbol, Stagehand::Models::ModelConfig::Provider) (defaults to: nil)

    AI provider for the model (or provide a baseURL endpoint instead)



# File 'lib/stagehand/models/model_config.rb', line 36

Instance Attribute Details

#api_keyString?

API key for the model provider

Returns:

  • (String, nil)


16
# File 'lib/stagehand/models/model_config.rb', line 16

optional :api_key, String, api_name: :apiKey

#base_urlString?

Base URL for the model provider

Returns:

  • (String, nil)


22
# File 'lib/stagehand/models/model_config.rb', line 22

optional :base_url, String, api_name: :baseURL

#headersHash{Symbol=>String}?

Custom headers sent with every request to the model provider

Returns:

  • (Hash{Symbol=>String}, nil)


28
# File 'lib/stagehand/models/model_config.rb', line 28

optional :headers, Stagehand::Internal::Type::HashOf[String]

#model_nameString

Model name string with provider prefix (e.g., ‘openai/gpt-5-nano’)

Returns:

  • (String)


10
# File 'lib/stagehand/models/model_config.rb', line 10

required :model_name, String, api_name: :modelName

#providerSymbol, ...

AI provider for the model (or provide a baseURL endpoint instead)



34
# File 'lib/stagehand/models/model_config.rb', line 34

optional :provider, enum: -> { Stagehand::ModelConfig::Provider }