Module: Crimson::Client
- Defined in:
- lib/crimson/client/base.rb,
lib/crimson/client/factory.rb,
lib/crimson/client/openai_adapter.rb,
lib/crimson/client/anthropic_adapter.rb
Defined Under Namespace
Classes: AnthropicAdapter, Base, OpenAIAdapter
Class Method Summary collapse
-
.create(config) ⇒ Client::Base
Factory method to create the correct client adapter based on provider configuration.
Class Method Details
.create(config) ⇒ Client::Base
Factory method to create the correct client adapter based on provider configuration.
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 |
# File 'lib/crimson/client/factory.rb', line 11 def self.create(config) provider = config.provider.to_sym sdk = PROVIDERS[provider][:sdk] case sdk when :openai require_relative 'openai_adapter' OpenAIAdapter.new(config) when :anthropic require_relative 'anthropic_adapter' AnthropicAdapter.new(config) else raise Error, "Unsupported provider: #{config.provider}" end end |