from_template_file() — langchain Function Reference
Architecture documentation for the from_template_file() function in chat.py from the langchain codebase.
Entity Profile
Dependency Diagram
graph TD 2d45b52a_4608_cd37_32ee_8262977a52f4["from_template_file()"] 894611e5_5039_7621_4673_821d0b9b6f17["_StringImageMessagePromptTemplate"] 2d45b52a_4608_cd37_32ee_8262977a52f4 -->|defined in| 894611e5_5039_7621_4673_821d0b9b6f17 99bde657_97b6_c8a5_899c_2b894c683f03["from_template_file()"] 99bde657_97b6_c8a5_899c_2b894c683f03 -->|calls| 2d45b52a_4608_cd37_32ee_8262977a52f4 99bde657_97b6_c8a5_899c_2b894c683f03["from_template_file()"] 2d45b52a_4608_cd37_32ee_8262977a52f4 -->|calls| 99bde657_97b6_c8a5_899c_2b894c683f03 6966af16_ade2_de3e_4f06_f97eca43d8e0["from_template()"] 2d45b52a_4608_cd37_32ee_8262977a52f4 -->|calls| 6966af16_ade2_de3e_4f06_f97eca43d8e0 style 2d45b52a_4608_cd37_32ee_8262977a52f4 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
libs/core/langchain_core/prompts/chat.py lines 532–549
def from_template_file(
cls: type[Self],
template_file: str | Path,
input_variables: list[str],
**kwargs: Any,
) -> Self:
"""Create a class from a template file.
Args:
template_file: path to a template file.
input_variables: list of input variables.
**kwargs: Keyword arguments to pass to the constructor.
Returns:
A new instance of this class.
"""
template = Path(template_file).read_text(encoding="utf-8")
return cls.from_template(template, input_variables=input_variables, **kwargs)
Domain
Subdomains
Defined In
Called By
Source
Frequently Asked Questions
What does from_template_file() do?
from_template_file() is a function in the langchain codebase, defined in libs/core/langchain_core/prompts/chat.py.
Where is from_template_file() defined?
from_template_file() is defined in libs/core/langchain_core/prompts/chat.py at line 532.
What does from_template_file() call?
from_template_file() calls 2 function(s): from_template, from_template_file.
What calls from_template_file()?
from_template_file() is called by 1 function(s): from_template_file.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free