Type Alias VectorStoreRetrieverInput<V>
VectorStoreRetrieverInput<V>: { callbacks?: undefined | Callbacks; filter?: undefined | V["FilterType"]; k?: undefined | number; metadata?: undefined | Record<string, unknown>; searchType?: undefined | "similarity" | "mmr"; tags?: undefined | string[]; vectorStore: V; verbose?: undefined | boolean; }
Input configuration options for creating a
VectorStoreRetriever
instance.This type combines properties from
BaseRetrieverInput
with specific settings for theVectorStoreRetriever
, including options for similarity or maximal marginal relevance (MMR) search types.Fields:
callbacks
(optional): An array of callback functions that handle various events during retrieval, such as logging, error handling, or progress updates.tags
(optional): An array of strings used to add contextual tags to retrieval operations, allowing for easier categorization and tracking.metadata
(optional): A record of key-value pairs to store additional contextual information for retrieval operations, which can be useful for logging or auditing purposes.verbose
(optional): A boolean flag that, if set totrue
, enables detailed logging and output during the retrieval process. Defaults tofalse
.vectorStore
: TheVectorStore
instance implementingVectorStoreInterface
that will be used for document storage and retrieval.k
(optional): Specifies the number of documents to retrieve per search query. Defaults to 4 if not specified.filter
(optional): A filter of typeFilterType
(defined by the vector store) to refine the set of documents returned, allowing for targeted search results.searchType
: Determines the type of search to perform:"similarity"
: Executes a similarity search, retrieving documents based purely on vector similarity to the query."mmr"
: Executes a maximal marginal relevance (MMR) search, balancing similarity and diversity in the search results.searchKwargs
(optional): Used only ifsearchType
is"mmr"
, this object provides additional options for MMR search, including:fetchK
: Specifies the number of documents to initially fetch before applying the MMR algorithm, providing a pool from which the most diverse results are selected.lambda
: A diversity parameter, where 0 emphasizes diversity and 1 emphasizes relevance to the query. Values between 0 and 1 provide a balance of relevance and diversity.