from_llm() — langchain Function Reference
Architecture documentation for the from_llm() function in fix.py from the langchain codebase.
Entity Profile
Dependency Diagram
graph TD e8b37f13_4875_2483_ef9c_4da2cb52d654["from_llm()"] bb726abf_6b12_450e_860e_6efc5f620f19["OutputFixingParser"] e8b37f13_4875_2483_ef9c_4da2cb52d654 -->|defined in| bb726abf_6b12_450e_860e_6efc5f620f19 style e8b37f13_4875_2483_ef9c_4da2cb52d654 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
libs/langchain/langchain_classic/output_parsers/fix.py lines 48–67
def from_llm(
cls,
llm: Runnable,
parser: BaseOutputParser[T],
prompt: BasePromptTemplate = NAIVE_FIX_PROMPT,
max_retries: int = 1,
) -> OutputFixingParser[T]:
"""Create an OutputFixingParser 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:
OutputFixingParser
"""
chain = prompt | llm | StrOutputParser()
return cls(parser=parser, retry_chain=chain, max_retries=max_retries)
Domain
Subdomains
Source
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/fix.py.
Where is from_llm() defined?
from_llm() is defined in libs/langchain/langchain_classic/output_parsers/fix.py at line 48.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free