lib/omniai/client.rb in omniai-0.0.6 vs lib/omniai/client.rb in omniai-0.0.7
- old
+ new
@@ -4,11 +4,11 @@
# An abstract class that must be subclassed (e.g. OmniAI::OpenAI::Client).
#
# Usage:
#
# class OmniAI::OpenAI::Client < OmniAI::Client
- # def initialize(api_key: ENV.fetch('OPENAI_API_KEY'))
+ # def initialize(api_key: ENV.fetch('OPENAI_API_KEY'), logger: nil)
# super
# end
#
# @return [OmniAI::OpenAI::Chat]
# def chat
@@ -19,16 +19,18 @@
class Error < StandardError; end
attr_accessor :api_key
# @param api_key [String]
- def initialize(api_key:)
+ # @param logger [Logger]
+ def initialize(api_key:, logger: nil)
@api_key = api_key
+ @logger = logger
end
# @return [HTTP::Client]
def connection
- HTTP.auth("Bearer #{api_key}")
+ raise NotImplementedError, "#{self.class.name}#connection undefined"
end
# @return [OmniAI::Chat] an instance of OmniAI::Chat
def chat
raise NotImplementedError, "#{self.class.name}#chat undefined"