Module: LlmConductor::Clients::Concerns::GeminiGenerationConfig

Included in:
GeminiClient
Defined in:
lib/llm_conductor/clients/concerns/gemini_generation_config.rb

Overview

Builds Gemini's generationConfig payload from the generic snake_case params hash accepted by every client.

The Gemini REST API expects camelCase keys inside generationConfig, and nests the Gemini 3.x thinking controls one level deeper, under generationConfig.thinkingConfig. Callers keep passing snake_case Ruby keys — the translation lives here.

Keys without a mapping are skipped and reported through the configured logger instead of disappearing silently. Skipping rather than raising keeps existing callers that pass provider-agnostic params working unchanged.

Constant Summary collapse

PARAM_KEY_MAP =

Gemini REST API uses camelCase keys in generationConfig.

{
  temperature: :temperature,
  top_p: :topP,
  top_k: :topK,
  max_tokens: :maxOutputTokens,
  max_output_tokens: :maxOutputTokens,
  candidate_count: :candidateCount,
  stop_sequences: :stopSequences
}.freeze
THINKING_KEY_MAP =

Keys nested under generationConfig.thinkingConfig (Gemini 3.x thinking controls). Accepted flat in params or inside a thinking_config hash.

{
  thinking_level: :thinkingLevel,
  thinking_budget: :thinkingBudget,
  include_thoughts: :includeThoughts
}.freeze
THINKING_CONFIG_KEYS =

Param keys carrying a nested thinkingConfig hash.

%i[thinking_config thinkingConfig].freeze