Home / Function/ format() — langchain Function Reference

format() — langchain Function Reference

Architecture documentation for the format() function in chat.py from the langchain codebase.

Entity Profile

Dependency Diagram

graph TD
  c5487c6c_d88c_b7f9_8f1f_8abaf332a76d["format()"]
  4766cfc7_f772_eccc_6561_2122efd2c5e8["BaseStringMessagePromptTemplate"]
  c5487c6c_d88c_b7f9_8f1f_8abaf332a76d -->|defined in| 4766cfc7_f772_eccc_6561_2122efd2c5e8
  3916fd95_3f4c_3139_05ee_a34850487826["aformat()"]
  3916fd95_3f4c_3139_05ee_a34850487826 -->|calls| c5487c6c_d88c_b7f9_8f1f_8abaf332a76d
  3614db71_8c6d_b963_aa95_00d88d57c918["format_messages()"]
  3614db71_8c6d_b963_aa95_00d88d57c918 -->|calls| c5487c6c_d88c_b7f9_8f1f_8abaf332a76d
  294ab761_8d23_d66d_6743_cc31d8ac0289["format_messages()"]
  294ab761_8d23_d66d_6743_cc31d8ac0289 -->|calls| c5487c6c_d88c_b7f9_8f1f_8abaf332a76d
  12501cb5_f260_9904_b738_b5abce848eb3["aformat()"]
  12501cb5_f260_9904_b738_b5abce848eb3 -->|calls| c5487c6c_d88c_b7f9_8f1f_8abaf332a76d
  da277d85_ccb4_d225_0110_0e1adda5fb46["format()"]
  c5487c6c_d88c_b7f9_8f1f_8abaf332a76d -->|calls| da277d85_ccb4_d225_0110_0e1adda5fb46
  style c5487c6c_d88c_b7f9_8f1f_8abaf332a76d fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

libs/core/langchain_core/prompts/chat.py lines 285–293

    def format(self, **kwargs: Any) -> BaseMessage:
        """Format the prompt template.

        Args:
            **kwargs: Keyword arguments to use for formatting.

        Returns:
            Formatted message.
        """

Subdomains

Calls

Frequently Asked Questions

What does format() do?
format() is a function in the langchain codebase, defined in libs/core/langchain_core/prompts/chat.py.
Where is format() defined?
format() is defined in libs/core/langchain_core/prompts/chat.py at line 285.
What does format() call?
format() calls 1 function(s): format.
What calls format()?
format() is called by 4 function(s): aformat, aformat, format_messages, format_messages.

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free