/**
 * Text Embedder
 *
 * Generates vector embeddings through remote embedding APIs. Vector storage
 * and similarity search remain local.
 */
/**
 * Default embedding models.
 */
export type EmbeddingProvider = 'gemini' | 'jina' | 'siliconflow';
export declare const DEFAULT_PROVIDER: EmbeddingProvider;
export declare const DEFAULT_MODEL = "gemini-embedding-2";
export declare const DEFAULT_GEMINI_MODEL = "gemini-embedding-2";
export declare const DEFAULT_JINA_MODEL = "jina-embeddings-v5-text-nano";
export declare const DEFAULT_SILICONFLOW_MODEL = "BAAI/bge-m3";
export interface ModelCapabilities {
    dimension: number;
    defaultBatchSize: number;
    maxBatchSize: number;
    /**
     * Per-text input ceiling, in characters. Enforced client-side before the
     * request leaves the embedder so providers without a server-side `truncate`
     * flag (SiliconFlow rejects all variants with 400) don't blow up on oversized
     * code bodies. Gemini silently truncates, Jina honors `truncate: true`; this
     * gives all three providers a single consistent ceiling.
     *
     * Three known embedding models all cap at 8192 tokens. Empirically (see
     * `tmp/sf-truncate-probe2.mjs`) bge-m3 charges ~0.28 tokens/char on typed
     * code; 28000 chars ≈ 7800 tokens with a small safety margin under the cap.
     */
    maxInputChars: number;
}
export declare const MODEL_CAPABILITIES: Record<string, ModelCapabilities>;
export declare function getModelCapabilities(modelId: string): ModelCapabilities | undefined;
/**
 * Options for the embedder
 */
export interface EmbedderOptions {
    /** Embedding provider */
    provider?: EmbeddingProvider;
    /** Embedding provider API key */
    apiKey?: string;
    /** Model ID to use */
    modelId?: string;
    /** Whether to show progress during embedding generation */
    showProgress?: boolean;
}
export interface EmbedderStatusUpdate {
    phase: 'retry_wait';
    provider: 'Gemini' | 'Jina' | 'SiliconFlow';
    retryInMs: number;
    attempt: number;
}
/**
 * Text embedding result
 */
export interface EmbeddingResult {
    /** The embedding vector */
    embedding: Float32Array;
    /** Dimension of the embedding */
    dimension: number;
    /** Model used to generate the embedding */
    model: string;
}
/**
 * Batch embedding result
 */
export interface BatchEmbeddingResult {
    /** Array of embeddings in same order as input */
    embeddings: Float32Array[];
    /** Dimension of each embedding */
    dimension: number;
    /** Model used to generate embeddings */
    model: string;
    /** Processing time in milliseconds */
    durationMs: number;
}
/**
 * Text Embedder using a remote embedding provider.
 *
 * Gemini batch generation uses batchEmbedContents with one request per node
 * text. Do not combine multiple nodes into one content.parts array because
 * that produces a single aggregate embedding instead of node-level vectors.
 */
export declare class TextEmbedder {
    private provider;
    private apiKey?;
    private modelId;
    private initialized;
    private requestTimestamps;
    private rateLimitQueue;
    private statusReporter?;
    constructor(options?: EmbedderOptions);
    /**
     * Initialize the embedder by validating configuration.
     */
    initialize(): Promise<void>;
    /**
     * Check if the embedder is initialized
     */
    isInitialized(): boolean;
    /**
     * Get the model ID being used
     */
    getModelId(): string;
    /**
     * Get the embedding dimension for the configured model.
     */
    getDimension(): number;
    /**
     * Get the default batch size for the configured model.
     */
    getDefaultBatchSize(): number;
    /**
     * Get the maximum allowed batch size for the configured model.
     */
    getMaxBatchSize(): number;
    /**
     * Per-text character ceiling enforced before sending. See ModelCapabilities.
     */
    getMaxInputChars(): number;
    setStatusReporter(reporter?: (status: EmbedderStatusUpdate) => void): void;
    /**
     * Generate embedding for a single text
     */
    embed(text: string): Promise<EmbeddingResult>;
    /**
     * Generate embedding for a query.
     */
    embedQuery(query: string): Promise<EmbeddingResult>;
    /**
     * Generate embeddings for multiple texts in node order.
     */
    embedBatch(texts: string[], type?: 'document' | 'search_query'): Promise<BatchEmbeddingResult>;
    private embedPreparedBatch;
    private embedPreparedBatchWithGemini;
    private embedPreparedBatchWithJina;
    private embedPreparedBatchWithSiliconFlow;
    private parseOpenAICompatibleResponse;
    private fetchWithRetry;
    private isRetryableStatus;
    private getRetryDelayMs;
    private getRetryInfoDelayMs;
    private parseDurationMs;
    private sleep;
    private reportRetryWait;
    private throttleRequests;
    private reserveRequestSlots;
    private prepareJinaText;
    private formatApiErrorMessage;
    private normalizeErrorBody;
    private getDefaultModelForProvider;
    private getProviderDisplayName;
    /**
     * Create text representation of a code node for embedding.
     */
    static createNodeText(node: {
        name: string;
        kind: string;
        qualifiedName?: string;
        signature?: string;
        docstring?: string;
        filePath: string;
        body?: string;
    }): string;
    /**
     * Compute cosine similarity between two embeddings
     */
    static cosineSimilarity(a: Float32Array, b: Float32Array): number;
    /**
     * Release resources
     */
    dispose(): void;
}
/**
 * Create a text embedder instance
 */
export declare function createEmbedder(options?: EmbedderOptions): TextEmbedder;
//# sourceMappingURL=embedder.d.ts.map