Home / Function/ format_prompt() — langchain Function Reference

format_prompt() — langchain Function Reference

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

Entity Profile

Dependency Diagram

graph TD
  e9411289_e300_3889_9890_8b2d1e616969["format_prompt()"]
  93017235_36b7_3b85_820e_aa7d145183e5["BaseChatPromptTemplate"]
  e9411289_e300_3889_9890_8b2d1e616969 -->|defined in| 93017235_36b7_3b85_820e_aa7d145183e5
  08b4874f_15ee_e20e_22dd_dc40f35fb150["format()"]
  08b4874f_15ee_e20e_22dd_dc40f35fb150 -->|calls| e9411289_e300_3889_9890_8b2d1e616969
  9e40405f_9251_5a40_24a2_2959e7b39db7["format_messages()"]
  e9411289_e300_3889_9890_8b2d1e616969 -->|calls| 9e40405f_9251_5a40_24a2_2959e7b39db7
  a912d932_8157_994e_b37d_ed55e4821d34["format_messages()"]
  e9411289_e300_3889_9890_8b2d1e616969 -->|calls| a912d932_8157_994e_b37d_ed55e4821d34
  style e9411289_e300_3889_9890_8b2d1e616969 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

libs/core/langchain_core/prompts/chat.py lines 722–731

    def format_prompt(self, **kwargs: Any) -> ChatPromptValue:
        """Format prompt.

        Should return a `ChatPromptValue`.

        Args:
            **kwargs: Keyword arguments to use for formatting.
        """
        messages = self.format_messages(**kwargs)
        return ChatPromptValue(messages=messages)

Subdomains

Called By

Frequently Asked Questions

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

Analyze Your Own Codebase

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

Try Supermodel Free