Async Initializes the vector store provider with its specific configuration. This method must be called before any other operations can be performed. It sets up connections, authenticates, and prepares the store for use.
The configuration object specific to this vector store provider.
This is typically a more specific type that extends VectorStoreProviderConfig.
A promise that resolves when initialization is complete.
If initialization fails (e.g., invalid configuration, connection error, authentication failure).
Async Upserts (inserts or updates) a batch of documents into a specified collection. If a document with the same ID already exists, it is typically updated; otherwise, it's inserted.
The name of the collection (or index, class, etc.) to upsert documents into.
An array of documents to upsert.
Optional options: UpsertOptionsOptional parameters for the upsert operation.
A promise that resolves with the result of the upsert operation.
If the upsert operation fails critically.
Async Queries a specified collection for documents similar to the provided query embedding.
The name of the collection to query.
The query vector embedding.
Optional options: QueryOptionsOptional parameters for the query operation, including filters and topK.
A promise that resolves with the query results.
If the query operation fails.
Optional scanOptional fetchAsync Optional: Fetch documents by their primary IDs without similarity ranking.
Used by callers like HybridSearcher to hydrate documents that were
ranked by a sparse / lexical index but missed the dense top-K — a
primary-key fetch is the only correct hydration path here because a
second similarity query would surface the next-K dense rows instead
of the specific BM25 winners, misattributing rows under the wrong
fused-score position.
Stores that cannot do efficient PK fetches (e.g. some sparse-only or remote indexes) may leave this unimplemented; callers must then choose whether to drop sparse-only winners or fall back to text-content-missing results.
The returned RetrievedVectorDocument.similarityScore is set to 0 as
a sentinel — callers that try to rank these by similarityScore will
get an obvious "no similarity" signal rather than a stale cosine number.
The collection to fetch from.
Document IDs to fetch. Empty array returns [].
Optional options: { Optional inclusion flags (default both true).
Optional includeOptional includeHydrated documents in implementation-defined order (callers should not rely on ordering).
Optional hybridOptional: Hybrid retrieval combining dense vector similarity with lexical search.
This is typically implemented using a store-native full-text index (e.g., SQLite FTS5), or a store-side BM25 implementation, then fusing dense and lexical rankings (e.g., RRF).
If not implemented, callers should fall back to query() (dense similarity).
Optional options: QueryOptions & { Optional lexicalOptional: search on the store's lexical index alone, with no embedding. match asks for every word ('all') or
any word ('any', the default); prefix matches a stored word that begins with a query word.
Optional options: QueryOptions & { Optional updateOptional: change the metadata of every document a filter matches. A key whose value is null is removed; the
other keys replace the stored ones. The filter must hold at least one condition.
Async Deletes documents from a specified collection by their IDs or by a metadata filter.
The name of the collection to delete documents from.
Optional ids: string[]An array of document IDs to delete.
Optional options: DeleteOptionsOptional parameters, including metadata filters or a deleteAll flag.
If ids are provided, options.filter might be ignored or combined,
depending on store behavior. Use with caution.
A promise that resolves with the result of the delete operation.
If the delete operation fails.
Optional createAsync Creates a new collection (or index, class, etc.) in the vector store. This is often necessary before documents can be upserted into it, depending on the provider.
The name of the collection to create.
The dimensionality of the vector embeddings that will be stored in this collection.
Optional options: CreateCollectionOptionsOptional parameters for collection creation, such as similarity metric or provider-specific settings.
A promise that resolves when the collection is successfully created.
If collection creation fails (e.g., name conflict and not overwriting, invalid parameters).
Optional deleteAsync Deletes an entire collection from the vector store. This is a destructive operation.
The name of the collection to delete.
A promise that resolves when the collection is successfully deleted.
If collection deletion fails.
Optional collectionAsync Checks if a collection with the given name exists in the vector store.
The name of the collection to check.
A promise that resolves with true if the collection exists, false otherwise.
If the check fails for reasons other than existence (e.g., connection issue).
Async Checks the operational health of the vector store provider. This might involve pinging the service, checking connection status, or verifying authentication.
A promise that resolves with the health status.
details can include specific error messages or status information.
Optional getAsync Optional: Retrieves statistics about a specific collection or the store itself. The structure of the returned statistics is provider-dependent.
Optional collectionName: stringOptional: The name of the collection to get stats for. If omitted, may return store-wide stats if supported.
A promise that resolves with a statistics object.
If fetching statistics fails.
Interface
IVectorStore
Description
Defines the contract for interacting with a specific vector database or storage backend. Implementations will wrap specific clients (e.g., Pinecone client, Weaviate client, in-memory store logic).