Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Vertex AI] Add EncodableProtoEnum protocol and fix encoding #13862

Merged
merged 2 commits into from
Oct 9, 2024

Conversation

andrewheard
Copy link
Contributor

Added a protocol EncodableProtoEnum similar to DecodableProtoEnum (added in #13859) that provides a default Encodable implementation for Swift structs representing Protobuf enums. Before the default encoding produced invalid JSON for HarmCategory (refactored as a struct in #13854), e.g.:

"category": {
  "raw_value": "HARM_CATEGORY_DANGEROUS_CONTENT"
}

This PR resolves the nested object with a raw_value issue and produces:

"category":"HARM_CATEGORY_DANGEROUS_CONTENT"

The integration tests have been updated to make use of SafetySetting (including HarmCategory) to catch encoding issues.

#no-changelog

@andrewheard andrewheard added this to the 11.4.0 - M155 milestone Oct 9, 2024
@andrewheard andrewheard marked this pull request as ready for review October 9, 2024 21:00
@andrewheard andrewheard requested a review from paulb777 October 9, 2024 21:00
@andrewheard andrewheard merged commit 67502af into main Oct 9, 2024
38 checks passed
@andrewheard andrewheard deleted the ah/vertex-struct-enum-encoding branch October 9, 2024 21:12
MojtabaHs pushed a commit to MojtabaHs/firebase-ios-sdk that referenced this pull request Oct 17, 2024
@firebase firebase locked and limited conversation to collaborators Nov 9, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants