pretty_repr() — langchain Function Reference
Architecture documentation for the pretty_repr() function in base.py from the langchain codebase.
Entity Profile
Dependency Diagram
graph TD 51c7ee24_c973_598e_e55c_4fe0f69bb436["pretty_repr()"] b9553aad_b797_0a7b_73ed_8d05b0819c0f["BaseMessage"] 51c7ee24_c973_598e_e55c_4fe0f69bb436 -->|defined in| b9553aad_b797_0a7b_73ed_8d05b0819c0f bf7f8a8e_78bd_d925_2eb9_e4d07f210261["pretty_print()"] bf7f8a8e_78bd_d925_2eb9_e4d07f210261 -->|calls| 51c7ee24_c973_598e_e55c_4fe0f69bb436 d6edd358_dc45_0fdd_1521_f16f09f6e3a3["get_msg_title_repr()"] 51c7ee24_c973_598e_e55c_4fe0f69bb436 -->|calls| d6edd358_dc45_0fdd_1521_f16f09f6e3a3 style 51c7ee24_c973_598e_e55c_4fe0f69bb436 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
libs/core/langchain_core/messages/base.py lines 309–342
def pretty_repr(
self,
html: bool = False, # noqa: FBT001,FBT002
) -> str:
"""Get a pretty representation of the message.
Args:
html: Whether to format the message as HTML. If `True`, the message will be
formatted with HTML tags.
Returns:
A pretty representation of the message.
Example:
```python
from langchain_core.messages import HumanMessage
msg = HumanMessage(content="What is the capital of France?")
print(msg.pretty_repr())
```
Results in:
```txt
================================ Human Message =================================
What is the capital of France?
```
""" # noqa: E501
title = get_msg_title_repr(self.type.title() + " Message", bold=html)
# TODO: handle non-string content.
if self.name is not None:
title += f"\nName: {self.name}"
return f"{title}\n\n{self.content}"
Domain
Subdomains
Defined In
Calls
Called By
Source
Frequently Asked Questions
What does pretty_repr() do?
pretty_repr() is a function in the langchain codebase, defined in libs/core/langchain_core/messages/base.py.
Where is pretty_repr() defined?
pretty_repr() is defined in libs/core/langchain_core/messages/base.py at line 309.
What does pretty_repr() call?
pretty_repr() calls 1 function(s): get_msg_title_repr.
What calls pretty_repr()?
pretty_repr() is called by 1 function(s): pretty_print.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free