Merge branch 'main' into 'main'

disable thinking budget validation on gemini

See merge request reanon/nonono!6
This commit is contained in:
reanon
2025-06-18 12:25:24 -08:00
2 changed files with 4 additions and 13 deletions
+3 -12
View File
@@ -189,20 +189,11 @@ googleAIRouter.get("/:apiVersion(v1alpha|v1beta)/models", handleNativeModelReque
/**
* Processes the thinking budget for Gemini 2.5 Flash model.
* Ensures the budget is within the valid range of 0-24576 tokens.
* Validation has been disabled - budget is passed through without limits.
*/
function processThinkingBudget(req: Request) {
if (req.body.generationConfig?.thinkingConfig?.thinkingBudget !== undefined) {
// Ensure thinkingBudget is within allowed range (0-24576)
const budget = req.body.generationConfig.thinkingConfig.thinkingBudget;
// If it's a number, validate range
if (typeof budget === 'number') {
req.body.generationConfig.thinkingConfig.thinkingBudget =
Math.max(0, Math.min(budget, 24576));
}
// If it's "auto", leave as is
}
// Validation disabled - budget is passed through without any range limits
// Previously enforced 0-24576 token limit
}
function setStreamFlag(req: Request) {
+1 -1
View File
@@ -82,7 +82,7 @@ export const GoogleAIV1GenerateContentSchema = z
includeThoughts: z.boolean().optional(),
thinkingBudget: z.union([
z.literal("auto"),
z.number().int().min(0).max(24576)
z.number().int()
]).optional()
}).optional(),
responseModalities: z.any().optional(), // responseModalities: z.array(z.enum(["TEXT"])).optional()