Home / Function/ from_llm() — langchain Function Reference

from_llm() — langchain Function Reference

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

Entity Profile

Dependency Diagram

graph TD
  e7c33adb_98e6_26c5_4783_69ac0fffe3d6["from_llm()"]
  056612cb_8291_0c46_ab1b_ac10284862d6["RetryOutputParser"]
  e7c33adb_98e6_26c5_4783_69ac0fffe3d6 -->|defined in| 056612cb_8291_0c46_ab1b_ac10284862d6
  ab2db9cb_d383_bd44_2851_8e949fd4a85d["from_llm()"]
  ab2db9cb_d383_bd44_2851_8e949fd4a85d -->|calls| e7c33adb_98e6_26c5_4783_69ac0fffe3d6
  ab2db9cb_d383_bd44_2851_8e949fd4a85d["from_llm()"]
  e7c33adb_98e6_26c5_4783_69ac0fffe3d6 -->|calls| ab2db9cb_d383_bd44_2851_8e949fd4a85d
  style e7c33adb_98e6_26c5_4783_69ac0fffe3d6 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

libs/langchain/langchain_classic/output_parsers/retry.py lines 76–95

    def from_llm(
        cls,
        llm: BaseLanguageModel,
        parser: BaseOutputParser[T],
        prompt: BasePromptTemplate = NAIVE_RETRY_PROMPT,
        max_retries: int = 1,
    ) -> RetryOutputParser[T]:
        """Create an RetryOutputParser from a language model and a parser.

        Args:
            llm: llm to use for fixing
            parser: parser to use for parsing
            prompt: prompt to use for fixing
            max_retries: Maximum number of retries to parse.

        Returns:
            RetryOutputParser
        """
        chain = prompt | llm | StrOutputParser()
        return cls(parser=parser, retry_chain=chain, max_retries=max_retries)

Domain

Subdomains

Calls

Called By

Frequently Asked Questions

What does from_llm() do?
from_llm() is a function in the langchain codebase, defined in libs/langchain/langchain_classic/output_parsers/retry.py.
Where is from_llm() defined?
from_llm() is defined in libs/langchain/langchain_classic/output_parsers/retry.py at line 76.
What does from_llm() call?
from_llm() calls 1 function(s): from_llm.
What calls from_llm()?
from_llm() is called by 1 function(s): from_llm.

Analyze Your Own Codebase

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

Try Supermodel Free