_load_stuff_documents_chain() — langchain Function Reference
Architecture documentation for the _load_stuff_documents_chain() function in loading.py from the langchain codebase.
Entity Profile
Dependency Diagram
graph TD 5dd0e89e_45dc_955a_218d_9da7c99a8d3c["_load_stuff_documents_chain()"] 61dd5a0b_3bf7_b973_6dac_edfd465b21fb["loading.py"] 5dd0e89e_45dc_955a_218d_9da7c99a8d3c -->|defined in| 61dd5a0b_3bf7_b973_6dac_edfd465b21fb 7c915b91_f326_1908_9969_d0cb1f4f7e34["load_chain_from_config()"] 5dd0e89e_45dc_955a_218d_9da7c99a8d3c -->|calls| 7c915b91_f326_1908_9969_d0cb1f4f7e34 ab90e794_4e78_646b_dee9_e87a00250d94["load_chain()"] 5dd0e89e_45dc_955a_218d_9da7c99a8d3c -->|calls| ab90e794_4e78_646b_dee9_e87a00250d94 style 5dd0e89e_45dc_955a_218d_9da7c99a8d3c fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
libs/langchain/langchain_classic/chains/loading.py lines 118–145
def _load_stuff_documents_chain(config: dict, **kwargs: Any) -> StuffDocumentsChain:
if "llm_chain" in config:
llm_chain_config = config.pop("llm_chain")
llm_chain = load_chain_from_config(llm_chain_config, **kwargs)
elif "llm_chain_path" in config:
llm_chain = load_chain(config.pop("llm_chain_path"), **kwargs)
else:
msg = "One of `llm_chain` or `llm_chain_path` must be present."
raise ValueError(msg)
if not isinstance(llm_chain, LLMChain):
msg = f"Expected LLMChain, got {llm_chain}"
raise ValueError(msg) # noqa: TRY004
if "document_prompt" in config:
prompt_config = config.pop("document_prompt")
document_prompt = load_prompt_from_config(prompt_config)
elif "document_prompt_path" in config:
document_prompt = load_prompt(config.pop("document_prompt_path"))
else:
msg = "One of `document_prompt` or `document_prompt_path` must be present."
raise ValueError(msg)
return StuffDocumentsChain(
llm_chain=llm_chain,
document_prompt=document_prompt,
**config,
)
Domain
Subdomains
Source
Frequently Asked Questions
What does _load_stuff_documents_chain() do?
_load_stuff_documents_chain() is a function in the langchain codebase, defined in libs/langchain/langchain_classic/chains/loading.py.
Where is _load_stuff_documents_chain() defined?
_load_stuff_documents_chain() is defined in libs/langchain/langchain_classic/chains/loading.py at line 118.
What does _load_stuff_documents_chain() call?
_load_stuff_documents_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