/** * Google Gemini Provider Implementation * * Provider adapter for the Google Gemini API (Generative Language API). * Handles message formatting, streaming, and tool use for Gemini models. * * Key differences from Anthropic format: * - Messages use "contents" array with "parts" instead of "content" * - System prompt is a separate "systemInstruction" field * - Tool schemas use "parameters" (OpenAI style) in function declarations * - Tool calls return "functionCall" parts, results use "functionResponse" parts * - Auth via API key query param or Authorization header */ import { BaseProvider } from './base.js'; import type { CompletionRequest, CompletionResponse, StreamChunk, ProviderConfig } from './types.js'; /** * Google Gemini API provider adapter. * * Implements the Provider interface for Google's Gemini models. * Handles: * - Message format translation (our format -> Gemini format) * - Streaming SSE event parsing * - Tool use / function calling * - Authentication via API key */ export declare class GeminiProvider extends BaseProvider { readonly name = "google"; private static readonly DEFAULT_BASE_URL; /** Default max tokens if not specified in request */ private static readonly DEFAULT_MAX_TOKENS; constructor(config: ProviderConfig); /** * Build the full API URL with model and action. * Gemini uses URL path for model selection and action. * * @param model - Model identifier * @param action - API action (generateContent, streamGenerateContent) * @returns Full API URL */ private buildUrl; /** * Build headers for Gemini API requests. * Uses Bearer token if API key is provided (alternative to query param). */ protected buildHeaders(): Record; /** * Execute a completion request and return the full response. */ complete(request: CompletionRequest): Promise; /** * Execute a streaming completion request. */ completeStream(request: CompletionRequest): AsyncIterable; /** * Check if the Gemini API is available and credentials are valid. */ healthCheck(): Promise; /** * Translate Foundation request to Gemini format. */ private translateRequest; /** * Translate messages from Foundation format to Gemini format. * * Key translations: * - role: "user" -> "user", role: "assistant" -> "model" * - Content blocks become parts * - tool_use blocks become functionCall parts * - tool_result blocks become functionResponse parts */ private translateMessages; /** * Translate tools from Foundation format to Gemini function declarations. */ private translateTools; /** * Translate Gemini response to Foundation format. */ private translateResponse; /** * Translate Gemini streaming chunk to Foundation StreamChunk format. */ private translateStreamChunk; } //# sourceMappingURL=gemini.d.ts.map