fix: set anthropic beta headers in vertex requests headers as well - #3585
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
📝 WalkthroughSummary by CodeRabbit
WalkthroughThe Vertex provider now explicitly filters merged network/context beta headers and sets or deletes ChangesVertex Anthropic Beta Header Management
Estimated code review effort🎯 2 (Simple) | ⏱️ ~8 minutes Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Warning There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure. 🔧 golangci-lint (2.12.2)level=error msg="[linters_context] typechecking error: pattern ./...: directory prefix . does not contain main module or its selected dependencies" Comment |
Confidence Score: 5/5Safe to merge — the change is a targeted header-propagation fix that follows the established pattern used by the direct Anthropic provider path. The new beta-header block in No files require special attention. Important Files Changed
Reviews (2): Last reviewed commit: "fix: set anthropic beta headers in verte..." | Re-trigger Greptile |
|
tejas ghatte seems not to be a GitHub user. You need a GitHub account to be able to sign the CLA. If you have already a GitHub account, please add the email address used for this commit to your account. You have signed the CLA already but the status is still pending? Let us recheck it. |
a75995b to
718f38c
Compare
Merge activity
|
…3585) ## Summary This PR adds proper `anthropic-beta` header propagation for Vertex AI's `Responses` and `ResponsesStream` endpoints, ensuring beta feature headers are correctly filtered and applied when making Anthropic-on-Vertex requests. ## Changes - Applied `FilterBetaHeadersForProvider` and `MergeBetaHeaders` logic to the Vertex `Responses` method, replacing the previous unconditional `SetExtraHeaders` behavior with explicit beta header setting or deletion. - Applied the same beta header logic to `ResponsesStream`, injecting the filtered beta headers into the request headers map before streaming begins. - Removed an unnecessary blank line in `Responses` after the `bifrostErr` check. - Removed redundant parentheses around a boolean condition in `ChatCompletionStream`. ## Type of change - [ ] Bug fix - [x] Feature - [ ] Refactor - [ ] Documentation - [ ] Chore/CI ## Affected areas - [ ] Core (Go) - [ ] Transports (HTTP) - [x] Providers/Integrations - [ ] Plugins - [ ] UI (React) - [ ] Docs ## How to test Send a request to the Vertex `Responses` or `ResponsesStream` endpoint using an Anthropic model that requires a beta header (e.g., a model requiring `interleaved-thinking-20250522`). Verify that the `anthropic-beta` header is correctly set in the outgoing request and that the response is successful. ```sh go test ./... ``` ## Breaking changes - [ ] Yes - [x] No ## Related issues ## Security considerations No security implications. Changes are limited to header propagation logic for Vertex AI Anthropic requests. ## Checklist - [ ] I read `docs/contributing/README.md` and followed the guidelines - [ ] I added/updated tests where appropriate - [ ] I updated documentation where needed - [ ] I verified builds succeed (Go and UI) - [ ] I verified the CI pipeline passes locally if applicable

Summary
This PR adds proper
anthropic-betaheader propagation for Vertex AI'sResponsesandResponsesStreamendpoints, ensuring beta feature headers are correctly filtered and applied when making Anthropic-on-Vertex requests.Changes
FilterBetaHeadersForProviderandMergeBetaHeaderslogic to the VertexResponsesmethod, replacing the previous unconditionalSetExtraHeadersbehavior with explicit beta header setting or deletion.ResponsesStream, injecting the filtered beta headers into the request headers map before streaming begins.Responsesafter thebifrostErrcheck.ChatCompletionStream.Type of change
Affected areas
How to test
Send a request to the Vertex
ResponsesorResponsesStreamendpoint using an Anthropic model that requires a beta header (e.g., a model requiringinterleaved-thinking-20250522). Verify that theanthropic-betaheader is correctly set in the outgoing request and that the response is successful.go test ./...Breaking changes
Related issues
Security considerations
No security implications. Changes are limited to header propagation logic for Vertex AI Anthropic requests.
Checklist
docs/contributing/README.mdand followed the guidelines