feat: parse out thought summary from gemini models' response when include thought is true#1521
Merged
yuzisun merged 7 commits intoenvoyproxy:mainfrom Nov 30, 2025
Merged
Conversation
yuzisun
pushed a commit
that referenced
this pull request
Nov 21, 2025
#1554) **Description** Some new features were introduced in gemini3: **1 thinking_level:** https://ai.google.dev/gemini-api/docs/gemini-3?thinking=low#thinking_level This is similar to reasoning_effort of openai, thus, unified them. **2 media_resolution** https://ai.google.dev/gemini-api/docs/gemini-3?thinking=low#media_resolution This is similar to detail in openai, thus, unified them. The difference is that openai does not provide a global config of media_resolution. Thus, added it as gcp specific, but still use detail to make the name consistent. **Some related PRs:** thinking_budget is in #1461 thinking_level and thinking_budget are both supported, but can not use them together. Other features under review: **1 web search:** #1526 **2 parse the thought summary:** #1521 --------- Signed-off-by: yxia216 <yxia216@bloomberg.net> Signed-off-by: Alexa Griffith <agriffith50@bloomberg.net> Signed-off-by: Sukumar Gaonkar <sgaonkar4@bloomberg.net> Co-authored-by: Alexa Griffith <agriffith50@bloomberg.net> Co-authored-by: Sukumar Gaonkar <sgaonkar4@bloomberg.net> Co-authored-by: Ignasi Barrera <ignasi@tetrate.io>
yuzisun
reviewed
Nov 29, 2025
internal/translator/gemini_helper.go
Outdated
| thoughtSummary, content := extractTextAndThoughtSummaryFromGeminiParts(candidate.Content.Parts, responseMode) | ||
| if thoughtSummary != "" { | ||
| message.ReasoningContent = &openai.ReasoningContentUnion{ | ||
| Value: &openai.AWSBedrockReasoningContent{ |
Contributor
There was a problem hiding this comment.
since reasoning content is also used by gemini now, we should remove the AWSBedrock naming prefix.
Contributor
Author
There was a problem hiding this comment.
@yuzisun I removed the AWSBedrock prefix in stream and non-stream
Contributor
|
@hustxiayang can you help resolve the conflicts here |
bf5311b to
02d460e
Compare
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #1521 +/- ##
==========================================
+ Coverage 84.03% 84.05% +0.02%
==========================================
Files 141 141
Lines 13039 13056 +17
==========================================
+ Hits 10957 10974 +17
Misses 1460 1460
Partials 622 622 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
yuzisun
approved these changes
Nov 30, 2025
missBerg
pushed a commit
to missBerg/ai-gateway
that referenced
this pull request
Dec 20, 2025
envoyproxy#1554) **Description** Some new features were introduced in gemini3: **1 thinking_level:** https://ai.google.dev/gemini-api/docs/gemini-3?thinking=low#thinking_level This is similar to reasoning_effort of openai, thus, unified them. **2 media_resolution** https://ai.google.dev/gemini-api/docs/gemini-3?thinking=low#media_resolution This is similar to detail in openai, thus, unified them. The difference is that openai does not provide a global config of media_resolution. Thus, added it as gcp specific, but still use detail to make the name consistent. **Some related PRs:** thinking_budget is in envoyproxy#1461 thinking_level and thinking_budget are both supported, but can not use them together. Other features under review: **1 web search:** envoyproxy#1526 **2 parse the thought summary:** envoyproxy#1521 --------- Signed-off-by: yxia216 <yxia216@bloomberg.net> Signed-off-by: Alexa Griffith <agriffith50@bloomberg.net> Signed-off-by: Sukumar Gaonkar <sgaonkar4@bloomberg.net> Co-authored-by: Alexa Griffith <agriffith50@bloomberg.net> Co-authored-by: Sukumar Gaonkar <sgaonkar4@bloomberg.net> Co-authored-by: Ignasi Barrera <ignasi@tetrate.io> Signed-off-by: Erica Hughberg <erica.sundberg.90@gmail.com>
missBerg
pushed a commit
to missBerg/ai-gateway
that referenced
this pull request
Dec 20, 2025
…lude thought is true (envoyproxy#1521) **Description** When `includeThought` is true, Gemini would also generate summary of thinking process. We need to parse out this kind of data to users. Otherwise, we would return thought process together with output to users. Depends/base or replace envoyproxy#1461 --------- Signed-off-by: yxia216 <yxia216@bloomberg.net> Signed-off-by: Erica Hughberg <erica.sundberg.90@gmail.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
When
includeThoughtis true, Gemini would also generate summary of thinking process. We need to parse out this kind of data to users. Otherwise, we would return thought process together with output to users.Depends/base or replace #1461