Class: Roast::Workflow::ApiConfiguration

Inherits:
Object
  • Object
show all
Defined in:
lib/roast/workflow/api_configuration.rb

Overview

Handles API-related configuration including tokens and providers

Instance Attribute Summary collapse

Instance Method Summary collapse

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_providerObject (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_tokenObject (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_baseObject (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_tokenString?

Get the effective API token including environment variables

Returns:

  • (String, nil)

    The API token



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

Returns:

  • (Boolean)

    true 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

Returns:

  • (Boolean)

    true if using OpenRouter



16
17
18
# File 'lib/roast/workflow/api_configuration.rb', line 16

def openrouter?
  Roast::Factories::ApiProviderFactory.openrouter?(@api_provider)
end