import type { EmbeddingConfig, EmbeddingRequest, EmbeddingResponse, EmbeddingsProvider } from '../types/embeddings.js'; import type { EmbeddingManagerRuntime } from './manager.js'; /** * What `EmbeddingManager` loads on the first embedding: routing, caching, batching, the budget, * retries, and the provider calls. Kept apart so a client that never embeds never imports it. */ export declare class EmbeddingEngine { private readonly config; private readonly runtime; /** The manager's registry, shared so adapters registered here are visible to it and back. */ private readonly providers; private readonly tokenizer; private readonly lifecycle; private readonly localCache?; private autoRegistered; constructor(config: EmbeddingConfig, runtime: EmbeddingManagerRuntime, /** The manager's registry, shared so adapters registered here are visible to it and back. */ providers: Map); /** * Embeds one text or a batch. * * The single-string form returns one vector at `vectors[0]`; a batch returns them in input order * regardless of how many provider calls the split required. */ embed(request: EmbeddingRequest): Promise; /** Answers an admitted request: the cache first, then the provider for whatever is left. */ private runEmbed; /** Embeds one text and returns the vector alone, for callers that never need the metadata. */ embedOne(text: string, options?: Omit): Promise; private resolveRoute; /** * Uses the adapter's own default model when the request named none. * * Without this a caller with a single non-OpenAI adapter would be routed to the `auto` alias * target, which that adapter does not serve. */ private withProviderDefaultModel; /** Builds the adapters the client's provider credentials imply, unless one of that name exists. */ private ensureAutoRegistered; private runBatches; private callWithRetry; private callProvider; private postProcess; /** Applies the per-request cost limit, when one is set, and returns the estimate it priced. */ private enforceCostBudget; /** What the inputs would cost on a model, in US dollars, for the shared budget. */ private estimateCost; private estimate; private cacheContext; /** * Every input's cached vector, or `undefined`. A shared store answers the whole request in one * call, keyed by hash; an adapter is asked for each input at once, under the keys it always had, * so a fleet mid-rollout still shares entries. */ private readCache; private writeCache; /** Keys for a shared store. Loaded with the store, so an engine without one never hashes. */ private storeKeys; }