Module: ConsoleAgent::Providers

Defined in:
lib/console_agent/providers/base.rb,
lib/console_agent/providers/openai.rb,
lib/console_agent/providers/anthropic.rb

Defined Under Namespace

Classes: Anthropic, Base, ChatResult, OpenAI, ProviderError

Class Method Summary collapse

Class Method Details

.build(config = ConsoleAgent.configuration) ⇒ Object



93
94
95
96
97
98
99
100
101
102
103
104
# File 'lib/console_agent/providers/base.rb', line 93

def self.build(config = ConsoleAgent.configuration)
  case config.provider
  when :anthropic
    require 'console_agent/providers/anthropic'
    Anthropic.new(config)
  when :openai
    require 'console_agent/providers/openai'
    OpenAI.new(config)
  else
    raise ConfigurationError, "Unknown provider: #{config.provider}"
  end
end