UNPKG

@adonis-agora/agent

Version:

Governed, durable-backed AI agent (chat + tool-calling + governance) for AdonisJS — part of the Agora ecosystem.

35 lines • 2.19 kB
import type { Passage } from '../spi/retriever.js'; import { type IndexedDocument, type MetadataPatch, type VectorRecord, type VectorSearchOptions, type VectorStore } from './vector-store.js'; /** * An in-process {@link VectorStore} — cosine similarity over a Map, no infra. The reference adapter for * tests and small/embedded corpora; a pgvector/Lucid-backed store for production scale is deferred. */ export declare class MemoryVectorStore implements VectorStore { private readonly records; upsert(records: VectorRecord[]): Promise<void>; remove(documentId: string): Promise<void>; /** * {@link VectorStore.updateMetadata} — rewrite every chunk's metadata for one document, touching * neither `text` nor `embedding`. Both are carried across by the spread, so the stored `embedding` * stays the **same array instance** it was upserted with: nothing here can perturb a vector even in * principle. Merge semantics come from the shared {@link applyMetadataPatch}, so this adapter cannot * drift from the other two. */ updateMetadata(documentId: string, patch: MetadataPatch): Promise<number>; listDocuments(filter?: Record<string, unknown>): Promise<IndexedDocument[]>; /** * {@link VectorStore.listDocumentIds} — the ids `listDocuments` would report, without building the * per-document metadata entries. Filtering goes through the same {@link matchesFilter} `search` uses. */ listDocumentIds(filter?: Record<string, unknown>): Promise<string[]>; /** * {@link VectorStore.removeWhere} — delete every chunk the same filter would let `search` reach. * Parity is by construction: the predicate below is the identical {@link matchesFilter} call, on the * identical argument, as the one in {@link MemoryVectorStore.search}. */ removeWhere(filter: Record<string, unknown>): Promise<number>; search(embedding: number[], options: VectorSearchOptions): Promise<Passage[]>; } /** Cosine similarity of two vectors; `0` when either has zero magnitude. Pure. */ export declare function cosineSimilarity(a: number[], b: number[]): number; //# sourceMappingURL=memory-vector-store.d.ts.map