test_serialization_with_pydantic() — langchain Function Reference
Architecture documentation for the test_serialization_with_pydantic() function in test_serializable.py from the langchain codebase.
Entity Profile
Dependency Diagram
graph TD 611db5b9_d6a5_e54e_54f5_62cc39aadfe9["test_serialization_with_pydantic()"] d90477e3_b806_4058_daf0_8495f08436d6["test_serializable.py"] 611db5b9_d6a5_e54e_54f5_62cc39aadfe9 -->|defined in| d90477e3_b806_4058_daf0_8495f08436d6 style 611db5b9_d6a5_e54e_54f5_62cc39aadfe9 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
libs/core/tests/unit_tests/load/test_serializable.py lines 229–244
def test_serialization_with_pydantic() -> None:
class MyModel(BaseModel):
x: int
y: str
my_model = MyModel(x=1, y="hello")
llm_response = ChatGeneration(
message=AIMessage(
content='{"x": 1, "y": "hello"}', additional_kwargs={"parsed": my_model}
)
)
ser = dumpd(llm_response)
deser = load(ser, allowed_objects=[ChatGeneration, AIMessage])
assert isinstance(deser, ChatGeneration)
assert deser.message.content
assert deser.message.additional_kwargs["parsed"] == my_model.model_dump()
Domain
Subdomains
Source
Frequently Asked Questions
What does test_serialization_with_pydantic() do?
test_serialization_with_pydantic() is a function in the langchain codebase, defined in libs/core/tests/unit_tests/load/test_serializable.py.
Where is test_serialization_with_pydantic() defined?
test_serialization_with_pydantic() is defined in libs/core/tests/unit_tests/load/test_serializable.py at line 229.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free