summaryrefslogtreecommitdiff
path: root/components/provider.rb
blob: dbfc8bd679c85cc910dbe5ca520db675330fd1f1 (about) (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
# frozen_string_literal: true

require 'openai'

require_relative './providers/openai'

module NanoBot
  module Components
    class Provider
      def self.new(provider)
        case provider[:name]
        when 'openai'
          Providers::OpenAI.new(provider[:settings])
        else
          raise "Unsupported provider #{provider[:name]}"
        end
      end
    end
  end
end