Module: Durable::Llm::Providers
- Defined in:
- lib/durable/llm/providers.rb,
lib/durable/llm/providers/base.rb,
lib/durable/llm/providers/groq.rb,
lib/durable/llm/providers/cohere.rb,
lib/durable/llm/providers/openai.rb,
lib/durable/llm/providers/anthropic.rb,
lib/durable/llm/providers/huggingface.rb
Defined Under Namespace
Classes: Anthropic, Base, Cohere, Groq, Huggingface, OpenAI
Constant Summary
collapse
- Openai =
OpenAI
- Claude =
Anthropic
- Claude3 =
Anthropic
Class Method Summary
collapse
Class Method Details
.load_all ⇒ Object
7
8
9
|
# File 'lib/durable/llm/providers.rb', line 7
def self.load_all
Dir[File.join(__dir__, 'providers', '*.rb')].each { |file| require file }
end
|
.model_id_to_provider(model_id) ⇒ Object
28
29
30
31
32
33
34
|
# File 'lib/durable/llm/providers.rb', line 28
def self.model_id_to_provider(model_id)
providers.each do |provider|
provider_class = const_get(provider.to_s.capitalize)
return provider_class if provider_class.models.include?(model_id)
end
nil
end
|
.model_ids ⇒ Object
21
22
23
24
25
26
|
# File 'lib/durable/llm/providers.rb', line 21
def self.model_ids
providers.flat_map do |provider|
provider_class = const_get(provider.to_s.capitalize)
provider_class.models
end
end
|
.providers ⇒ Object
11
12
13
14
15
16
17
18
19
|
# File 'lib/durable/llm/providers.rb', line 11
def self.providers
@provider_list ||= constants.select do |const_name|
const = const_get(const_name)
last_component = const.name.split('::').last
next if last_component == 'Base'
const.is_a?(Class) && const.to_s.split('::').last.to_s == const_name.to_s
end.map(&:to_s).map(&:downcase).map(&:to_sym)
end
|