Module: Yorishiro::Provider
- Defined in:
- lib/yorishiro/provider/base.rb,
lib/yorishiro/provider/ollama.rb,
lib/yorishiro/provider/open_ai.rb,
lib/yorishiro/provider/anthropic.rb
Defined Under Namespace
Classes: Anthropic, Base, Ollama, OpenAI
Class Method Summary
collapse
Class Method Details
.build(config) ⇒ Object
127
128
129
130
131
132
133
134
135
|
# File 'lib/yorishiro/provider/base.rb', line 127
def self.build(config)
provider_class = self.for(config.provider_name)
if config.provider_name == :ollama
provider_class.new(api_key: config.api_key, model: config.model, num_ctx: config.ollama_num_ctx_value)
else
provider_class.new(api_key: config.api_key, model: config.model)
end
end
|
.for(provider_name) ⇒ Object
114
115
116
117
118
119
120
121
122
123
124
125
|
# File 'lib/yorishiro/provider/base.rb', line 114
def self.for(provider_name)
case provider_name
when :anthropic
Anthropic
when :open_ai
OpenAI
when :ollama
Ollama
else
raise ProviderNotImplementedError, "Unknown provider: #{provider_name}"
end
end
|