Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
phsl
/
new-api
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
d2449151
authored
Jun 21, 2025
by
CaIon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
✨
feat(relay-gemini): conditionally set ThinkingBudget based on MaxOutputTokens
parent
4307065c
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
3 deletions
+5
-3
relay/channel/gemini/relay-gemini.go
+5
-3
No files found.
relay/channel/gemini/relay-gemini.go
View file @
d2449151
...
@@ -133,12 +133,14 @@ func CovertGemini2OpenAI(textRequest dto.GeneralOpenAIRequest, info *relaycommon
...
@@ -133,12 +133,14 @@ func CovertGemini2OpenAI(textRequest dto.GeneralOpenAIRequest, info *relaycommon
IncludeThoughts
:
true
,
IncludeThoughts
:
true
,
}
}
}
else
{
}
else
{
budgetTokens
:=
model_setting
.
GetGeminiSettings
()
.
ThinkingAdapterBudgetTokensPercentage
*
float64
(
geminiRequest
.
GenerationConfig
.
MaxOutputTokens
)
clampedBudget
:=
clampThinkingBudget
(
modelName
,
int
(
budgetTokens
))
geminiRequest
.
GenerationConfig
.
ThinkingConfig
=
&
GeminiThinkingConfig
{
geminiRequest
.
GenerationConfig
.
ThinkingConfig
=
&
GeminiThinkingConfig
{
ThinkingBudget
:
common
.
GetPointer
(
clampedBudget
),
IncludeThoughts
:
true
,
IncludeThoughts
:
true
,
}
}
if
geminiRequest
.
GenerationConfig
.
MaxOutputTokens
>
0
{
budgetTokens
:=
model_setting
.
GetGeminiSettings
()
.
ThinkingAdapterBudgetTokensPercentage
*
float64
(
geminiRequest
.
GenerationConfig
.
MaxOutputTokens
)
clampedBudget
:=
clampThinkingBudget
(
modelName
,
int
(
budgetTokens
))
geminiRequest
.
GenerationConfig
.
ThinkingConfig
.
ThinkingBudget
=
common
.
GetPointer
(
clampedBudget
)
}
}
}
}
else
if
strings
.
HasSuffix
(
modelName
,
"-nothinking"
)
{
}
else
if
strings
.
HasSuffix
(
modelName
,
"-nothinking"
)
{
if
!
isNew25Pro
{
if
!
isNew25Pro
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment