Sha256: 53281e45822607fcd149a7351cf0ca4adf60b7958c6ee5206e0f228d1ca7dd9f
Contents?: true
Size: 1 KB
Versions: 3
Compression:
Stored size: 1 KB
Contents
# frozen_string_literal: true module OmniAI # An abstract class that provides an interface for chatting for various vendors (e.g. OpenAI::ChatGPT). # # Usage: # # class OmniAI::OpenAI::Chat < OmniAI::Chat # def completion(messages, model:, temperature: 0.0, format: :text) # # TODO: implement # end # end # # Once defined, it can be used to interface with the vendor's chat API as follows: # # client.chat.completion("...", model: "...", temperature: 0.0, format: :text) # # @param client [OmniAI::Client] the client class Chat def initialize(client:) @client = client end # @raise [OmniAI::Error] # # @param messages [String] # @param model [String] # @param format [Symbol] either :text or :json # @param temperature [Float] # # @return [OmniAI::Chat::Request] def completion(messages, model:, temperature: 0.0, format: :text) raise NotImplementedError, "#{self.class.name}#completion undefined" end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
omniai-0.0.6 | lib/omniai/chat.rb |
omniai-0.0.4 | lib/omniai/chat.rb |
omniai-0.0.3 | lib/omniai/chat.rb |