Class: Bristow::Configuration
- Inherits:
-
Object
- Object
- Bristow::Configuration
- Defined in:
- lib/bristow/configuration.rb
Instance Attribute Summary collapse
-
#anthropic_api_key ⇒ Object
Returns the value of attribute anthropic_api_key.
-
#clients ⇒ Object
readonly
Returns the value of attribute clients.
-
#default_model ⇒ Object
Returns the value of attribute default_model.
-
#default_provider ⇒ Object
Returns the value of attribute default_provider.
-
#google_api_key ⇒ Object
Returns the value of attribute google_api_key.
-
#logger ⇒ Object
Returns the value of attribute logger.
-
#openai_api_key ⇒ Object
Returns the value of attribute openai_api_key.
Instance Method Summary collapse
-
#client ⇒ Object
Backward compatibility.
- #client_for(provider) ⇒ Object
-
#initialize ⇒ Configuration
constructor
A new instance of Configuration.
-
#model ⇒ Object
Backward compatibility.
- #model=(model) ⇒ Object
Constructor Details
#initialize ⇒ Configuration
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_key ⇒ Object
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 |
#clients ⇒ Object (readonly)
Returns the value of attribute clients.
5 6 7 |
# File 'lib/bristow/configuration.rb', line 5 def clients @clients end |
#default_model ⇒ Object
Returns the value of attribute default_model.
3 4 5 |
# File 'lib/bristow/configuration.rb', line 3 def default_model @default_model end |
#default_provider ⇒ Object
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_key ⇒ Object
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 |
#logger ⇒ Object
Returns the value of attribute logger.
3 4 5 |
# File 'lib/bristow/configuration.rb', line 3 def logger @logger end |
#openai_api_key ⇒ Object
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
#client ⇒ Object
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 |
#model ⇒ Object
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 |