Skip to content

fix(streaming): check request body for beta flags during accumulation#1140

Open
Ashutosh0x wants to merge 4 commits intoanthropics:mainfrom
Ashutosh0x:fix/vertex-streaming-accumulation
Open

fix(streaming): check request body for beta flags during accumulation#1140
Ashutosh0x wants to merge 4 commits intoanthropics:mainfrom
Ashutosh0x:fix/vertex-streaming-accumulation

Conversation

@Ashutosh0x
Copy link

Vertex/Bedrock clients map beta headers to the request body. This PR updates the streaming accumulation logic to check the request body for flags like \ ine-grained-tool-streaming-2025-05-14\ when headers are missing. Fixes #1020

Including the 'caller' field in 'tool_use' blocks within input
messages causes API errors (especially for computer-use) because
the API expects only standard fields like id, name, type, and input.

This field was recently added to the SDK models and parameters but
should not be sent back to the API.

This PR:
1. Removes 'caller' from BetaToolUseBlockParam and
   BetaServerToolUseBlockParam.
2. Adds __api_exclude__ = {"caller"} to BetaToolUseBlock and
   BetaServerToolUseBlock models.
3. Modifies the internal transformer to explicitly strip 'caller'
   if it's not annotated in a TypedDict, ensuring raw dicts or
   unfiltered model dumps don't leak it back to the API.

Fixes anthropics#1112
@Ashutosh0x Ashutosh0x requested a review from a team as a code owner January 22, 2026 04:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Tool inputs lost during streaming with Vertex AI integration (beta messages)

1 participant