Home / Function/ from_template_file() — langchain Function Reference

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
  99bde657_97b6_c8a5_899c_2b894c683f03["from_template_file()"]
  4766cfc7_f772_eccc_6561_2122efd2c5e8["BaseStringMessagePromptTemplate"]
  99bde657_97b6_c8a5_899c_2b894c683f03 -->|defined in| 4766cfc7_f772_eccc_6561_2122efd2c5e8
  2d45b52a_4608_cd37_32ee_8262977a52f4["from_template_file()"]
  2d45b52a_4608_cd37_32ee_8262977a52f4 -->|calls| 99bde657_97b6_c8a5_899c_2b894c683f03
  2d45b52a_4608_cd37_32ee_8262977a52f4["from_template_file()"]
  99bde657_97b6_c8a5_899c_2b894c683f03 -->|calls| 2d45b52a_4608_cd37_32ee_8262977a52f4
  style 99bde657_97b6_c8a5_899c_2b894c683f03 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

libs/core/langchain_core/prompts/chat.py lines 267–282

    def from_template_file(
        cls,
        template_file: str | Path,
        **kwargs: Any,
    ) -> Self:
        """Create a class from a template file.

        Args:
            template_file: path to a template file.
            **kwargs: Keyword arguments to pass to the constructor.

        Returns:
            A new instance of this class.
        """
        prompt = PromptTemplate.from_file(template_file)
        return cls(prompt=prompt, **kwargs)

Subdomains

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 267.
What does from_template_file() call?
from_template_file() calls 1 function(s): 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