from_llm() — langchain Function Reference
Architecture documentation for the from_llm() function in re_phraser.py from the langchain codebase.
Entity Profile
Dependency Diagram
graph TD 10e6c3f2_093e_ad9e_d8a5_6f45854350b2["from_llm()"] 7d7b7f28_6346_74a0_c2d3_da5a2d751cf0["RePhraseQueryRetriever"] 10e6c3f2_093e_ad9e_d8a5_6f45854350b2 -->|defined in| 7d7b7f28_6346_74a0_c2d3_da5a2d751cf0 style 10e6c3f2_093e_ad9e_d8a5_6f45854350b2 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
libs/langchain/langchain_classic/retrievers/re_phraser.py lines 37–59
def from_llm(
cls,
retriever: BaseRetriever,
llm: BaseLLM,
prompt: BasePromptTemplate = DEFAULT_QUERY_PROMPT,
) -> "RePhraseQueryRetriever":
"""Initialize from llm using default template.
The prompt used here expects a single input: `question`
Args:
retriever: retriever to query documents from
llm: llm for query generation using DEFAULT_QUERY_PROMPT
prompt: prompt template for query generation
Returns:
RePhraseQueryRetriever
"""
llm_chain = prompt | llm | StrOutputParser()
return cls(
retriever=retriever,
llm_chain=llm_chain,
)
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/retrievers/re_phraser.py.
Where is from_llm() defined?
from_llm() is defined in libs/langchain/langchain_classic/retrievers/re_phraser.py at line 37.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free