VertexAI has quietly changed the behavior of how the "final" event in a stream is represented. Previously, VertexAI would mark the stop reason on the same event as the final chunk of text or function call. Now VertexAI is sending a separate stop event with empty text, which was breaking our mechanism for handling tool calls.
This PR updates the tests and our event handling logic to account for this change in behavior.
VertexAI has quietly changed the behavior of how the "final" event in a stream is represented. Previously, VertexAI would mark the stop reason on the same event as the final chunk of text or function call. Now VertexAI is sending a separate stop event with empty text, which was breaking our mechanism for handling tool calls.
This PR updates the tests and our event handling logic to account for this change in behavior.