Class: Bristow::Configuration

Inherits:
Object
  • Object
show all
Defined in:
lib/bristow/configuration.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeConfiguration

Returns a new instance of Configuration.



7
8
9
10
11
12
13
14
15
# File 'lib/bristow/configuration.rb', line 7

def initialize
  @openai_api_key = ENV['OPENAI_API_KEY']
  @anthropic_api_key = ENV['ANTHROPIC_API_KEY']
  @google_api_key = ENV['GOOGLE_API_KEY']
  @default_provider = :openai
  @default_model = nil  # Will use provider's default
  @logger = Logger.new(STDOUT)
  @clients = {}
end

Instance Attribute Details

#anthropic_api_keyObject

Returns the value of attribute anthropic_api_key.



3
4
5
# File 'lib/bristow/configuration.rb', line 3

def anthropic_api_key
  @anthropic_api_key
end

#clientsObject (readonly)

Returns the value of attribute clients.



5
6
7
# File 'lib/bristow/configuration.rb', line 5

def clients
  @clients
end

#default_modelObject

Returns the value of attribute default_model.



3
4
5
# File 'lib/bristow/configuration.rb', line 3

def default_model
  @default_model
end

#default_providerObject

Returns the value of attribute default_provider.



3
4
5
# File 'lib/bristow/configuration.rb', line 3

def default_provider
  @default_provider
end

#google_api_keyObject

Returns the value of attribute google_api_key.



3
4
5
# File 'lib/bristow/configuration.rb', line 3

def google_api_key
  @google_api_key
end

#loggerObject

Returns the value of attribute logger.



3
4
5
# File 'lib/bristow/configuration.rb', line 3

def logger
  @logger
end

#openai_api_keyObject

Returns the value of attribute openai_api_key.



3
4
5
# File 'lib/bristow/configuration.rb', line 3

def openai_api_key
  @openai_api_key
end

Instance Method Details

#clientObject

Backward compatibility



37
38
39
# File 'lib/bristow/configuration.rb', line 37

def client
  client_for(default_provider)
end

#client_for(provider) ⇒ Object



32
33
34
# File 'lib/bristow/configuration.rb', line 32

def client_for(provider)
  @clients[provider] ||= build_client_for(provider)
end

#modelObject

Backward compatibility



42
43
44
# File 'lib/bristow/configuration.rb', line 42

def model
  @default_model || client_for(default_provider).default_model
end

#model=(model) ⇒ Object



46
47
48
# File 'lib/bristow/configuration.rb', line 46

def model=(model)
  @default_model = model
end