Home / Function/ _load_stuff_chain() — langchain Function Reference

_load_stuff_chain() — langchain Function Reference

Architecture documentation for the _load_stuff_chain() function in chain.py from the langchain codebase.

Entity Profile

Dependency Diagram

graph TD
  7f76bcd4_dceb_54b9_1fbc_c5872389636c["_load_stuff_chain()"]
  efa3839a_04cc_4e5d_7ba0_06993a200d6c["chain.py"]
  7f76bcd4_dceb_54b9_1fbc_c5872389636c -->|defined in| efa3839a_04cc_4e5d_7ba0_06993a200d6c
  style 7f76bcd4_dceb_54b9_1fbc_c5872389636c fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

libs/langchain/langchain_classic/chains/summarize/chain.py lines 36–65

def _load_stuff_chain(
    llm: BaseLanguageModel,
    *,
    prompt: BasePromptTemplate = stuff_prompt.PROMPT,
    document_variable_name: str = "text",
    verbose: bool | None = None,
    **kwargs: Any,
) -> StuffDocumentsChain:
    llm_chain = LLMChain(llm=llm, prompt=prompt, verbose=verbose)
    """Load a StuffDocumentsChain for summarization.

    Args:
        llm: Language Model to use in the chain.
        prompt: Prompt template that controls how the documents are formatted and
            passed into the LLM.
        document_variable_name: Variable name in the prompt template where the
            document text will be inserted.
        verbose: Whether to log progress and intermediate steps.
        **kwargs: Additional keyword arguments passed to the StuffDocumentsChain.

    Returns:
        A StuffDocumentsChain that takes in documents, formats them with the
        given prompt, and runs the chain on the provided LLM.
    """
    return StuffDocumentsChain(
        llm_chain=llm_chain,
        document_variable_name=document_variable_name,
        verbose=verbose,
        **kwargs,
    )

Subdomains

Frequently Asked Questions

What does _load_stuff_chain() do?
_load_stuff_chain() is a function in the langchain codebase, defined in libs/langchain/langchain_classic/chains/summarize/chain.py.
Where is _load_stuff_chain() defined?
_load_stuff_chain() is defined in libs/langchain/langchain_classic/chains/summarize/chain.py at line 36.

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free