from_llm() — langchain Function Reference
Architecture documentation for the from_llm() function in eval_chain.py from the langchain codebase.
Entity Profile
Dependency Diagram
graph TD 909f249d_6333_28c0_ed05_2bfa8676c170["from_llm()"] 6b783916_2e41_8d2a_dba2_81813096b7c4["ContextQAEvalChain"] 909f249d_6333_28c0_ed05_2bfa8676c170 -->|defined in| 6b783916_2e41_8d2a_dba2_81813096b7c4 a3155b02_dbf2_ea43_042a_2d3c1404bdeb["from_llm()"] a3155b02_dbf2_ea43_042a_2d3c1404bdeb -->|calls| 909f249d_6333_28c0_ed05_2bfa8676c170 5e40a8d3_ac36_a29a_8969_75ee97f0c328["_validate_input_vars()"] 909f249d_6333_28c0_ed05_2bfa8676c170 -->|calls| 5e40a8d3_ac36_a29a_8969_75ee97f0c328 a3155b02_dbf2_ea43_042a_2d3c1404bdeb["from_llm()"] 909f249d_6333_28c0_ed05_2bfa8676c170 -->|calls| a3155b02_dbf2_ea43_042a_2d3c1404bdeb style 909f249d_6333_28c0_ed05_2bfa8676c170 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
libs/langchain/langchain_classic/evaluation/qa/eval_chain.py lines 257–279
def from_llm(
cls,
llm: BaseLanguageModel,
prompt: PromptTemplate | None = None,
**kwargs: Any,
) -> ContextQAEvalChain:
"""Load QA Eval Chain from LLM.
Args:
llm: The base language model to use.
prompt: A prompt template containing the `input_variables`:
`'query'`, `'context'` and `'result'` that will be used as the prompt
for evaluation.
Defaults to `PROMPT`.
**kwargs: Additional keyword arguments.
Returns:
The loaded QA eval chain.
"""
prompt = prompt or CONTEXT_PROMPT
cls._validate_input_vars(prompt)
return cls(llm=llm, prompt=prompt, **kwargs)
Domain
Subdomains
Called By
Source
Frequently Asked Questions
What does from_llm() do?
from_llm() is a function in the langchain codebase, defined in libs/langchain/langchain_classic/evaluation/qa/eval_chain.py.
Where is from_llm() defined?
from_llm() is defined in libs/langchain/langchain_classic/evaluation/qa/eval_chain.py at line 257.
What does from_llm() call?
from_llm() calls 2 function(s): _validate_input_vars, 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