Public declaration syntax from forge-ts/packages/forge-embed/src/vector-store.ts Original source SHA-256: 891f3d1715a5a8ebcf481ff1c2d9588650e0a82b2972c0c0470c3eb37e41dbe1 Function bodies and constant values are omitted. This is not the complete implementation. Source line 20 export interface VectorEntry { /** The unique identifier for this entry. */ readonly id: string; /** The embedding vector. */ readonly vector: readonly number[]; /** Optional key-value metadata for filtering and retrieval. */ readonly metadata: Record; } Source line 34 export interface SearchResult { /** The matching vector entry. */ readonly entry: VectorEntry; /** The similarity score (higher is more similar). */ readonly score: number; } Source line 54 export interface VectorStore { /** * Inserts a vector entry into the store. * * If an entry with the same ID already exists, it is overwritten. * * @param entry - The vector entry to insert. * @throws {ForgeEmbedError} If the insert fails. */ insert(entry: VectorEntry): Promise; /** * Searches for the top K most similar vectors to the query. * * @param queryVector - The query vector. * @param topK - Maximum number of results to return. * @returns An array of SearchResult sorted by score descending. * @throws {ForgeEmbedError} If the search fails. */ search(queryVector: readonly number[], topK: number): Promise; /** * Deletes a vector entry by its identifier. * * @param id - The identifier of the entry to delete. * @returns `true` if the entry was found and deleted, `false` otherwise. * @throws {ForgeEmbedError} If the delete fails. */ delete(id: string): Promise; } Source line 99 export class InMemoryVectorStore implements VectorStore { async insert(entry: VectorEntry): Promise; async search(queryVector: readonly number[], topK: number): Promise; async delete(id: string): Promise; get size(): number; }