import type { EmbeddingProvider, VectorDocument, VectorSearchOptions } from '../hallucination/retrieval.js'; /** Every document's vector, in order, embedding the ones without a vector in one batch. */ export declare function vectorsFor(documents: readonly VectorDocument[], embed: EmbeddingProvider, dimensions: number): Promise; /** Refuses a vector whose width does not match the store's, before it reaches the database. */ export declare function assertWidth(vector: readonly number[] | undefined, dimensions: number): asserts vector is number[]; /** * A search's `topK`, or 5 when it has none. Anything but a positive integer is refused here, because * some stores place the limit in a query string, where a crafted value could change the query. */ export declare function searchLimit(topK: number | undefined): number; /** Checks a store's `dimensions` option. */ export declare function assertDimensions(dimensions: number): void; /** The prefix that marks a copied metadata field in stores that filter on flat fields. */ export declare const META_PREFIX = "meta_"; /** * A chunk's top-level string, number, and boolean metadata, copied under `meta_` names, which is what * stores with flat, typed payloads filter on. The whole metadata travels separately as JSON, so * nested values still come back. */ export declare function filterFields(metadata: Record | undefined): Record; /** A search's filter entries, or none when the filter is empty. */ export declare function filterEntries(filter: VectorSearchOptions['filter']): Array<[string, string | number | boolean]>; /** Parses metadata stored as JSON, tolerating a missing value. */ export declare function parseMetadata(value: unknown): Record | undefined; /** A stable UUID for a chunk id, from the first 16 bytes of its SHA-256, shaped as version 5. */ export declare function stableUuid(id: string): Promise; /** What a JSON-over-HTTP store needs to make one request. */ export interface JsonRequest { fetch: typeof globalThis.fetch; url: string; method: string; headers: Record; body?: unknown; timeoutMs: number; /** Returned instead of throwing when the server answers 404. */ notFound?: unknown; /** Builds the error thrown for a status that is not 2xx. */ error: (message: string, status: number, body: string) => Error; } /** Sends a JSON request with a timeout and returns the parsed body, or `undefined` when it is empty. */ export declare function requestJson(request: JsonRequest): Promise;