format() — langchain Function Reference
Architecture documentation for the format() function in chat.py from the langchain codebase.
Entity Profile
Dependency Diagram
graph TD da277d85_ccb4_d225_0110_0e1adda5fb46["format()"] 845a4803_caec_c00a_d98b_d3f3d3fae5d8["ChatMessagePromptTemplate"] da277d85_ccb4_d225_0110_0e1adda5fb46 -->|defined in| 845a4803_caec_c00a_d98b_d3f3d3fae5d8 c5487c6c_d88c_b7f9_8f1f_8abaf332a76d["format()"] c5487c6c_d88c_b7f9_8f1f_8abaf332a76d -->|calls| da277d85_ccb4_d225_0110_0e1adda5fb46 4d5e2501_6d84_a2a3_49d1_fa84af2fe2d1["format()"] 4d5e2501_6d84_a2a3_49d1_fa84af2fe2d1 -->|calls| da277d85_ccb4_d225_0110_0e1adda5fb46 4d5e2501_6d84_a2a3_49d1_fa84af2fe2d1["format()"] da277d85_ccb4_d225_0110_0e1adda5fb46 -->|calls| 4d5e2501_6d84_a2a3_49d1_fa84af2fe2d1 style da277d85_ccb4_d225_0110_0e1adda5fb46 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
libs/core/langchain_core/prompts/chat.py lines 359–371
def format(self, **kwargs: Any) -> BaseMessage:
"""Format the prompt template.
Args:
**kwargs: Keyword arguments to use for formatting.
Returns:
Formatted message.
"""
text = self.prompt.format(**kwargs)
return ChatMessage(
content=text, role=self.role, additional_kwargs=self.additional_kwargs
)
Domain
Subdomains
Defined In
Calls
Source
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 359.
What does format() call?
format() calls 1 function(s): format.
What calls format()?
format() is called by 2 function(s): format, format.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free