Class: Roast::Workflow::ApiConfiguration
- Inherits:
-
Object
- Object
- Roast::Workflow::ApiConfiguration
- Defined in:
- lib/roast/workflow/api_configuration.rb
Overview
Handles API-related configuration including tokens and providers
Instance Attribute Summary collapse
-
#api_provider ⇒ Object
readonly
Returns the value of attribute api_provider.
-
#api_token ⇒ Object
readonly
Returns the value of attribute api_token.
-
#uri_base ⇒ Object
readonly
Returns the value of attribute uri_base.
Instance Method Summary collapse
-
#effective_token ⇒ String?
Get the effective API token including environment variables.
-
#initialize(config_hash) ⇒ ApiConfiguration
constructor
A new instance of ApiConfiguration.
-
#openai? ⇒ Boolean
Check if using OpenAI.
-
#openrouter? ⇒ Boolean
Check if using OpenRouter.
Constructor Details
#initialize(config_hash) ⇒ ApiConfiguration
Returns a new instance of ApiConfiguration.
9 10 11 12 |
# File 'lib/roast/workflow/api_configuration.rb', line 9 def initialize(config_hash) @config_hash = config_hash process_api_configuration end |
Instance Attribute Details
#api_provider ⇒ Object (readonly)
Returns the value of attribute api_provider.
7 8 9 |
# File 'lib/roast/workflow/api_configuration.rb', line 7 def api_provider @api_provider end |
#api_token ⇒ Object (readonly)
Returns the value of attribute api_token.
7 8 9 |
# File 'lib/roast/workflow/api_configuration.rb', line 7 def api_token @api_token end |
#uri_base ⇒ Object (readonly)
Returns the value of attribute uri_base.
7 8 9 |
# File 'lib/roast/workflow/api_configuration.rb', line 7 def uri_base @uri_base end |
Instance Method Details
#effective_token ⇒ String?
Get the effective API token including environment variables
28 29 30 |
# File 'lib/roast/workflow/api_configuration.rb', line 28 def effective_token @api_token || environment_token end |
#openai? ⇒ Boolean
Check if using OpenAI
22 23 24 |
# File 'lib/roast/workflow/api_configuration.rb', line 22 def openai? Roast::Factories::ApiProviderFactory.openai?(@api_provider) end |
#openrouter? ⇒ Boolean
Check if using OpenRouter
16 17 18 |
# File 'lib/roast/workflow/api_configuration.rb', line 16 def openrouter? Roast::Factories::ApiProviderFactory.openrouter?(@api_provider) end |