Home / Function/ _load_qa_with_sources_chain() — langchain Function Reference

_load_qa_with_sources_chain() — langchain Function Reference

Architecture documentation for the _load_qa_with_sources_chain() function in loading.py from the langchain codebase.

Entity Profile

Dependency Diagram

graph TD
  8ec270d1_77b9_ff7f_a41f_9f62d33c391b["_load_qa_with_sources_chain()"]
  61dd5a0b_3bf7_b973_6dac_edfd465b21fb["loading.py"]
  8ec270d1_77b9_ff7f_a41f_9f62d33c391b -->|defined in| 61dd5a0b_3bf7_b973_6dac_edfd465b21fb
  7c915b91_f326_1908_9969_d0cb1f4f7e34["load_chain_from_config()"]
  8ec270d1_77b9_ff7f_a41f_9f62d33c391b -->|calls| 7c915b91_f326_1908_9969_d0cb1f4f7e34
  ab90e794_4e78_646b_dee9_e87a00250d94["load_chain()"]
  8ec270d1_77b9_ff7f_a41f_9f62d33c391b -->|calls| ab90e794_4e78_646b_dee9_e87a00250d94
  style 8ec270d1_77b9_ff7f_a41f_9f62d33c391b fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

libs/langchain/langchain_classic/chains/loading.py lines 395–413

def _load_qa_with_sources_chain(config: dict, **kwargs: Any) -> QAWithSourcesChain:
    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 QAWithSourcesChain(combine_documents_chain=combine_documents_chain, **config)

Subdomains

Frequently Asked Questions

What does _load_qa_with_sources_chain() do?
_load_qa_with_sources_chain() is a function in the langchain codebase, defined in libs/langchain/langchain_classic/chains/loading.py.
Where is _load_qa_with_sources_chain() defined?
_load_qa_with_sources_chain() is defined in libs/langchain/langchain_classic/chains/loading.py at line 395.
What does _load_qa_with_sources_chain() call?
_load_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