Instance of EmbeddingsInterface
used to generate vector embeddings for
documents, enabling vector-based search operations.
Defines the filter type used in search and delete operations. Can be an object for structured conditions or a string for simpler filtering.
Abstract
lc_A path to the module that contains the class, eg. ["langchain", "llms"] Usually should be the same as the entrypoint the class is exported from.
A map of aliases for constructor args. Keys are the attribute names, e.g. "foo". Values are the alias that will replace the key in serialization. This is used to eg. make argument names match Python.
A map of additional attributes to merge with constructor args. Keys are the attribute names, e.g. "foo". Values are the attribute values, which will be serialized. These attributes need to be accepted by the constructor as arguments.
The final serialized identifier for the module.
A map of secrets, which will be omitted from serialization. Keys are paths to the secret in constructor args, e.g. "foo.bar.baz". Values are the secret ids, which will be used when deserializing.
A manual list of keys that should be serialized. If not overridden, all fields passed into the constructor will be serialized.
Returns a string identifying the type of vector store implementation, useful for distinguishing between different vector storage backends.
A string indicating the vector store type.
Adds an array of documents to the vector store.
An array of documents to be embedded and stored in the vector store.
Optional
options: AddDocumentOptionsOptional configurations for embedding and storage operations.
A promise that resolves to an array of document IDs or void, depending on implementation.
Adds precomputed vectors and their corresponding documents to the vector store.
An array of vectors, with each vector representing a document.
An array of DocumentInterface
instances corresponding to each vector.
Optional
options: AddDocumentOptionsOptional configurations for adding documents, potentially covering indexing or metadata handling.
A promise that resolves to an array of document IDs or void, depending on implementation.
Converts the vector store into a retriever, making it suitable for use in retrieval-based workflows and allowing additional configuration.
Optional
kOrFields: number | Partial<VectorStoreRetrieverInput<VectorStoreInterface>>Optional parameter for specifying either the number of documents to retrieve or partial retriever configurations.
Optional
filter: string | objectOptional filter based on FilterType
for retrieval restriction.
Optional
callbacks: CallbacksOptional callbacks for tracking retrieval events or progress.
Optional
tags: string[]General-purpose tags to add contextual information to the retriever.
Optional
metadata: Record<string, unknown>General-purpose metadata providing additional context for retrieval.
Optional
verbose: booleanIf true
, enables detailed logging during retrieval.
An instance of VectorStoreRetriever
configured with the specified options.
Deletes documents from the vector store based on the specified parameters.
Optional
_params: Record<string, any>A flexible object containing key-value pairs that define the conditions for selecting documents to delete.
A promise that resolves once the deletion operation is complete.
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.
Options for configuring a maximal marginal relevance (MMR) search.
MMR search optimizes for both similarity to the query and diversity among the results, balancing the retrieval of relevant documents with variation in the content returned.
Fields:
fetchK
(optional): The initial number of documents to retrieve from the
vector store before applying the MMR algorithm. This larger set provides a
pool of documents from which the algorithm can select the most diverse
results based on relevance to the query.
filter
(optional): A filter of type FilterType
to refine the search
results, allowing additional conditions to target specific subsets
of documents.
k
: The number of documents to return in the final results. This is the
primary count of documents that are most relevant to the query.
lambda
(optional): A value between 0 and 1 that determines the balance
between relevance and diversity:
lambda
of 0 emphasizes diversity, maximizing content variation.lambda
of 1 emphasizes similarity to the query, focusing on relevance.
Values between 0 and 1 provide a mix of relevance and diversity.Optional
fetchK?: numberOptional
filter?: FilterTypeOptional
lambda?: numberSearches for documents similar to a text query, embedding the query and retrieving documents based on vector similarity.
The text query to search for.
Optional
k: numberOptional number of similar documents to return.
Optional
filter: string | objectOptional filter based on FilterType
to restrict results.
Optional
callbacks: CallbacksOptional callbacks for tracking progress or events during the search process.
A promise that resolves to an array of DocumentInterface
instances representing similar documents.
Searches for documents similar to a given vector query and returns them with similarity scores.
A vector representing the query for similarity search.
The number of similar documents to return.
Optional
filter: string | objectOptional filter based on FilterType
to restrict results.
A promise that resolves to an array of tuples, each containing a
DocumentInterface
and its corresponding similarity score.
Searches for documents similar to a text query and includes similarity scores in the result.
The text query to search for.
Optional
k: numberOptional number of similar documents to return.
Optional
filter: string | objectOptional filter based on FilterType
to restrict results.
Optional
callbacks: CallbacksOptional callbacks for tracking progress or events during the search process.
A promise that resolves to an array of tuples, each containing
a DocumentInterface
and its similarity score.
Interface defining the structure and operations of a vector store, which facilitates the storage, retrieval, and similarity search of document vectors.
VectorStoreInterface
provides methods for adding, deleting, and searching documents based on vector embeddings, including support for similarity search with optional filtering and relevance-based retrieval.