Sha256: ec5819c62620646a4b5585789c4317379b19d033281c5b1d37e4543d47caef96
Contents?: true
Size: 640 Bytes
Versions: 7
Compression:
Stored size: 640 Bytes
Contents
# frozen_string_literal: true require 'forwardable' module GenAI class Language extend Forwardable def_delegators :@llm, :embed, :complete, :chat def initialize(provider, token, options: {}) build_llm(provider, token, options) end private def build_llm(provider, token, options) klass = GenAI::Language.constants.find do |const| const.to_s.downcase == provider.to_s.downcase.gsub('_', '') end raise UnsupportedProvider, "Unsupported LLM provider '#{provider}'" unless klass @llm = GenAI::Language.const_get(klass).new(token: token, options: options) end end end
Version data entries
7 entries across 7 versions & 1 rubygems