VectorStore interface

Interface for vector storage and similarity search backends.

Signature:

export declare interface VectorStore 

Methods

Method Modifiers Description
upsert(records) Inserts or updates records in the vector store.
delete(ids) Deletes records matching the specified IDs.
deleteByMetadata(metadataFilter) Deletes records matching the specified metadata filter.
search(queryEmbedding, topK, metadataFilter) Searches top-K nearest records to the query embedding.
get(ids) Retrieves records matching the specified IDs by key.
getAllRecordIds() Retrieves all unique record identifiers.
deleteAll() Deletes all records from the vector store.
close() Releases resources associated with the vector store.

VectorStore.upsert()

Inserts or updates records in the vector store.

Signature:

upsert(records: readonly RetrievalRecord[]): Promise<void> | void;

Parameters

Parameter Type Description
records readonly RetrievalRecord[]

Returns:

Promise<void> | void

VectorStore.delete()

Deletes records matching the specified IDs.

Signature:

delete(ids: readonly string[]): Promise<void> | void;

Parameters

Parameter Type Description
ids readonly string[]

Returns:

Promise<void> | void

VectorStore.deleteByMetadata()

Deletes records matching the specified metadata filter.

Signature:

deleteByMetadata(metadataFilter: Record<string, string>): Promise<void> | void;

Parameters

Parameter Type Description
metadataFilter Record

Returns:

Promise<void> | void

VectorStore.search()

Searches top-K nearest records to the query embedding.

Signature:

search(queryEmbedding: Float32Array | readonly number[], topK: number, metadataFilter?: Record<string, string>): Promise<RetrievalRecord[]> | RetrievalRecord[];

Parameters

Parameter Type Description
queryEmbedding Float32Array | readonly number[]
topK number
metadataFilter Record

Returns:

Promise<RetrievalRecord[]> | RetrievalRecord[]

VectorStore.get()

Retrieves records matching the specified IDs by key.

Signature:

get(ids: readonly string[]): Promise<RetrievalRecord[]> | RetrievalRecord[];

Parameters

Parameter Type Description
ids readonly string[]

Returns:

Promise<RetrievalRecord[]> | RetrievalRecord[]

VectorStore.getAllRecordIds()

Retrieves all unique record identifiers.

Signature:

getAllRecordIds(): Promise<string[]> | string[];

Returns:

Promise<string[]> | string[]

VectorStore.deleteAll()

Deletes all records from the vector store.

Signature:

deleteAll(): Promise<void> | void;

Returns:

Promise<void> | void

VectorStore.close()

Releases resources associated with the vector store.

Signature:

close(): void;

Returns:

void