multi_vector.py — langchain Source File
Architecture documentation for multi_vector.py, a python file in the langchain codebase. 10 imports, 0 dependents.
Entity Profile
Dependency Diagram
graph LR 3cc61483_6a5a_7183_a480_7020803f3c23["multi_vector.py"] 7ec08df6_88bd_07ab_d50f_0d4c4e429b7e["enum"] 3cc61483_6a5a_7183_a480_7020803f3c23 --> 7ec08df6_88bd_07ab_d50f_0d4c4e429b7e feec1ec4_6917_867b_d228_b134d0ff8099["typing"] 3cc61483_6a5a_7183_a480_7020803f3c23 --> feec1ec4_6917_867b_d228_b134d0ff8099 17a62cb3_fefd_6320_b757_b53bb4a1c661["langchain_core.callbacks"] 3cc61483_6a5a_7183_a480_7020803f3c23 --> 17a62cb3_fefd_6320_b757_b53bb4a1c661 6a98b0a5_5607_0043_2e22_a46a464c2d62["langchain_core.documents"] 3cc61483_6a5a_7183_a480_7020803f3c23 --> 6a98b0a5_5607_0043_2e22_a46a464c2d62 2b1aa4a8_5352_1757_010a_46ac9ef4b0b0["langchain_core.retrievers"] 3cc61483_6a5a_7183_a480_7020803f3c23 --> 2b1aa4a8_5352_1757_010a_46ac9ef4b0b0 18bf18ce_a804_12d4_efe2_700bc6c22630["langchain_core.stores"] 3cc61483_6a5a_7183_a480_7020803f3c23 --> 18bf18ce_a804_12d4_efe2_700bc6c22630 f75e66a0_314a_f961_16d7_464ee959064b["langchain_core.vectorstores"] 3cc61483_6a5a_7183_a480_7020803f3c23 --> f75e66a0_314a_f961_16d7_464ee959064b dd5e7909_a646_84f1_497b_cae69735550e["pydantic"] 3cc61483_6a5a_7183_a480_7020803f3c23 --> dd5e7909_a646_84f1_497b_cae69735550e f85fae70_1011_eaec_151c_4083140ae9e5["typing_extensions"] 3cc61483_6a5a_7183_a480_7020803f3c23 --> f85fae70_1011_eaec_151c_4083140ae9e5 e2ba6b78_0b02_b5ad_e6e7_1832ca0c7eea["langchain_classic.storage._lc_store"] 3cc61483_6a5a_7183_a480_7020803f3c23 --> e2ba6b78_0b02_b5ad_e6e7_1832ca0c7eea style 3cc61483_6a5a_7183_a480_7020803f3c23 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
from enum import Enum
from typing import Any
from langchain_core.callbacks import (
AsyncCallbackManagerForRetrieverRun,
CallbackManagerForRetrieverRun,
)
from langchain_core.documents import Document
from langchain_core.retrievers import BaseRetriever
from langchain_core.stores import BaseStore, ByteStore
from langchain_core.vectorstores import VectorStore
from pydantic import Field, model_validator
from typing_extensions import override
from langchain_classic.storage._lc_store import create_kv_docstore
class SearchType(str, Enum):
"""Enumerator of the types of search to perform."""
similarity = "similarity"
"""Similarity search."""
similarity_score_threshold = "similarity_score_threshold"
"""Similarity search with a score threshold."""
mmr = "mmr"
"""Maximal Marginal Relevance reranking of similarity search."""
class MultiVectorRetriever(BaseRetriever):
"""Retrieve from a set of multiple embeddings for the same document."""
vectorstore: VectorStore
"""The underlying `VectorStore` to use to store small chunks
and their embedding vectors"""
byte_store: ByteStore | None = None
"""The lower-level backing storage layer for the parent documents"""
docstore: BaseStore[str, Document]
"""The storage interface for the parent documents"""
id_key: str = "doc_id"
search_kwargs: dict = Field(default_factory=dict)
"""Keyword arguments to pass to the search function."""
search_type: SearchType = SearchType.similarity
"""Type of search to perform (similarity / mmr)"""
@model_validator(mode="before")
@classmethod
def _shim_docstore(cls, values: dict) -> Any:
byte_store = values.get("byte_store")
docstore = values.get("docstore")
if byte_store is not None:
docstore = create_kv_docstore(byte_store)
elif docstore is None:
msg = "You must pass a `byte_store` parameter."
raise ValueError(msg)
values["docstore"] = docstore
// ... (83 more lines)
Domain
Subdomains
Classes
Dependencies
- enum
- langchain_classic.storage._lc_store
- langchain_core.callbacks
- langchain_core.documents
- langchain_core.retrievers
- langchain_core.stores
- langchain_core.vectorstores
- pydantic
- typing
- typing_extensions
Source
Frequently Asked Questions
What does multi_vector.py do?
multi_vector.py is a source file in the langchain codebase, written in python. It belongs to the LangChainCore domain, Runnables subdomain.
What does multi_vector.py depend on?
multi_vector.py imports 10 module(s): enum, langchain_classic.storage._lc_store, langchain_core.callbacks, langchain_core.documents, langchain_core.retrievers, langchain_core.stores, langchain_core.vectorstores, pydantic, and 2 more.
Where is multi_vector.py in the architecture?
multi_vector.py is located at libs/langchain/langchain_classic/retrievers/multi_vector.py (domain: LangChainCore, subdomain: Runnables, directory: libs/langchain/langchain_classic/retrievers).
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free