LangChain Reference home pageLangChain ReferenceLangChain Reference
  • GitHub
  • Main Docs
Deep Agents
LangChain
LangGraph
Integrations
LangSmith
LangChain
  • Universal
  • Hub
  • Node
  • Load
  • Serializable
  • Encoder Backed
  • File System
  • In Memory
LangChain Core
  • Agents
  • Caches
  • Base
  • Dispatch
  • Web
  • Manager
  • Promises
  • Chat History
  • Context
  • Base
  • Langsmith
  • Documents
  • Embeddings
  • Errors
  • Example Selectors
  • Indexing
  • Base
  • Chat Models
  • Llms
  • Profile
  • Load
  • Serializable
  • Memory
  • Messages
  • Tool
  • Output Parsers
  • Openai Functions
  • Openai Tools
  • Outputs
  • Prompt Values
  • Prompts
  • Retrievers
  • Document Compressors
  • Runnables
  • Graph
  • Singletons
  • Stores
  • Structured Query
  • Tools
  • Base
  • Console
  • Log Stream
  • Run Collector
  • Tracer Langchain
  • Stream
  • Async Caller
  • Chunk Array
  • Context
  • Env
  • Event Source Parse
  • Format
  • Function Calling
  • Hash
  • Json Patch
  • Json Schema
  • Math
  • Ssrf
  • Stream
  • Testing
  • Tiktoken
  • Types
  • Vectorstores
Text Splitters
MCP Adapters
⌘I

LangChain Assistant

Ask a question to get started

Enter to send•Shift+Enter new line

Menu

LangChain
UniversalHubNodeLoadSerializableEncoder BackedFile SystemIn Memory
LangChain Core
AgentsCachesBaseDispatchWebManagerPromisesChat HistoryContextBaseLangsmithDocumentsEmbeddingsErrorsExample SelectorsIndexingBaseChat ModelsLlmsProfileLoadSerializableMemoryMessagesToolOutput ParsersOpenai FunctionsOpenai ToolsOutputsPrompt ValuesPromptsRetrieversDocument CompressorsRunnablesGraphSingletonsStoresStructured QueryToolsBaseConsoleLog StreamRun CollectorTracer LangchainStreamAsync CallerChunk ArrayContextEnvEvent Source ParseFormatFunction CallingHashJson PatchJson SchemaMathSsrfStreamTestingTiktokenTypesVectorstores
Text Splitters
MCP Adapters
Language
Theme
JavaScript@langchain/corevectorstoresVectorStoreRetrieverInput
Typeā—Since v1.0

VectorStoreRetrieverInput

Input configuration options for creating a VectorStoreRetriever instance.

This type combines properties from BaseRetrieverInput with specific settings for the VectorStoreRetriever, 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 to true, enables detailed logging and output during the retrieval process. Defaults to false.

  • vectorStore: The VectorStore instance implementing VectorStoreInterface 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 type FilterType (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 if searchType 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.
Copy
VectorStoreRetrieverInput: BaseRetrieverInput  __type | __type
View source on GitHub