Adds an array of documents to the collection. The documents are first
converted to vectors using the embedDocuments
method of the
embeddings
instance.
Array of Document instances to be added to the collection.
Promise that resolves when the documents are added.
Adds an array of vectors and corresponding documents to the collection. The vectors and documents are batch inserted into the database.
Array of vectors to be added to the collection.
Array of Document instances corresponding to the vectors.
Promise that resolves when the vectors and documents are added.
Optional
kOrFields: number | Partial<VectorStoreRetrieverInput<AnalyticDBVectorStore>>Optional
filter: Record<string, any>Optional
callbacks: CallbacksOptional
tags: string[]Optional
metadata: Record<string, unknown>Optional
verbose: booleanCreates a new table in the database if it does not already exist. The table is created with columns for id, embedding, document, and metadata. An index is also created on the embedding column if it does not already exist.
Promise that resolves when the table and index are created.
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.
Performs a similarity search on the vectors in the collection. The search is performed using the given query vector and returns the top k most similar vectors along with their corresponding documents and similarity scores.
Query vector for the similarity search.
Number of top similar vectors to return.
Optional
filter: Record<string, any>Optional. Filter to apply on the metadata of the documents.
Promise that resolves to an array of tuples, each containing a Document instance and its similarity score.
Static
fromCreates an instance of AnalyticDBVectorStore
from an array of
Document instances. The documents are added to the collection.
Array of Document instances to be added to the collection.
Embeddings instance used to convert the documents to vectors.
Configuration for the AnalyticDB.
Promise that resolves to an instance of AnalyticDBVectorStore
.
Static
fromCreates an instance of AnalyticDBVectorStore
from an existing index
in the database. A new collection is created in the database.
Embeddings instance used to convert the documents to vectors.
Configuration for the AnalyticDB.
Promise that resolves to an instance of AnalyticDBVectorStore
.
Static
fromCreates an instance of AnalyticDBVectorStore
from an array of texts
and corresponding metadata. The texts are first converted to Document
instances before being added to the collection.
Array of texts to be added to the collection.
Array or object of metadata corresponding to the texts.
Embeddings instance used to convert the texts to vectors.
Configuration for the AnalyticDB.
Promise that resolves to an instance of AnalyticDBVectorStore
.
Class that provides methods for creating and managing a collection of documents in an AnalyticDB, adding documents or vectors to the collection, performing similarity search on vectors, and creating an instance of
AnalyticDBVectorStore
from texts or documents.