VectorStore interface

Interface for vector storage and similarity search backends.

Signature:

export declare interface VectorStore 

Methods

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

VectorStore.close()

Releases resources associated with the vector store.

Signature:

close(): void;

Returns:

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.deleteAll()

Deletes all records from the vector store.

Signature:

deleteAll(): Promise<void> | void;

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<string, string>

Returns:

Promise<void> | void

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.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<string, string>

Returns:

Promise<RetrievalRecord[]> | RetrievalRecord[]

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