Merge pull request #3271 from tincansimagine/geminifeat2

Fix: Ensure "OFF" safety settings are applied to gemini-2.0-flash-exp for unfiltered responses
This commit is contained in:
Cohee 2025-01-06 19:25:45 +02:00 committed by GitHub
commit f91e1b3d2f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -308,9 +308,15 @@ async function sendMakerSuiteRequest(request, response) {
) && request.body.use_makersuite_sysprompt;
const prompt = convertGooglePrompt(request.body.messages, model, should_use_system_prompt, getPromptNames(request));
let safetySettings = GEMINI_SAFETY;
if (model.includes('gemini-2.0-flash-exp')) {
safetySettings = GEMINI_SAFETY.map(setting => ({ ...setting, threshold: 'OFF' }));
}
let body = {
contents: prompt.contents,
safetySettings: GEMINI_SAFETY,
safetySettings: safetySettings,
generationConfig: generationConfig,
};