blob: bdf3639ee59ff623ce288ed6062144c66dce3667 (
about) (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
|
# frozen_string_literal: true
require_relative 'providers/google'
require_relative 'providers/mistral'
require_relative 'providers/openai'
module NanoBot
module Components
class Provider
def self.new(provider, environment: {})
case provider[:id]
when 'openai'
Providers::OpenAI.new(nil, provider[:settings], provider[:credentials], environment:)
when 'google'
Providers::Google.new(provider[:options], provider[:settings], provider[:credentials], environment:)
when 'mistral'
Providers::Mistral.new(provider[:options], provider[:settings], provider[:credentials], environment:)
else
raise "Unsupported provider \"#{provider[:id]}\""
end
end
end
end
end
|