test_serdes_message() — langchain Function Reference
Architecture documentation for the test_serdes_message() function in test_ai.py from the langchain codebase.
Entity Profile
Dependency Diagram
graph TD f3c6a3b7_2000_39f4_f0df_9ca399d3a45e["test_serdes_message()"] f148f3ce_73bd_627d_a979_33d23ebac843["test_ai.py"] f3c6a3b7_2000_39f4_f0df_9ca399d3a45e -->|defined in| f148f3ce_73bd_627d_a979_33d23ebac843 style f3c6a3b7_2000_39f4_f0df_9ca399d3a45e fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
libs/core/tests/unit_tests/messages/test_ai.py lines 19–50
def test_serdes_message() -> None:
msg = AIMessage(
content=[{"text": "blah", "type": "text"}],
tool_calls=[create_tool_call(name="foo", args={"bar": 1}, id="baz")],
invalid_tool_calls=[
create_invalid_tool_call(name="foobad", args="blah", id="booz", error="bad")
],
)
expected = {
"lc": 1,
"type": "constructor",
"id": ["langchain", "schema", "messages", "AIMessage"],
"kwargs": {
"type": "ai",
"content": [{"text": "blah", "type": "text"}],
"tool_calls": [
{"name": "foo", "args": {"bar": 1}, "id": "baz", "type": "tool_call"}
],
"invalid_tool_calls": [
{
"name": "foobad",
"args": "blah",
"id": "booz",
"error": "bad",
"type": "invalid_tool_call",
}
],
},
}
actual = dumpd(msg)
assert actual == expected
assert load(actual, allowed_objects=[AIMessage]) == msg
Domain
Subdomains
Source
Frequently Asked Questions
What does test_serdes_message() do?
test_serdes_message() is a function in the langchain codebase, defined in libs/core/tests/unit_tests/messages/test_ai.py.
Where is test_serdes_message() defined?
test_serdes_message() is defined in libs/core/tests/unit_tests/messages/test_ai.py at line 19.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free