Optional
credentials: CloseVectorCredentialsOptional
credentialsMethod 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.
The documents to be added to the vector store.
A Promise that resolves when the documents have been added.
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.
The vectors to be added to the vector store.
The documents corresponding to the vectors.
A Promise that resolves when the vectors and documents have been added.
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.
An object with a directory property that specifies the directory from which to delete the vector store.
A Promise that resolves when the vector store has been deleted.
Method to save the vector store to a directory. It saves the HNSW index, the arguments, and the document store to the directory.
The directory to which to save the vector store. In CloseVector, we use IndexedDB to mock the file system. Therefore, this parameter is can be treated as a key to the contents stored.
A Promise that resolves when the vector store has been saved.
Method to save the index to the CloseVector CDN.
Optional
credentials?: CloseVectorCredentialsthe credentials to be used to access the CloseVector API
Optional
description?: stringa description of the index
Optional
ona callback function to track the upload progress
a callback function to track the upload progress
Optional
public?: booleana boolean to determine if the index should be public or private, if not provided, the index will be private. If the index is public, it can be accessed by anyone with the uuid.
Optional
uuid?: stringafter uploading the index to the CloseVector CDN, the uuid of the index can be obtained by instance.uuid
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.
The query vector.
The number of most similar documents to return.
Optional
filter: ((doc) => boolean)An optional filter function to filter the documents.
A Promise that resolves to an array of tuples, where each tuple contains a document and its similarity score.
Static
fromStatic method to create a new CloseVectorWeb instance from documents. It creates a new CloseVectorWeb instance, adds the documents to it, then returns the instance.
The documents to be added to the CloseVectorWeb instance.
The embeddings to be used by the CloseVectorWeb instance.
Optional
args: Record<string, unknown>An optional configuration object for the CloseVectorWeb instance.
Optional
credentials: CloseVectorCredentialsAn optional credential object for the CloseVector API.
A Promise that resolves to a new CloseVectorWeb instance.
Static
fromStatic 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 texts to be used to create the documents.
The metadata to be used to create the documents.
The embeddings to be used by the CloseVectorWeb instance.
Optional
args: Record<string, unknown>An optional configuration object for the CloseVectorWeb instance.
Optional
credential: CloseVectorCredentialsAn optional credential object for the CloseVector API.
A Promise that resolves to a new CloseVectorWeb instance.
Static
importsStatic
loadStatic 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 CloseVectorWeb instance with these values.
The directory from which to load the vector store.
The embeddings to be used by the CloseVectorWeb instance.
Optional
credentials: CloseVectorCredentialsA Promise that resolves to a new CloseVectorWeb instance.
Static
loadMethod to load the index from the CloseVector CDN.
the embeddings to be used by the CloseVectorWeb instance
after uploading the index to the CloseVector CDN, the uuid of the index can be obtained by instance.uuid
Optional
credentials?: CloseVectorCredentialsthe credentials to be used to access the CloseVector API
Optional
ona callback function to track the download progress
a callback function to track the download progress
Static
textsGenerated using TypeDoc
Class that implements a vector store using CloseVector, It extends the SaveableVectorStore class and provides methods for adding documents and vectors, performing similarity searches, and saving and loading the vector store.