/** * GeminiNativeProvider - Native Google Gen AI SDK implementation * * Uses the native @google/genai SDK instead of OpenAI-compatible endpoint. * This enables proper support for Gemini 3 models with thought signatures. * * @example * ```typescript * const provider = new GeminiNativeProvider({ * apiKey: process.env.GOOGLE_AI_API_KEY, * }); * * const agent = new Agent({ provider }); * ``` */ import type { LLMProvider, Message, ChatOptions, StreamChunk } from './types.js'; /** * Configuration for GeminiNativeProvider */ export interface GeminiNativeProviderConfig { /** * Google AI API key */ apiKey: string; /** * Default model to use * @default 'gemini-2.5-flash' */ model?: string; /** * Default max tokens * @default 4096 */ maxTokens?: number; /** * Optional token estimator function (e.g., tiktoken). * When provided, debug payload reports token counts instead of char-based estimates. * Fallback: Math.ceil(text.length / 4) */ estimateTokens?: (text: string) => number; } /** * GeminiNativeProvider implements LLMProvider using the native Google Gen AI SDK * * Benefits over OpenAI-compatible endpoint: * - Automatic thought signature handling for Gemini 3 * - Native streaming support * - Full access to Gemini-specific features */ export declare class GeminiNativeProvider implements LLMProvider { readonly name = "gemini"; private readonly client; private defaultModel; private readonly defaultMaxTokens; private readonly estimateTokensFn; constructor(config: GeminiNativeProviderConfig); getModel(): string; setModel(modelId: string): void; /** * Send messages and stream the response */ chat(messages: Message[], options?: ChatOptions): AsyncIterable; /** * Count tokens in messages using tiktoken (cl100k_base encoding) */ countTokens(messages: Message[]): Promise; /** * Convert our Message format to Google's format */ private convertMessages; /** * Convert content to Google's Part format */ private convertContent; /** * Extract tool name from tool_use block that matches the given toolUseId */ private extractToolName; /** * Convert our ToolDefinition to Google's FunctionDeclaration format */ private convertTools; /** * Process a streaming chunk into StreamChunks */ private processChunk; /** * Map errors to ProviderError */ private mapError; } /** * Create a GeminiNativeProvider with API key from environment */ export declare function createGeminiNativeProvider(config?: Partial): GeminiNativeProvider;