Home / Function/ from_llm() — langchain Function Reference

from_llm() — langchain Function Reference

Architecture documentation for the from_llm() function in base.py from the langchain codebase.

Entity Profile

Dependency Diagram

graph TD
  1e0bb2d4_7826_f84f_e437_901c40aeb242["from_llm()"]
  94675137_e239_b0ed_4295_d86f72dadd0c["LLMSummarizationCheckerChain"]
  1e0bb2d4_7826_f84f_e437_901c40aeb242 -->|defined in| 94675137_e239_b0ed_4295_d86f72dadd0c
  ce6eb2d1_3558_fbd2_b7a1_915b6d227e95["_load_sequential_chain()"]
  1e0bb2d4_7826_f84f_e437_901c40aeb242 -->|calls| ce6eb2d1_3558_fbd2_b7a1_915b6d227e95
  style 1e0bb2d4_7826_f84f_e437_901c40aeb242 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

libs/langchain/langchain_classic/chains/llm_summarization_checker/base.py lines 184–213

    def from_llm(
        cls,
        llm: BaseLanguageModel,
        create_assertions_prompt: PromptTemplate = CREATE_ASSERTIONS_PROMPT,
        check_assertions_prompt: PromptTemplate = CHECK_ASSERTIONS_PROMPT,
        revised_summary_prompt: PromptTemplate = REVISED_SUMMARY_PROMPT,
        are_all_true_prompt: PromptTemplate = ARE_ALL_TRUE_PROMPT,
        verbose: bool = False,  # noqa: FBT001,FBT002
        **kwargs: Any,
    ) -> LLMSummarizationCheckerChain:
        """Create a LLMSummarizationCheckerChain from a language model.

        Args:
            llm: a language model
            create_assertions_prompt: prompt to create assertions
            check_assertions_prompt: prompt to check assertions
            revised_summary_prompt: prompt to revise summary
            are_all_true_prompt: prompt to check if all assertions are true
            verbose: whether to print verbose output
            **kwargs: additional arguments
        """
        chain = _load_sequential_chain(
            llm,
            create_assertions_prompt,
            check_assertions_prompt,
            revised_summary_prompt,
            are_all_true_prompt,
            verbose=verbose,
        )
        return cls(sequential_chain=chain, verbose=verbose, **kwargs)

Subdomains

Frequently Asked Questions

What does from_llm() do?
from_llm() is a function in the langchain codebase, defined in libs/langchain/langchain_classic/chains/llm_summarization_checker/base.py.
Where is from_llm() defined?
from_llm() is defined in libs/langchain/langchain_classic/chains/llm_summarization_checker/base.py at line 184.
What does from_llm() call?
from_llm() calls 1 function(s): _load_sequential_chain.

Analyze Your Own Codebase

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

Try Supermodel Free