Class: OmniAI::Client
- Inherits:
-
Object
- Object
- OmniAI::Client
- Defined in:
- lib/omniai/client.rb
Overview
Defined Under Namespace
Classes: Error
Instance Attribute Summary collapse
-
#api_key ⇒ Object
Returns the value of attribute api_key.
Instance Method Summary collapse
- #chat(messages, model:, temperature: nil, format: nil, stream: nil) ⇒ OmniAI::Chat::Completion
- #connection ⇒ HTTP::Client
-
#initialize(api_key:, logger: nil) ⇒ Client
constructor
A new instance of Client.
- #inspect ⇒ String
- #transcribe(file, model:, language: nil, prompt: nil, temperature: nil, format: nil) ⇒ Object
Constructor Details
#initialize(api_key:, logger: nil) ⇒ Client
Returns a new instance of Client.
20 21 22 23 |
# File 'lib/omniai/client.rb', line 20 def initialize(api_key:, logger: nil) @api_key = api_key @logger = logger end |
Instance Attribute Details
#api_key ⇒ Object
Returns the value of attribute api_key.
16 17 18 |
# File 'lib/omniai/client.rb', line 16 def api_key @api_key end |
Instance Method Details
#chat(messages, model:, temperature: nil, format: nil, stream: nil) ⇒ OmniAI::Chat::Completion
45 46 47 |
# File 'lib/omniai/client.rb', line 45 def chat(, model:, temperature: nil, format: nil, stream: nil) raise NotImplementedError, "#{self.class.name}#chat undefined" end |
#connection ⇒ HTTP::Client
32 33 34 |
# File 'lib/omniai/client.rb', line 32 def connection raise NotImplementedError, "#{self.class.name}#connection undefined" end |
#inspect ⇒ String
26 27 28 29 |
# File 'lib/omniai/client.rb', line 26 def inspect masked_api_key = "#{api_key[..2]}***" if api_key "#<#{self.class.name} api_key=#{masked_api_key.inspect}>" end |
#transcribe(file, model:, language: nil, prompt: nil, temperature: nil, format: nil) ⇒ Object
59 60 61 |
# File 'lib/omniai/client.rb', line 59 def transcribe(file, model:, language: nil, prompt: nil, temperature: nil, format: nil) raise NotImplementedError, "#{self.class.name}#speak undefined" end |