import { type EmbeddingProvider, type VectorDocument, type VectorSearchOptions, type VectorSearchResult, type VectorStore } from '../hallucination/retrieval.js'; /** Options for the Chroma store. */ export interface ChromaVectorStoreOptions { /** The Chroma server. Defaults to `http://localhost:8000`. */ url?: string; /** The collection chunks are kept in. */ collection: string; /** The tenant. Defaults to `default_tenant`. */ tenant?: string; /** The database. Defaults to `default_database`. */ database?: string; /** Width of every vector. Must match the embedding function's output. */ dimensions: number; /** Sent as the `x-chroma-token` header, for Chroma Cloud or a server with token authentication. */ apiKey?: string; /** Embeds chunks that arrive without a vector, and search queries. Defaults to hashed term vectors. */ embed?: EmbeddingProvider; /** Replaces the global `fetch`, for a proxy, retries, or tests. */ fetch?: typeof globalThis.fetch; /** Headers added to every request. */ headers?: Record; /** Aborts a request that takes longer, in milliseconds. Defaults to 30 seconds. */ timeoutMs?: number; /** * The metadata fields a search can filter on. Chroma merges metadata when it replaces a record, so * a field the new version lacks has to be removed by name. With this list, every write sets each * declared field, or removes it, and a filter on any other field is refused: a replacement needs no * read and stays whole however many writers race. Without it, every top-level field is filterable, * and a replacement first reads which fields the stored version has. */ filterFields?: readonly string[]; } /** Raised when Chroma answers with an error. */ export declare class ChromaError extends Error { /** The HTTP status Chroma answered with. */ readonly status: number; /** Chroma's response body, as text. */ readonly body?: string | undefined; constructor(message: string, /** The HTTP status Chroma answered with. */ status: number, /** Chroma's response body, as text. */ body?: string | undefined); } /** * Retrieval chunks in a Chroma collection, through its v2 REST API. * * No Chroma client is a dependency. The collection uses cosine distance, and a result's score is one * minus that distance, so scores mean the same as in every other store. Top-level string, number, and * boolean metadata fields are copied under `meta_` names for filtering; the whole metadata travels as * JSON, so nested values come back too. A replacement is whole: a field the new version lacks is * removed rather than merged, as `filterFields` explains. */ export declare class ChromaVectorStore implements VectorStore { private readonly options; private readonly base; private readonly embed; private readonly declared?; private collectionId; constructor(options: ChromaVectorStoreOptions); /** Creates the collection with cosine distance unless it exists. Never runs implicitly. */ migrate(): Promise; /** Adds chunks, or replaces those whose id exists, embedding those without a vector in one batch. */ add(documents: VectorDocument[]): Promise; /** The chunks most similar to a query, best first. */ search(query: string, options?: VectorSearchOptions): Promise; /** The chunks most similar to a vector, best first. */ searchVector(vector: number[], options?: VectorSearchOptions): Promise; /** Removes chunks by id. */ delete(ids: readonly string[]): Promise; /** A record's Chroma metadata: its filter fields, its source, and the whole metadata as JSON. */ private recordMetadata; private records; private request; }