Skip to content

fix: add reasoning content in request and response for gcp anthropic#1607

Merged
yuzisun merged 6 commits intoenvoyproxy:mainfrom
hustxiayang:gcp-anthropic
Dec 15, 2025
Merged

fix: add reasoning content in request and response for gcp anthropic#1607
yuzisun merged 6 commits intoenvoyproxy:mainfrom
hustxiayang:gcp-anthropic

Conversation

@hustxiayang
Copy link
Copy Markdown
Contributor

@hustxiayang hustxiayang commented Dec 3, 2025

Description
This PR is to fix the following issues:
1 Add reasoning content in the request is also missing in the gcp anthropic
2 The reasoning output of gcp anthropic is not parsed out

In this way, reasoning claude models can have an unified interface.

Other issues:
1 The assistant message of gcp anthropic did not cover the case of array. Fixed.

Signed-off-by: yxia216 <yxia216@bloomberg.net>
@hustxiayang hustxiayang requested a review from a team as a code owner December 3, 2025 06:41
@hustxiayang hustxiayang marked this pull request as draft December 3, 2025 06:41
@dosubot dosubot bot added the size:L This PR changes 100-499 lines, ignoring generated files. label Dec 3, 2025
@codecov-commenter
Copy link
Copy Markdown

codecov-commenter commented Dec 3, 2025

Codecov Report

❌ Patch coverage is 87.38739% with 14 lines in your changes missing coverage. Please review.
✅ Project coverage is 83.44%. Comparing base (b8e607f) to head (f301ee9).
⚠️ Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
internal/translator/openai_gcpanthropic.go 90.41% 4 Missing and 3 partials ⚠️
internal/translator/openai_awsbedrock.go 63.63% 4 Missing ⚠️
internal/apischema/openai/openai.go 82.35% 3 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1607      +/-   ##
==========================================
+ Coverage   83.40%   83.44%   +0.04%     
==========================================
  Files         138      138              
  Lines       12455    12534      +79     
==========================================
+ Hits        10388    10459      +71     
- Misses       1434     1442       +8     
  Partials      633      633              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@hustxiayang hustxiayang marked this pull request as ready for review December 4, 2025 18:52
@hustxiayang hustxiayang marked this pull request as draft December 4, 2025 18:52
@hustxiayang hustxiayang changed the title fix: gcp's reasnoning also needs a fix fix: add reasoning content in request and response for gcp anthropic Dec 4, 2025
@hustxiayang hustxiayang marked this pull request as ready for review December 4, 2025 18:55
Signed-off-by: yxia216 <yxia216@bloomberg.net>
@dosubot dosubot bot added size:XL This PR changes 500-999 lines, ignoring generated files. and removed size:L This PR changes 100-499 lines, ignoring generated files. labels Dec 4, 2025
@hustxiayang
Copy link
Copy Markdown
Contributor Author

/retest

@hustxiayang
Copy link
Copy Markdown
Contributor Author

/retest

var str string
if err := json.Unmarshal(data, &str); err == nil {
// Try to decode as base64 first (this would be []byte encoded as base64)
if decoded, err := base64.StdEncoding.DecodeString(str); err == nil {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do we need to decode in gateway ?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is to check whether it's []byte, because in awsbedrock, the type is []byte but in gcp anthropic, the type is string

@hustxiayang hustxiayang marked this pull request as draft December 8, 2025 08:24
@hustxiayang hustxiayang marked this pull request as ready for review December 12, 2025 15:36
Copy link
Copy Markdown
Contributor

@yuzisun yuzisun left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@hustxiayang can you help update the documentation for the ReasoningContent for both AWS and GCP ?

@yuzisun yuzisun enabled auto-merge (squash) December 14, 2025 23:12
@yuzisun yuzisun merged commit a693c3a into envoyproxy:main Dec 15, 2025
30 checks passed
missBerg pushed a commit to missBerg/ai-gateway that referenced this pull request Dec 20, 2025
…nvoyproxy#1607)

**Description**
This PR is to fix the following issues:
1 Add reasoning content in the request is also missing in the gcp
anthropic
2 The reasoning output of gcp anthropic is not parsed out

In this way, reasoning claude models can have an unified interface.

Other issues:
1 The assistant message of gcp anthropic did not cover the case of
array. Fixed.

---------

Signed-off-by: yxia216 <yxia216@bloomberg.net>
Signed-off-by: Erica Hughberg <erica.sundberg.90@gmail.com>
hustxiayang added a commit to hustxiayang/ai-gateway that referenced this pull request Jan 29, 2026
…nvoyproxy#1607)

**Description**
This PR is to fix the following issues:
1 Add reasoning content in the request is also missing in the gcp
anthropic
2 The reasoning output of gcp anthropic is not parsed out

In this way, reasoning claude models can have an unified interface.

Other issues:
1 The assistant message of gcp anthropic did not cover the case of
array. Fixed.

---------

Signed-off-by: yxia216 <yxia216@bloomberg.net>
hustxiayang added a commit to hustxiayang/ai-gateway that referenced this pull request Feb 2, 2026
…nvoyproxy#1607)

**Description**
This PR is to fix the following issues:
1 Add reasoning content in the request is also missing in the gcp
anthropic
2 The reasoning output of gcp anthropic is not parsed out

In this way, reasoning claude models can have an unified interface.

Other issues:
1 The assistant message of gcp anthropic did not cover the case of
array. Fixed.

---------

Signed-off-by: yxia216 <yxia216@bloomberg.net>
hustxiayang added a commit to hustxiayang/ai-gateway that referenced this pull request Feb 5, 2026
…nvoyproxy#1607)

**Description**
This PR is to fix the following issues:
1 Add reasoning content in the request is also missing in the gcp
anthropic
2 The reasoning output of gcp anthropic is not parsed out

In this way, reasoning claude models can have an unified interface.

Other issues:
1 The assistant message of gcp anthropic did not cover the case of
array. Fixed.

---------

Signed-off-by: yxia216 <yxia216@bloomberg.net>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:XL This PR changes 500-999 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants