/**
 * Common building blocks used by both Google front-ends — the Generative AI
 * (Gemini) adapter and the Vertex AI adapter. Covers turning our messages and
 * tools into Google's shapes, mapping finish reasons back to our stop reasons,
 * and the bookkeeping around reasoning ("thought") signatures.
 */
import { type Content, FinishReason, FunctionCallingConfigMode, type Part, type Schema } from "@google/genai";
import type { Context, Model, StopReason, Tool } from "../types.js";
import { type ProviderLifecycleHooks } from "./simple-options.js";
type GoogleApiType = "google-generative-ai" | "google-vertex";
export interface GoogleRequestExecutionOptions<TRequest = unknown, TResponse = unknown> {
    hooks?: ProviderLifecycleHooks<TRequest, TResponse>;
    retryPolicy?: {
        maxAttempts?: number;
        baseDelayMs?: number;
    };
}
export declare function executeGoogleRequest<TRequest, TResponse>(request: TRequest, executor: () => Promise<TResponse>, options?: GoogleRequestExecutionOptions<TRequest, TResponse>): Promise<TResponse>;
/**
 * Discrete reasoning intensities understood by Gemini. Every entry corresponds
 * one-to-one with a value of the Google SDK's ThinkingLevel enum.
 */
export type GoogleThinkingLevel = "THINKING_LEVEL_UNSPECIFIED" | "MINIMAL" | "LOW" | "MEDIUM" | "HIGH";
/**
 * The four reasoning efforts callers can request, ordered weakest to strongest.
 * Drawn from the internal ThinkingLevel set with the "xhigh" tier collapsed away.
 */
export type ClampedReasoningEffort = "minimal" | "low" | "medium" | "high";
/** The slice of a Model object the Gemini reasoning helpers actually consult. */
type GeminiModelRef = {
    id: string;
};
/**
 * Family buckets that decide how reasoning effort maps onto a request. Gemini 3
 * variants take a discrete level; everything else takes a token budget.
 */
export type GeminiFamily = "gemini-3-pro" | "gemini-3-flash" | "default";
/** Sort a model id into the Gemini family whose reasoning rules apply to it. */
export declare function classifyGeminiFamily(modelId: string): GeminiFamily;
/**
 * Pick the discrete Gemini thinking level for a given effort. The Gemini-3 Pro
 * family uses its coarser two-rung table; all other ids use the full four-rung
 * mapping.
 */
export declare function selectGeminiThinkingLevel(effort: ClampedReasoningEffort, model: GeminiModelRef): GoogleThinkingLevel;
/**
 * Resolve the thinking-token budget for a model/effort pair. A caller-supplied
 * override wins outright; otherwise the per-family default table is consulted,
 * and unrecognized families return -1 so the model sizes its own budget.
 */
export declare function resolveGeminiThinkingBudget(model: GeminiModelRef, effort: ClampedReasoningEffort, customBudgets?: Partial<Record<ClampedReasoningEffort, number>>): number;
/**
 * Distinguishes a reasoning fragment from a normal answer fragment: a Gemini
 * `Part` whose `thought` flag is set holds the model's internal reasoning.
 */
export declare function isThinkingPart(part: Pick<Part, "thought" | "thoughtSignature">): boolean;
/**
 * Keep whichever thought signature is freshest as chunks stream in: a new
 * non-empty value replaces the old one, otherwise the previous value stands.
 */
export declare function retainThoughtSignature(existing: string | undefined, incoming: string | undefined): string | undefined;
/**
 * Some models served through Google demand that every function call — and the
 * function response that answers it — carry an explicit correlation id. This
 * returns true for those model families.
 */
export declare function requiresToolCallId(modelId: string): boolean;
/**
 * Map our internal conversation history onto the `Content[]` array Gemini's
 * generate-content request expects.
 */
export declare function convertMessages<T extends GoogleApiType>(model: Model<T>, context: Context): Content[];
/**
 * Repackage our tool definitions into the nested function-declaration block
 * Gemini reads them from.
 */
export declare function convertTools(tools: Tool[]): {
    functionDeclarations: {
        name: string;
        description?: string;
        parameters: Schema;
    }[];
}[] | undefined;
/**
 * Resolve one of our tool-choice keywords to the matching Gemini
 * FunctionCallingConfigMode, defaulting to AUTO for anything unrecognized.
 */
export declare function mapToolChoice(choice: string): FunctionCallingConfigMode;
/**
 * Look up the unified StopReason for a Gemini FinishReason enum value, throwing
 * if the enum carries a value the table above does not cover.
 */
export declare function mapStopReason(reason: FinishReason): StopReason;
/**
 * Variant of the finish-reason lookup that takes the raw string seen in
 * deserialized API JSON, returning "error" for anything not explicitly listed.
 */
export declare function mapStopReasonString(reason: string): StopReason;
export {};
