/**
 * Embedding Service for UAP Memory System
 *
 * Provides text embedding generation for semantic memory retrieval.
 * Supports multiple backends: Ollama (local), OpenAI, local transformers, or simple TF-IDF fallback.
 *
 * Priority order:
 * 1. Ollama (if running with nomic-embed-text or similar)
 * 2. OpenAI (if API key available)
 * 3. Local sentence-transformers (if installed)
 * 4. TF-IDF fallback (always available)
 */
export interface EmbeddingProvider {
    name: string;
    dimensions: number;
    embed(text: string): Promise<number[]>;
    embedBatch(texts: string[]): Promise<number[][]>;
    isAvailable(): Promise<boolean>;
}
/**
 * llama.cpp Embeddings Provider (LOCAL - NO API COSTS)
 *
 * Uses llama-server with --embeddings flag to serve embedding models.
 * Recommended model: nomic-embed-text-v2-moe (GGUF)
 *   - 475M total params, 305M active (MoE: 8 experts, top-2 routing)
 *   - 768 dimensions (Matryoshka: can truncate to 256)
 *   - SoTA multilingual (100+ languages, MIRACL 65.8, BEIR 52.86)
 *   - Q4_K_M quant: ~328MB VRAM — fits alongside Qwen3.5 35B A3B
 *
 * To run alongside Qwen3.5 35B A3B, launch TWO llama-server instances:
 *
 *   # Instance 1: Main LLM (Qwen3.5 35B A3B) on port 8080
 *   llama-server \
 *     --model /path/to/Qwen3.5-35B-A3B-UD-IQ4_XS.gguf \
 *     --chat-template-file chat_template.jinja \
 *     --port 8080 --host 0.0.0.0 \
 *     --ctx-size 131072 --gpu-layers 99 \
 *     --cache-type-k q8_0 --cache-type-v q4_0 \
 *     -fa on --threads 8 --batch-size 512
 *
 *   # Instance 2: Embedding model on port 8081
 *   llama-server \
 *     --model /path/to/nomic-embed-text-v2-moe.Q4_K_M.gguf \
 *     --port 8081 --host 0.0.0.0 \
 *     --embeddings --pooling mean \
 *     --ctx-size 512 --gpu-layers 99 \
 *     --batch-size 2048 --ubatch-size 512 \
 *     --threads 4
 *
 * VRAM budget (24GB GPU):
 *   Qwen3.5 IQ4_XS: ~17GB model + ~3GB KV cache = ~20GB
 *   nomic-embed Q4_K_M: ~328MB model + ~50MB KV = ~380MB
 *   Total: ~20.4GB — fits in 24GB with headroom
 *
 * For CPU-only embedding (saves all GPU for LLM):
 *   llama-server \
 *     --model /path/to/nomic-embed-text-v2-moe.Q4_K_M.gguf \
 *     --port 8081 --host 0.0.0.0 \
 *     --embeddings --pooling mean \
 *     --ctx-size 512 --gpu-layers 0 \
 *     --batch-size 2048 --threads 8
 */
export declare class LlamaCppEmbeddingProvider implements EmbeddingProvider {
    name: string;
    dimensions: number;
    private endpoint;
    private available;
    private taskPrefix;
    constructor(endpoint?: string, options?: {
        taskPrefix?: string;
    });
    isAvailable(): Promise<boolean>;
    embed(text: string): Promise<number[]>;
    private postEmbeddings;
    embedBatch(texts: string[]): Promise<number[][]>;
}
/**
 * Ollama Embeddings Provider (LOCAL - NO API COSTS)
 * Uses nomic-embed-text (768 dimensions) or other embedding models
 */
export declare class OllamaEmbeddingProvider implements EmbeddingProvider {
    name: string;
    dimensions: number;
    private endpoint;
    private model;
    private available;
    constructor(endpoint?: string, model?: string);
    isAvailable(): Promise<boolean>;
    embed(text: string): Promise<number[]>;
    embedBatch(texts: string[]): Promise<number[][]>;
}
/**
 * OpenAI Embeddings Provider
 * Uses text-embedding-3-small (1536 dimensions) or text-embedding-ada-002
 */
export declare class OpenAIEmbeddingProvider implements EmbeddingProvider {
    name: string;
    dimensions: number;
    private apiKey;
    private model;
    constructor(apiKey?: string, model?: string);
    isAvailable(): Promise<boolean>;
    embed(text: string): Promise<number[]>;
    embedBatch(texts: string[]): Promise<number[][]>;
}
/**
 * Local Sentence Transformers Provider
 * Uses Python sentence-transformers library for local embedding generation
 */
export declare class LocalEmbeddingProvider implements EmbeddingProvider {
    name: string;
    dimensions: number;
    private model;
    private pythonPath;
    constructor(model?: string, pythonPath?: string);
    isAvailable(): Promise<boolean>;
    embed(text: string): Promise<number[]>;
    embedBatch(texts: string[]): Promise<number[][]>;
}
/**
 * Enhanced TF-IDF Fallback Provider with Word Vectors
 * Improved keyword-based embeddings with semantic awareness
 */
export declare class TFIDFEmbeddingProvider implements EmbeddingProvider {
    name: string;
    dimensions: number;
    private vocabulary;
    private idfScores;
    private documents;
    private wordVectors;
    constructor();
    isAvailable(): Promise<boolean>;
    embed(text: string): Promise<number[]>;
    embedBatch(texts: string[]): Promise<number[][]>;
    addDocument(text: string): void;
    private tokenize;
    private isStopWord;
    private getBigrams;
    private hashString;
    private getTokenIndex;
    private updateIDF;
    private normalize;
    /**
     * Initialize semantic word clusters for domain-specific terms
     * Words in the same cluster get similar vector contributions
     */
    private initializeSemanticClusters;
    private generateClusterVector;
}
/**
 * Embedding Service - Main interface for UAP memory system
 * Automatically selects best available provider
 *
 * Priority: Ollama (local, free) > OpenAI > Local transformers > TF-IDF fallback
 */
export declare class EmbeddingService {
    private provider;
    private providers;
    private cache;
    private cacheMaxSize;
    /** Memory pressure threshold (fraction of heap used). Evicts aggressively above this. */
    private memoryPressureThreshold;
    constructor(ollamaEndpoint?: string, ollamaModel?: string, llamaCppEndpoint?: string);
    initialize(): Promise<void>;
    embed(text: string): Promise<number[]>;
    embedBatch(texts: string[]): Promise<number[][]>;
    cosineSimilarity(a: number[], b: number[]): number;
    getDimensions(): number;
    getProviderName(): string;
    private getCacheKey;
}
export declare function getEmbeddingService(): EmbeddingService;
export declare function generateEmbedding(text: string): Promise<number[]>;
export declare function generateEmbeddings(texts: string[]): Promise<number[][]>;
//# sourceMappingURL=embeddings.d.ts.map