import { type Content, type GenerateContentResponseUsageMetadata } from "@google/genai";
import { type AIModel, type Completion, type CompletionChunkObject, type ExecutionOptions, type ExecutionTokenUsage, LlumiverseError, type LlumiverseErrorContext, type PromptSegment } from "@llumiverse/core";
import type { GenerateContentPrompt, VertexAIDriver } from "../index.js";
import type { ModelDefinition } from "../models.js";
export declare function mergeConsecutiveRole(contents: Content[] | undefined): Content[];
export declare class GeminiModelDefinition implements ModelDefinition<GenerateContentPrompt> {
    model: AIModel;
    constructor(modelId: string);
    createPrompt(_driver: VertexAIDriver, segments: PromptSegment[], options: ExecutionOptions): Promise<GenerateContentPrompt>;
    usageMetadataToTokenUsage(driver: VertexAIDriver, usageMetadata: GenerateContentResponseUsageMetadata | undefined): ExecutionTokenUsage;
    requestTextCompletion(driver: VertexAIDriver, prompt: GenerateContentPrompt, options: ExecutionOptions): Promise<Completion>;
    requestTextCompletionStream(driver: VertexAIDriver, prompt: GenerateContentPrompt, options: ExecutionOptions): Promise<AsyncIterable<CompletionChunkObject>>;
    /**
     * Format Google API errors into LlumiverseError with proper status codes and retryability.
     *
     * Google API errors follow AIP-193 standard:
     * - ApiError.status: HTTP status code
     * - ApiError.message: Error message
     *
     * Common error codes:
     * - 400 (INVALID_ARGUMENT): Invalid request parameters
     * - 401 (UNAUTHENTICATED): Authentication required
     * - 403 (PERMISSION_DENIED): Insufficient permissions
     * - 404 (NOT_FOUND): Resource not found
     * - 429 (RESOURCE_EXHAUSTED): Rate limit/quota exceeded
     * - 500 (INTERNAL): Internal server error
     * - 503 (UNAVAILABLE): Service temporarily unavailable
     * - 504 (DEADLINE_EXCEEDED): Request timeout
     *
     * @see https://google.aip.dev/193
     * @see https://docs.cloud.google.com/vertex-ai/generative-ai/docs/model-reference/api-errors
     */
    formatLlumiverseError(_driver: VertexAIDriver, error: unknown, context: LlumiverseErrorContext): LlumiverseError;
    /**
     * Type guard to check if error is a Google API error.
     */
    private isGoogleApiError;
    /**
     * Determine if a Google API error is retryable based on HTTP status code.
     *
     * Retryable errors (per Google AIP-194):
     * - 408 (REQUEST_TIMEOUT): Request timeout
     * - 429 (RESOURCE_EXHAUSTED): Rate limit exceeded, quota exhausted
     * - 500 (INTERNAL): Internal server error
     * - 502 (BAD_GATEWAY): Bad gateway
     * - 503 (UNAVAILABLE): Service temporarily unavailable
     * - 504 (DEADLINE_EXCEEDED): Gateway timeout
     *
     * Non-retryable errors:
     * - 400 (INVALID_ARGUMENT): Invalid request parameters
     * - 401 (UNAUTHENTICATED): Authentication required
     * - 403 (PERMISSION_DENIED): Insufficient permissions
     * - 404 (NOT_FOUND): Resource not found
     * - 409 (CONFLICT): Resource conflict
     * - Other 4xx client errors
     *
     * @param httpStatusCode - The HTTP status code from the API error
     * @returns True if retryable, false if not retryable, undefined if unknown
     */
    private isGeminiErrorRetryable;
    /**
     * Extract error type name from error message.
     * Google errors often include the error type in the message.
     * Examples: "INVALID_ARGUMENT", "RESOURCE_EXHAUSTED", "PERMISSION_DENIED"
     */
    private extractErrorName;
}
/**
 * Converts functionCall and functionResponse parts to text parts in Gemini Content[].
 * Preserves tool call information while removing structured parts that require
 * tools/toolConfig to be defined in the API request.
 */
export declare function convertGeminiFunctionPartsToText(contents: Content[]): Content[];
//# sourceMappingURL=gemini.d.ts.map