mirror of
https://github.com/hwchase17/langchain.git
synced 2025-10-22 09:41:52 +00:00
Release notes: https://pydantic.dev/articles/pydantic-v2-11-release Covered here: - We no longer access `model_fields` on class instances (that is now deprecated); - Update schema normalization for Pydantic version testing to reflect changes to generated JSON schema (addition of `"additionalProperties": True` for dict types with value Any or object). ## Considerations: ### Changes to JSON schema generation #### Tool-calling / structured outputs This may impact tool-calling + structured outputs for some providers, but schema generation only changes if you have parameters of the form `dict`, `dict[str, Any]`, `dict[str, object]`, etc. If dict parameters are typed my understanding is there are no changes. For OpenAI for example, untyped dicts work for structured outputs with default settings before and after updating Pydantic, and error both before/after if `strict=True`. ### Use of `model_fields` There is one spot where we previously accessed `super(cls, self).model_fields`, where `cls` is an object in the MRO. This was done for the purpose of tracking aliases in secrets. I've updated this to always be `type(self).model_fields`-- see comment in-line for detail. --------- Co-authored-by: Sydney Runkle <54324534+sydney-runkle@users.noreply.github.com>