Embeddings interface for generating vector embeddings from text queries, enabling vector-based similarity searches.
Run texts through the embeddings and persist in vectorstore. If the document IDs are passed, the existing documents (if any) will be overwritten with the new ones.
The corresponding documents to be added to the collection.
Optional parameters for adding documents. This may include the IDs and metadata of the documents to be added. Defaults to an empty object.
Add vectors and corresponding documents to a couchbase collection If the document IDs are passed, the existing documents (if any) will be overwritten with the new ones.
The vectors to be added to the collection.
The corresponding documents to be added to the collection.
Optional parameters for adding vectors. This may include the IDs and metadata of the documents to be added. Defaults to an empty object.
Creates a VectorStoreRetriever
instance with flexible configuration options.
Optional
kOrFields: number | Partial<VectorStoreRetrieverInput<CouchbaseVectorStore>>If a number is provided, it sets the k
parameter (number of items to retrieve).
Optional
filter: CouchbaseVectorStoreFilterOptional filter criteria to limit the items retrieved based on the specified filter type.
Optional
callbacks: CallbacksOptional callbacks that may be triggered at specific stages of the retrieval process.
Optional
tags: string[]Tags to categorize or label the VectorStoreRetriever
. Defaults to an empty array if not provided.
Optional
metadata: Record<string, unknown>Additional metadata as key-value pairs to add contextual information for the retrieval process.
Optional
verbose: booleanIf true
, enables detailed logging for the retrieval process. Defaults to false
.
VectorStoreRetriever
instance based on the provided parameters.Delete documents asynchronously from the collection. This function will attempt to remove each document in the provided list of IDs from the collection. If an error occurs during the deletion of a document, an error will be thrown with the ID of the document and the error message.
An array of document IDs to be deleted from the collection.
Optional
maxReturn documents selected using the maximal marginal relevance. Maximal marginal relevance optimizes for similarity to the query AND diversity among selected documents.
Text to look up documents similar to.
Return documents that are most similar to the query.
Query to look up for similar documents
The number of similar documents to return. Defaults to 4.
Optional search filter that are passed to Couchbase search. Defaults to empty object.
fields
: Optional list of fields to include in the
metadata of results. Note that these need to be stored in the index.
If nothing is specified, defaults to all the fields stored in the index.searchOptions
: Optional search options that are passed to Couchbase search. Defaults to empty object.Return documents that are most similar to the vector embedding.
Embedding to look up documents similar to.
The number of similar documents to return. Defaults to 4.
Optional search filter that are passed to Couchbase search. Defaults to empty object.
fields
: Optional list of fields to include in the
metadata of results. Note that these need to be stored in the index.
If nothing is specified, defaults to all the fields stored in the index.searchOptions
: Optional search options that are passed to Couchbase search. Defaults to empty object.Performs a similarity search on the vectors in the Couchbase database and returns the documents and their corresponding scores.
Embedding vector to look up documents similar to.
Number of documents to return. Defaults to 4.
Optional search filter that are passed to Couchbase search. Defaults to empty object.
fields
: Optional list of fields to include in the
metadata of results. Note that these need to be stored in the index.
If nothing is specified, defaults to all the fields stored in the index.searchOptions
: Optional search options that are passed to Couchbase search. Defaults to empty object.Return documents that are most similar to the query with their scores.
Query to look up for similar documents
The number of similar documents to return. Defaults to 4.
Optional search filter that are passed to Couchbase search. Defaults to empty object.
fields
: Optional list of fields to include in the
metadata of results. Note that these need to be stored in the index.
If nothing is specified, defaults to all the fields stored in the index.searchOptions
: Optional search options that are passed to Couchbase search. Defaults to empty object.Static
fromCreate a new CouchbaseVectorStore from a set of documents. This function will initialize a new store, add the documents to it, and then return the store.
The documents to be added to the new store.
The embeddings to be used for the documents.
The configuration for the new CouchbaseVectorStore. This includes the options for adding vectors.
Static
fromCreate a new CouchbaseVectorStore from a set of texts. This function will convert each text and its corresponding metadata into a Document, initialize a new store, add the documents to it, and then return the store.
The texts to be converted into Documents and added to the new store.
The metadata for each text. If an array is passed, each text will have its corresponding metadata. If not, all texts will have the same metadata.
The embeddings to be used for the documents.
The configuration for the new CouchbaseVectorStore. This includes the options for adding vectors.
Static
initializeinitialize class for interacting with the Couchbase database. It extends the VectorStore class and provides methods for adding vectors and documents, and searching for similar vectors. This also verifies the params
object to generate embedding
the fields required to initialize a vector store
Class for interacting with the Couchbase database. It extends the VectorStore class and provides methods for adding vectors and documents, and searching for similar vectors. Initiate the class using initialize() method.