fix: preserve Vertex AI function call IDs#762
Conversation
There was a problem hiding this comment.
Code Review
This pull request updates the aiplatformToGenaiContent function in the Vertex AI client to ensure that function call and response IDs are correctly mapped and preserved during conversion. Additionally, a new test case has been added to verify this behavior. I have no feedback to provide.
|
@mazas-google tagging you here |
a016f52 to
66ab48d
Compare
Hi @indurireddy-TF , we're keeping all our fixes rebased on the latest release of adk-go (e.g. fork branch here). We're not keeping them rebased on every latest main commit. We can rebase individual PRs if that brings them closer to be resolved. Is this one ready to be reviewed for merging now? |
yes |
Keep function call and response IDs when deserializing Vertex AI session events so tool history can be matched across invocations.
66ab48d to
b34ea50
Compare
|
@indurireddy-TF rebased 👍 |
foxfrikses
left a comment
There was a problem hiding this comment.
Thank you for the fix!
Link to Issue or Description of Change
Problem
aiplatformToGenaiContentwrites Vertex AI session events back intogenai.Content, but currently dropsFunctionCall.IdandFunctionResponse.Idduring deserialization.The write path in
createAiplatformpbContentalready stores those IDs, so this creates an asymmetric round trip: function call and response IDs are persisted to Vertex AI sessions, then lost when the session history is read back. Without IDs, later history processing can no longer reliably match tool calls and responses across invocations.Solution
Set
genai.FunctionCall.IDfromaiplatformpb.FunctionCall.Idandgenai.FunctionResponse.IDfromaiplatformpb.FunctionResponse.Idwhen converting Vertex AI session events back to genai content.Testing Plan
TestAiplatformToGenaiContentPreservesFunctionIDsverifying IDs are preserved when deserializing Vertex AI session events.go test ./session/vertexaiAlignment with adk-python
This preserves the same tool-call / tool-response pairing invariant expected across ADK implementations: persisted session history must retain function IDs so later turns can associate responses with their calls.