import type { EmbeddingsLoadOptions } from './specs/Embeddings.nitro'; /** * Cosine similarity between two embedding vectors. * @returns Value in [-1, 1]. Returns 0 if either vector is all zeros. */ export declare function cosineSimilarity(a: Float32Array, b: Float32Array): number; /** * Text embeddings using MLX on Apple Silicon. * * @example * ```ts * import { Embeddings, cosineSimilarity } from 'react-native-nitro-mlx' * * await Embeddings.load('mlx-community/bge-small-en-v1.5-4bit') * const a = await Embeddings.embed('cats are cute') * const b = await Embeddings.embed('kittens are adorable') * console.log(cosineSimilarity(a, b)) * ``` */ export declare const Embeddings: { /** * Load an embedding model into memory. Downloads from HuggingFace if not already cached. * @param modelId - HuggingFace model ID (e.g., 'mlx-community/bge-small-en-v1.5-4bit') * @param options - Callback invoked with loading progress (0-1) */ load(modelId: string, options?: EmbeddingsLoadOptions): Promise; /** * Unload the current model and release memory. */ unload(): void; /** * Embed a single text and return the vector as a `Float32Array`. */ embed(text: string): Promise; /** * Embed a batch of texts in a single padded forward pass. */ embedBatch(texts: string[]): Promise; /** * Embed a text as a retrieval *query*. For asymmetric models (E5, Nomic, Qwen3) * this auto-prepends the canonical query prefix. For symmetric models (BGE, * MiniLM) this is identical to `embed()`. */ embedQuery(text: string): Promise; /** * Embed a text as a retrieval *document* / passage. For asymmetric models * (E5, Nomic) this auto-prepends the canonical document prefix. For * symmetric models (BGE, MiniLM) this is identical to `embed()`. */ embedDocument(text: string): Promise; /** Whether a model is currently loaded */ readonly isLoaded: boolean; /** Output embedding dimension (e.g., 384 for bge-small) */ readonly dimension: number; /** Maximum supported sequence length (tokens) */ readonly maxSequenceLength: number; }; //# sourceMappingURL=embeddings.d.ts.map