Constructs an InMemoryVectorStore instance.
Note: The store is not ready for use until initialize is called.
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).
Optional options: CreateCollectionOptionsInMemoryVectorStore, createCollection ensures a named collection space is ready.
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).
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.
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.
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.
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.
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: 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.
Implements the
IVectorStoreinterface using in-memory data structures. Provides a simple, fast vector store primarily for development and testing.InMemoryVectorStore
Implements