Embeddings interface for generating vector embeddings from text queries, enabling vector-based similarity searches.
Method to add documents to the OpenSearch index. It first converts the documents to vectors using the embeddings, then adds the vectors to the index.
The documents to be added to the OpenSearch index.
Promise resolving to void.
Method to add vectors to the OpenSearch index. It ensures the index exists, then adds the vectors and associated documents to the index.
The vectors to be added to the OpenSearch index.
The documents associated with the vectors.
Optional
options: { Optional parameter that can contain the IDs for the documents.
Optional
ids?: string[]Promise resolving to void.
Creates a VectorStoreRetriever
instance with flexible configuration options.
Optional
kOrFields: number | Partial<VectorStoreRetrieverInput<OpenSearchVectorStore>>If a number is provided, it sets the k
parameter (number of items to retrieve).
Optional
filter: OpenSearchFilterOptional 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.Builds metadata terms for OpenSearch queries.
This function takes a filter object and constructs an array of query terms compatible with OpenSearch 2.x. It supports a variety of query types including term, terms, terms_set, ids, range, prefix, exists, fuzzy, wildcard, and regexp. Reference: https://opensearch.org/docs/latest/query-dsl/term/index/
The filter object used to construct query terms. Each key represents a field, and the value specifies the type of query and its parameters.
An array of OpenSearch query terms.
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: OpenSearchFilterOptional filter based on FilterType
.
Optional
_callbacks: CallbacksOptional callbacks for monitoring search progress
A promise resolving to an array of DocumentInterface
instances representing similar documents.
Method to perform a similarity search on the OpenSearch index using a query vector. It returns the k most similar documents and their scores.
The query vector.
The number of similar documents to return.
Optional
filter: OpenSearchFilterOptional filter for the OpenSearch query.
Promise resolving to an array of tuples, each containing a Document and its 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: OpenSearchFilterOptional 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
fromStatic method to create a new OpenSearchVectorStore from an array of Documents, embeddings, and OpenSearch client arguments.
The documents to be added to the OpenSearch index.
The embeddings used to convert the documents into vectors.
The OpenSearch client arguments.
Promise resolving to a new instance of OpenSearchVectorStore.
Static
fromStatic method to create a new OpenSearchVectorStore from an existing OpenSearch index, embeddings, and OpenSearch client arguments.
The embeddings used to convert the documents into vectors.
The OpenSearch client arguments.
Promise resolving to a new instance of OpenSearchVectorStore.
Static
fromStatic method to create a new OpenSearchVectorStore from an array of texts, their metadata, embeddings, and OpenSearch client arguments.
The texts to be converted into documents and added to the OpenSearch index.
The metadata associated with the texts. Can be an array of objects or a single object.
The embeddings used to convert the texts into vectors.
The OpenSearch client arguments.
Promise resolving to a new instance of OpenSearchVectorStore.
Class that provides a wrapper around the OpenSearch service for vector search. It provides methods for adding documents and vectors to the OpenSearch index, searching for similar vectors, and managing the OpenSearch index.