Class: ActiveAgent::Providers::OpenAI::Options

Inherits:
Common::BaseModel show all
Defined in:
lib/active_agent/providers/open_ai/options.rb

Instance Method Summary collapse

Methods inherited from Common::BaseModel

#<=>, #==, attribute, #deep_compact, #deep_dup, delegate_attributes, drop_attributes, inherited, #inspect, keys, #merge!, required_attributes, #serialize, #to_h, #to_hash

Constructor Details

#initialize(kwargs = {}) ⇒ Options

Initialize from a hash (kwargs) with fallback to environment variables and OpenAI gem configuration



31
32
33
34
35
36
37
38
39
# File 'lib/active_agent/providers/open_ai/options.rb', line 31

def initialize(kwargs = {})
  kwargs = kwargs.deep_symbolize_keys if kwargs.respond_to?(:deep_symbolize_keys)

  super(**deep_compact(kwargs.except(:default_url_options).merge(
    api_key:         resolve_api_key(kwargs),
    organization_id: resolve_organization_id(kwargs),
    project_id:      resolve_project_id(kwargs),
  )))
end

Instance Method Details

#extra_headersObject



41
42
43
# File 'lib/active_agent/providers/open_ai/options.rb', line 41

def extra_headers
  {}
end