_load_retrieval_qa_with_sources_chain() — langchain Function Reference
Architecture documentation for the _load_retrieval_qa_with_sources_chain() function in loading.py from the langchain codebase.
Entity Profile
Dependency Diagram
graph TD c47970c7_cbda_3a86_4a17_aa66b490bfab["_load_retrieval_qa_with_sources_chain()"] 61dd5a0b_3bf7_b973_6dac_edfd465b21fb["loading.py"] c47970c7_cbda_3a86_4a17_aa66b490bfab -->|defined in| 61dd5a0b_3bf7_b973_6dac_edfd465b21fb 7c915b91_f326_1908_9969_d0cb1f4f7e34["load_chain_from_config()"] c47970c7_cbda_3a86_4a17_aa66b490bfab -->|calls| 7c915b91_f326_1908_9969_d0cb1f4f7e34 ab90e794_4e78_646b_dee9_e87a00250d94["load_chain()"] c47970c7_cbda_3a86_4a17_aa66b490bfab -->|calls| ab90e794_4e78_646b_dee9_e87a00250d94 style c47970c7_cbda_3a86_4a17_aa66b490bfab fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
libs/langchain/langchain_classic/chains/loading.py lines 492–522
def _load_retrieval_qa_with_sources_chain(
config: dict,
**kwargs: Any,
) -> RetrievalQAWithSourcesChain:
if "retriever" in kwargs:
retriever = kwargs.pop("retriever")
else:
msg = "`retriever` must be present."
raise ValueError(msg)
if "combine_documents_chain" in config:
combine_documents_chain_config = config.pop("combine_documents_chain")
combine_documents_chain = load_chain_from_config(
combine_documents_chain_config,
**kwargs,
)
elif "combine_documents_chain_path" in config:
combine_documents_chain = load_chain(
config.pop("combine_documents_chain_path"),
**kwargs,
)
else:
msg = (
"One of `combine_documents_chain` or "
"`combine_documents_chain_path` must be present."
)
raise ValueError(msg)
return RetrievalQAWithSourcesChain(
combine_documents_chain=combine_documents_chain,
retriever=retriever,
**config,
)
Domain
Subdomains
Source
Frequently Asked Questions
What does _load_retrieval_qa_with_sources_chain() do?
_load_retrieval_qa_with_sources_chain() is a function in the langchain codebase, defined in libs/langchain/langchain_classic/chains/loading.py.
Where is _load_retrieval_qa_with_sources_chain() defined?
_load_retrieval_qa_with_sources_chain() is defined in libs/langchain/langchain_classic/chains/loading.py at line 492.
What does _load_retrieval_qa_with_sources_chain() call?
_load_retrieval_qa_with_sources_chain() calls 2 function(s): load_chain, load_chain_from_config.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free