import type { BatchJobRef, BatchJobState, BatchProviderCallContext } from '../types/batch.js'; import type { EmbeddingBatchOutputItem, EmbeddingBatchProvider, EmbeddingBatchProviderInfo, EmbeddingBatchProviderRequest } from './batch.js'; /** Options for Gemini's embedding batch tier. */ export interface GoogleEmbeddingBatchProviderOptions { /** Gemini API key, sent as `x-goog-api-key`. */ apiKey: string; /** * API base URL. Defaults to `https://generativelanguage.googleapis.com/v1beta`. A file is uploaded to, * and results downloaded from, the same URL with `/upload` and `/download` before its version. */ baseUrl?: string; /** Headers added to every request. */ headers?: Record; /** Replaces the global `fetch`. */ fetch?: typeof fetch; } /** * Gemini's Batch API for embeddings (`asyncBatchEmbedContent`): half price. Requests under 20 MB go * inline; a larger batch, up to 2 GB, is uploaded as a JSONL file through the Files API, a line per * input with its id as the key, and its results are read from the file the batch writes. It takes * text, images, audio, video, and PDFs on a model that does, such as gemini-embedding-2. The wire shape * follows Google's API reference and its own clients; it graduates with a recorded live run. */ export declare class GoogleEmbeddingBatchProvider implements EmbeddingBatchProvider { private readonly options; /** Always `google`, with its batch limits. */ readonly info: EmbeddingBatchProviderInfo; constructor(options: GoogleEmbeddingBatchProviderOptions); /** * Sends every input as one batch: inline under 20 MB, or else as a JSONL file uploaded first. Results * come back in the same order, so the ref keeps the ids in that order. */ submit(request: EmbeddingBatchProviderRequest, context: BatchProviderCallContext): Promise; /** Reads a batch's state and counts. */ poll(ref: BatchJobRef, context: BatchProviderCallContext): Promise; /** * Every input's vector or error: inline, or read from the file the batch wrote. An answer that names * its key is matched by it, and one that does not, by its position. */ results(ref: BatchJobRef, context: BatchProviderCallContext): Promise; /** Cancels a batch. */ cancel(ref: BatchJobRef, context: BatchProviderCallContext): Promise; /** * Uploads an input file through the Files API's resumable protocol, a start and then the bytes, and * returns its name, such as `files/abc`. Google keeps it 48 hours. */ private upload; /** A results file's text, from the Files API's download URL. */ private download; /** The URL beside the API's own for uploads or downloads: `/upload` or `/download` before the version. */ private alongside; /** The batch resource, whether Google answers with it or with an operation that holds it. */ private read; private state; private request; private base; /** A call with the key, refused unless it succeeds. */ private send; }