_get_source_id_assigner() — langchain Function Reference
Architecture documentation for the _get_source_id_assigner() function in api.py from the langchain codebase.
Entity Profile
Dependency Diagram
graph TD 2a0916fb_362c_3fc6_1653_70983aeaa9dd["_get_source_id_assigner()"] 0a83ef61_4c07_e8b4_648c_4199ec598979["api.py"] 2a0916fb_362c_3fc6_1653_70983aeaa9dd -->|defined in| 0a83ef61_4c07_e8b4_648c_4199ec598979 38094325_d9b6_a147_c56c_209933148cce["index()"] 38094325_d9b6_a147_c56c_209933148cce -->|calls| 2a0916fb_362c_3fc6_1653_70983aeaa9dd 4540ac2f_95e9_c32c_6eec_88589007c350["aindex()"] 4540ac2f_95e9_c32c_6eec_88589007c350 -->|calls| 2a0916fb_362c_3fc6_1653_70983aeaa9dd style 2a0916fb_362c_3fc6_1653_70983aeaa9dd fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
libs/core/langchain_core/indexing/api.py lines 116–130
def _get_source_id_assigner(
source_id_key: str | Callable[[Document], str] | None,
) -> Callable[[Document], str | None]:
"""Get the source id from the document."""
if source_id_key is None:
return lambda _doc: None
if isinstance(source_id_key, str):
return lambda doc: doc.metadata[source_id_key]
if callable(source_id_key):
return source_id_key
msg = (
f"source_id_key should be either None, a string or a callable. "
f"Got {source_id_key} of type {type(source_id_key)}."
)
raise ValueError(msg)
Domain
Subdomains
Defined In
Source
Frequently Asked Questions
What does _get_source_id_assigner() do?
_get_source_id_assigner() is a function in the langchain codebase, defined in libs/core/langchain_core/indexing/api.py.
Where is _get_source_id_assigner() defined?
_get_source_id_assigner() is defined in libs/core/langchain_core/indexing/api.py at line 116.
What calls _get_source_id_assigner()?
_get_source_id_assigner() is called by 2 function(s): aindex, index.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free