Class: OmniAI::Google::Client
- Inherits:
-
Client
- Object
- Client
- OmniAI::Google::Client
- Defined in:
- lib/omniai/google/client.rb
Overview
Instance Attribute Summary collapse
-
#version ⇒ Object
Returns the value of attribute version.
Instance Method Summary collapse
- #chat(messages, model: Chat::Model::GEMINI_PRO, temperature: nil, format: nil, stream: nil) ⇒ OmniAI::Chat::Completion
- #connection ⇒ HTTP::Client
-
#initialize(api_key: OmniAI::Google.config.api_key, logger: OmniAI::Google.config.logger, host: OmniAI::Google.config.host, version: OmniAI::Google.config.version) ⇒ Client
constructor
A new instance of Client.
Constructor Details
#initialize(api_key: OmniAI::Google.config.api_key, logger: OmniAI::Google.config.logger, host: OmniAI::Google.config.host, version: OmniAI::Google.config.version) ⇒ Client
Returns a new instance of Client.
29 30 31 32 33 34 35 36 37 38 39 40 41 |
# File 'lib/omniai/google/client.rb', line 29 def initialize( api_key: OmniAI::Google.config.api_key, logger: OmniAI::Google.config.logger, host: OmniAI::Google.config.host, version: OmniAI::Google.config.version ) raise(ArgumentError, %(ENV['GOOGLE_API_KEY'] must be defined or `api_key` must be passed)) if api_key.nil? super(api_key:, logger:) @host = host @version = version end |
Instance Attribute Details
#version ⇒ Object
Returns the value of attribute version.
23 24 25 |
# File 'lib/omniai/google/client.rb', line 23 def version @version end |
Instance Method Details
#chat(messages, model: Chat::Model::GEMINI_PRO, temperature: nil, format: nil, stream: nil) ⇒ OmniAI::Chat::Completion
57 58 59 |
# File 'lib/omniai/google/client.rb', line 57 def chat(, model: Chat::Model::GEMINI_PRO, temperature: nil, format: nil, stream: nil) Chat.process!(, model:, temperature:, format:, stream:, client: self) end |
#connection ⇒ HTTP::Client
44 45 46 |
# File 'lib/omniai/google/client.rb', line 44 def connection HTTP.persistent(@host) end |