mirror of
https://github.com/danny-avila/LibreChat.git
synced 2026-01-21 09:46:12 +01:00
🧵 fix: Remove Empty String values from Gemini API Payload (#11213)
When users don't explicitly set `maxOutputTokens` in Google/Gemini endpoint settings, LibreChat was sending `"maxOutputTokens": ""` instead of omitting the field. This caused issues with Gemini SDK and AI reverse proxies that expect numeric types. Changes: - Add `removeEmptyStrings=true` to `removeNullishValues()` in googleSchema - Add `removeEmptyStrings=true` to `removeNullishValues()` in compactGoogleSchema - Add `removeEmptyStrings=true` to `removeNullishValues()` in getGoogleConfig() - Create comprehensive test suite for Google endpoint (45 tests) The fix ensures empty strings for numeric fields like maxOutputTokens, temperature, topP, and topK are properly removed from the request payload. Closes #11187
This commit is contained in:
parent
1544491737
commit
e343180740
3 changed files with 793 additions and 11 deletions
|
|
@ -903,7 +903,7 @@ export const googleBaseSchema = tConversationSchema.pick({
|
|||
});
|
||||
|
||||
export const googleSchema = googleBaseSchema
|
||||
.transform((obj: Partial<TConversation>) => removeNullishValues(obj))
|
||||
.transform((obj: Partial<TConversation>) => removeNullishValues(obj, true))
|
||||
.catch(() => ({}));
|
||||
|
||||
/**
|
||||
|
|
@ -1101,7 +1101,7 @@ export const compactGoogleSchema = googleBaseSchema
|
|||
delete newObj.topK;
|
||||
}
|
||||
|
||||
return removeNullishValues(newObj);
|
||||
return removeNullishValues(newObj, true);
|
||||
})
|
||||
.catch(() => ({}));
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue