message_to_dict() — langchain Function Reference
Architecture documentation for the message_to_dict() function in base.py from the langchain codebase.
Entity Profile
Dependency Diagram
graph TD 0a4816ad_d229_8c44_a0a4_7f04f3b64f51["message_to_dict()"] 323271a6_dbeb_1ac5_e224_a66bfb56191b["base.py"] 0a4816ad_d229_8c44_a0a4_7f04f3b64f51 -->|defined in| 323271a6_dbeb_1ac5_e224_a66bfb56191b a6235c5e_ac8b_8d3c_3513_3666e61e22db["messages_to_dict()"] a6235c5e_ac8b_8d3c_3513_3666e61e22db -->|calls| 0a4816ad_d229_8c44_a0a4_7f04f3b64f51 style 0a4816ad_d229_8c44_a0a4_7f04f3b64f51 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
libs/core/langchain_core/messages/base.py lines 474–485
def message_to_dict(message: BaseMessage) -> dict:
"""Convert a Message to a dictionary.
Args:
message: Message to convert.
Returns:
Message as a dict. The dict will have a `type` key with the message type
and a `data` key with the message data as a dict.
"""
return {"type": message.type, "data": message.model_dump()}
Domain
Subdomains
Defined In
Called By
Source
Frequently Asked Questions
What does message_to_dict() do?
message_to_dict() is a function in the langchain codebase, defined in libs/core/langchain_core/messages/base.py.
Where is message_to_dict() defined?
message_to_dict() is defined in libs/core/langchain_core/messages/base.py at line 474.
What calls message_to_dict()?
message_to_dict() is called by 1 function(s): messages_to_dict.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free