class LittleGhost::Providers::Gemini

Connects a Model to Google’s Gemini generateContent API.

Requests send messages, Tool definitions, attachments, and model settings to the configured Google endpoint. The adapter reads its API key from trusted configuration, honors cancellation and deadlines, and emits LittleGhost StreamEvents. HTTP and response-shape failures become ProviderError subclasses. It uses the built-in HTTP client and does not require Google’s SDK.

Gemini attaches an opaque thoughtSignature to a function-call response part and expects it echoed back on the next request’s matching functionCall. The adapter preserves these opaque values in the response Message metadata under gemini/thought_signatures, keyed by tool-call ID. Preserve the full assistant Message, including this provider replay metadata, when storing or rebuilding conversation history. Signatures survive provider recreation and Message#without_reasoning and replay with their original calls.

Tool results use the function name from their preceding ToolUse in the request history. Keep each tool call before its result when restoring history. Results without a preceding call retain their tool-use ID as the name.