Class: Ace::LLM::Organisms::GoogleClient
- Inherits:
-
BaseClient
- Object
- BaseClient
- Ace::LLM::Organisms::GoogleClient
- Defined in:
- lib/ace/llm/organisms/google_client.rb
Overview
GoogleClient handles interactions with Google’s Gemini API
Constant Summary collapse
- API_BASE_URL =
"https://generativelanguage.googleapis.com"- DEFAULT_MODEL =
"gemini-2.5-flash"- GENERATION_KEY_MAPPING =
Mapping from internal keys to Gemini API camelCase keys
{ temperature: :temperature, max_tokens: :maxOutputTokens, top_p: :topP, top_k: :topK }.freeze
- DEFAULT_GENERATION_CONFIG =
{ temperature: 0.7, max_tokens: nil, top_p: nil, top_k: nil }.freeze
Constants inherited from BaseClient
BaseClient::DEFAULT_SYSTEM_PROMPT_SEPARATOR
Instance Attribute Summary
Attributes inherited from BaseClient
#api_key, #base_url, #generation_config, #http_client, #model
Class Method Summary collapse
-
.provider_name ⇒ String
Get the provider name.
Instance Method Summary collapse
-
#generate(messages, **options) ⇒ Hash
Generate a response from Google’s Gemini.
Methods inherited from BaseClient
#initialize, #needs_credentials?, #provider_name
Constructor Details
This class inherits a constructor from Ace::LLM::Organisms::BaseClient
Class Method Details
.provider_name ⇒ String
Get the provider name
30 31 32 |
# File 'lib/ace/llm/organisms/google_client.rb', line 30 def self.provider_name "google" end |
Instance Method Details
#generate(messages, **options) ⇒ Hash
Generate a response from Google’s Gemini
38 39 40 41 42 43 44 45 46 47 48 |
# File 'lib/ace/llm/organisms/google_client.rb', line 38 def generate(, **) = () generation_params = () request_body = build_request_body(, generation_params) response = make_api_request(request_body) parse_response(response) rescue => e handle_api_error(e) end |