Class that implements a vector store using Hierarchical Navigable Small World (HNSW) graphs. It extends the SaveableVectorStore class and provides methods for adding documents and vectors, performing similarity searches, and saving and loading the vector store.
class CloseVectorNodeCloseVector<CloseVectorHNSWNode>Embeddings interface for generating vector embeddings from text queries, enabling vector-based similarity searches.
Returns a string representing the type of vector store, which subclasses must implement to identify their specific vector storage type.
Method to add documents to the vector store. It first converts the documents to vectors using the embeddings, then adds the vectors to the vector store.
Method to add vectors to the vector store. It first initializes the index if it hasn't been initialized yet, then adds the vectors to the index and the documents to the document store.
Creates a VectorStoreRetriever instance with flexible configuration options.
Method to delete the vector store from a directory. It deletes the hnswlib.index file, the docstore.json file, and the args.json file from the directory.
Return documents selected using the maximal marginal relevance. Maximal marginal relevance optimizes for similarity to the query AND diversity among selected documents.
Method to save the vector store to a directory. It saves the HNSW index, the arguments, and the document store to the directory.
Method to save the index to the CloseVector CDN.
Searches for documents similar to a text query by embedding the query and performing a similarity search on the resulting vector.
Method to perform a similarity search in the vector store using a query vector. It returns the k most similar documents along with their similarity scores. An optional filter function can be provided to filter the documents.
Searches for documents similar to a text query by embedding the query, and returns results with similarity scores.
Static method to create a new CloseVectorNode instance from documents. It creates a new CloseVectorNode instance, adds the documents to it, then returns the instance.
Static method to create a new CloseVectorWeb instance from texts and metadata. It creates a new Document instance for each text and metadata, then calls the fromDocuments method to create the CloseVectorWeb instance.
The name of the serializable. Override to provide an alias or to preserve the serialized module name in minified environments.
Implemented as a static method to support loading logic.
Static method to load a vector store from a directory. It reads the HNSW index, the arguments, and the document store from the directory, then creates a new HNSWLib instance with these values.
Method to load the index from the CloseVector CDN.