-
Notifications
You must be signed in to change notification settings - Fork 350
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: GenAI - Fixed from_dict methods
The parsing of dictionaries was standardized and improved. Parsing dictionaries via `json_formt.ParseDict` allows automatically handling renamed fields like `type_`, `format_`, `enum_` and also camelCase keys like `minItems` that are often used in Json Schema schemas. The `json_formt.ParseDict` method succeeds in such cases while the Proto Message constructors fail. However there is an issue with enums which makes full migration to `json_schema.ParseDict` non-trivial. Protobuf's ParseDict treats enum names as case sensitive. This is mostly problematic for Shema messages where Python protos use uppercase enum names like `"OBJECT"` while Json Schemas usually use lowercase types like `"object"`. I've created a fix for the protobuf library, but it will take a while before it's released everywhere. So, enums need to be fixed. But such enums can happen in multiple places in a deeply nested dictionary structure. We need to carefully fix all enum casing issues in nested dicts before we can use `ParseDict`. PiperOrigin-RevId: 680480143
- Loading branch information
1 parent
29dec74
commit 3090812
Showing
1 changed file
with
56 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters