Skip to content

Conversation

SylphiaWindy
Copy link

  • fix(checkpoint): generic type args should be serialized for de-serialization

  • PR message*:

    • Description: when jsonplus serialize a pydantic v2 object, it simply writes type name of the object and module of the type to graph. In most cases, if the object is created from a specialized generic pydantic model, the deserialization will fail and a fallback dict object returned. The original code will try to import class GenericModel[AnotherModel] from the module, this only work if the specialized type is defined at top level of a module, I assume it is pydantic's behaviour to add identifier GenericModel[AnotherModel] to module after calling a generic pydantic model's __class_getitem__ method.

The fix code will write all generic type arguments into graph and then create these types on de-serialization.
It is compatible with data serialized by the original code and maintains the same behavior as the original code (returning a dict). closing #6102.

Copy link

vercel bot commented Sep 8, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

1 Skipped Deployment
Project Deployment Preview Comments Updated (UTC)
langgraph-docs-preview Ignored Ignored Preview Sep 8, 2025 10:57am

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant