feat: add proto-plus message serialization support in EventSerializer…#485
Merged
Focadecombate merged 7 commits intomainfrom Feb 25, 2026
Merged
Conversation
Render proto enum fields as readable strings (e.g. "OBJECT", "STRING") instead of opaque integers when serializing proto-plus messages.
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #485 +/- ##
==========================================
- Coverage 81.85% 81.78% -0.07%
==========================================
Files 96 96
Lines 9164 9197 +33
==========================================
+ Hits 7501 7522 +21
- Misses 1663 1675 +12 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
…ents Address PR review feedback: - Wrap proto.Message.to_dict result with self.default() to ensure nested values are recursively processed like all other serialization branches - Clarify Sequence comment to distinguish bare protobuf from proto-plus - Fix misleading test docstring for empty message serialization
…r fallback behavior
savula15
approved these changes
Feb 24, 2026
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
User description
Shortcut: sc-55119
Description:
The
GalileoCallback(and other handlers usingEventSerializer) would produce empty objects{}when serializing proto-plus messages (e.g.google.cloud.aiplatformtypes). This happens because proto-plus
Messageobjects store their data internally via protobuf descriptors rather than in__dict__, so the generic__dict__fallbackin
EventSerializerwould find nothing to serialize.This PR adds explicit handling for
proto.Messageinstances inEventSerializer, usingproto.Message.to_dict()to correctly convert them to plain dictionaries before JSONencoding. The
protodependency check is lazy to avoid impacting users who don't use Google Cloud AI Platform or other proto-plus libraries.Changes:
is_proto_plus_availabledependency check independencies.pyproto.Messageserialization branch inEventSerializer.default(), placed before the__slots__fallbackAfter change

Tests:
Generated description
Below is a concise technical summary of the changes proposed in this PR:
Enhances the
GalileoCallbackto correctly capture tool calls and token metrics when usingChatVertexAIby adding support forproto-plusmessage serialization. Updates theEventSerializerand LangChain handlers to handle GCP-specific metadata and ensure proper status code reporting for various node types.proto.Messageserialization inEventSerializerto prevent empty objects when processing Google Cloud AI Platform types.Modified files (3)
Latest Contributors(2)
parse_llm_resultto support GCP-style token keys (input_tokens/output_tokens) and addsstatus_codetracking to LangChain callback handlers.Modified files (4)
Latest Contributors(2)