Embeddings interface for generating vector embeddings from text queries, enabling vector-based similarity searches.
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.
Creates a VectorStoreRetriever
instance with flexible configuration options.
Optional
kOrFields: number | Partial<VectorStoreRetrieverInput<AnalyticDBVectorStore>>If a number is provided, it sets the k
parameter (number of items to retrieve).
Optional
filter: Record<string, any>Optional 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.Creates 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.
Searches for documents similar to a text query by embedding the query and performing a similarity search on the resulting vector.
Text query for finding similar documents.
Optional
k: numberNumber of similar results to return. Defaults to 4.
Optional
filter: Record<string, any>Optional filter based on FilterType
.
Optional
_callbacks: CallbacksOptional callbacks for monitoring search progress
A promise resolving to an array of DocumentInterface
instances representing similar documents.
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.
Searches for documents similar to a text query by embedding the query, and returns results with similarity scores.
Text query for finding similar documents.
Optional
k: numberNumber of similar results to return. Defaults to 4.
Optional
filter: Record<string, any>Optional filter based on FilterType
.
Optional
_callbacks: CallbacksOptional callbacks for monitoring search progress
A promise resolving to an array of tuples, each containing a document 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.