You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Bedrock/Gemini/Vertex: drop empty messages before merging (an errored assistant turn sends content: []) #369
Bedrock, Gemini and Vertex send a message with no content (content: [] / parts: []) in two cases. Both APIs reject an empty message:
an assistant turn that errored and left no content (or, on Gemini, only thinking, which is not replayed);
a user message whose only text is empty.
The Anthropic builder skips such an assistant turn (anthropic.rs ~546-553). The other three could not do the same, because dropping it would have put two user messages side by side.
#368 (for #223) merges consecutive same-role messages in those builders, so now they can drop empty messages before merging, and the user messages around a dropped turn merge into one.
Fix: in build_bedrock_body, google::build_request_body and google_vertex::build_vertex_request_body, filter out messages whose content / parts array is empty, then call merge_same_role. Add a test with an errored, content-less assistant turn between two user turns.
Found by the review of #368. This existed before that PR; the PR does not create it.
Activity
test+docs: #369 review round — the loop's real error shape, end to end