import type { EmbeddingCacheEntry, EmbeddingCacheStore } from '../types/embeddings.js'; import type { MigrationResult, SchemaMigration } from '../utils/schema-migrations.js'; import { type PostgresLikeClient } from './client.js'; import type { PostgresMigrateOptions } from './migrations.js'; /** Options for the Postgres embedding cache. */ export interface PostgresEmbeddingCacheOptions { /** The table, optionally schema-qualified. Defaults to `nexus_embedding_cache`. */ table?: string; } /** The versioned schema, which `migrate()` and `nexus db migrate` apply. */ export declare function embeddingCacheMigrations(options?: PostgresEmbeddingCacheOptions): SchemaMigration[]; /** * Vectors in a Postgres table, shared by every process that reaches the database. A batch is one * `SELECT` and one upsert, and a vector is packed float32: 6 KB for 1,536 dimensions. */ export declare class PostgresEmbeddingCache implements EmbeddingCacheStore { private readonly client; private readonly options; private readonly table; constructor(client: PostgresLikeClient, options?: PostgresEmbeddingCacheOptions); /** Applies the table's pending migrations. Never runs implicitly. */ migrate(options?: PostgresMigrateOptions): Promise; /** The vectors under these keys, in order, with `undefined` for each miss or expired entry. */ getMany(keys: readonly string[]): Promise>; /** Stores vectors, each for `ttlSeconds` when given. */ setMany(entries: readonly EmbeddingCacheEntry[], ttlSeconds?: number): Promise; /** Deletes expired vectors, returning how many went. */ purgeExpired(): Promise; }