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
  62540c68_956e_907e_7735_12e71501527a["from_llm()"]
  5aa56bcf_82c4_0170_f600_dbc266dbf61b["LLMCheckerChain"]
  62540c68_956e_907e_7735_12e71501527a -->|defined in| 5aa56bcf_82c4_0170_f600_dbc266dbf61b
  98907bf7_2811_e9e1_0faa_d8951a890e3a["_load_question_to_checked_assertions_chain()"]
  62540c68_956e_907e_7735_12e71501527a -->|calls| 98907bf7_2811_e9e1_0faa_d8951a890e3a
  style 62540c68_956e_907e_7735_12e71501527a fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

libs/langchain/langchain_classic/chains/llm_checker/base.py lines 168–199

    def from_llm(
        cls,
        llm: BaseLanguageModel,
        create_draft_answer_prompt: PromptTemplate = CREATE_DRAFT_ANSWER_PROMPT,
        list_assertions_prompt: PromptTemplate = LIST_ASSERTIONS_PROMPT,
        check_assertions_prompt: PromptTemplate = CHECK_ASSERTIONS_PROMPT,
        revised_answer_prompt: PromptTemplate = REVISED_ANSWER_PROMPT,
        **kwargs: Any,
    ) -> LLMCheckerChain:
        """Create an LLMCheckerChain from a language model.

        Args:
            llm: a language model
            create_draft_answer_prompt: prompt to create a draft answer
            list_assertions_prompt: prompt to list assertions
            check_assertions_prompt: prompt to check assertions
            revised_answer_prompt: prompt to revise the answer
            **kwargs: additional arguments
        """
        question_to_checked_assertions_chain = (
            _load_question_to_checked_assertions_chain(
                llm,
                create_draft_answer_prompt,
                list_assertions_prompt,
                check_assertions_prompt,
                revised_answer_prompt,
            )
        )
        return cls(
            question_to_checked_assertions_chain=question_to_checked_assertions_chain,
            **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_checker/base.py.
Where is from_llm() defined?
from_llm() is defined in libs/langchain/langchain_classic/chains/llm_checker/base.py at line 168.
What does from_llm() call?
from_llm() calls 1 function(s): _load_question_to_checked_assertions_chain.

Analyze Your Own Codebase

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

Try Supermodel Free