load_summarize_chain() — langchain Function Reference
Architecture documentation for the load_summarize_chain() function in chain.py from the langchain codebase.
Entity Profile
Dependency Diagram
graph TD ea9deb82_bc8c_c2c2_6378_e4bb5f322450["load_summarize_chain()"] efa3839a_04cc_4e5d_7ba0_06993a200d6c["chain.py"] ea9deb82_bc8c_c2c2_6378_e4bb5f322450 -->|defined in| efa3839a_04cc_4e5d_7ba0_06993a200d6c style ea9deb82_bc8c_c2c2_6378_e4bb5f322450 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
libs/langchain/langchain_classic/chains/summarize/chain.py lines 196–226
def load_summarize_chain(
llm: BaseLanguageModel,
chain_type: str = "stuff",
verbose: bool | None = None, # noqa: FBT001
**kwargs: Any,
) -> BaseCombineDocumentsChain:
"""Load summarizing chain.
Args:
llm: Language Model to use in the chain.
chain_type: Type of document combining chain to use. Should be one of "stuff",
"map_reduce", and "refine".
verbose: Whether chains should be run in verbose mode or not. Note that this
applies to all chains that make up the final chain.
**kwargs: Additional keyword arguments.
Returns:
A chain to use for summarizing.
"""
loader_mapping: Mapping[str, LoadingCallable] = {
"stuff": _load_stuff_chain,
"map_reduce": _load_map_reduce_chain,
"refine": _load_refine_chain,
}
if chain_type not in loader_mapping:
msg = (
f"Got unsupported chain type: {chain_type}. "
f"Should be one of {loader_mapping.keys()}"
)
raise ValueError(msg)
return loader_mapping[chain_type](llm, verbose=verbose, **kwargs)
Domain
Subdomains
Source
Frequently Asked Questions
What does load_summarize_chain() do?
load_summarize_chain() is a function in the langchain codebase, defined in libs/langchain/langchain_classic/chains/summarize/chain.py.
Where is load_summarize_chain() defined?
load_summarize_chain() is defined in libs/langchain/langchain_classic/chains/summarize/chain.py at line 196.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free