Merge pull request #3271 from tincansimagine/geminifeat2 Fix: Ensure "OFF" safety settings are applied to gemini-2.0-flash-exp for unfiltered responses

f91e1b3d2feac37c2e06e5ea1b51eb0e1ef628c9

Cohee <18619528+Cohee1207@users.noreply.github.com>

Signed
1 files changed, +7 -1Showing whitespace changes
src/endpoints/backends/chat-completions.js+7 -1
@@ -308,9 +308,15 @@ async function sendMakerSuiteRequest(request, response) {
308308 ) && request.body.use_makersuite_sysprompt;
309309
310310 const prompt = convertGooglePrompt(request.body.messages, model, should_use_system_prompt, getPromptNames(request));
311+ let safetySettings = GEMINI_SAFETY;
312+
313+ if (model.includes('gemini-2.0-flash-exp')) {
314+ safetySettings = GEMINI_SAFETY.map(setting => ({ ...setting, threshold: 'OFF' }));
315+ }
316+
311317 let body = {
312318 contents: prompt.contents,
313319 safetySettings: GEMINI_SAFETYsafetySettings,
314320 generationConfig: generationConfig,
315321 };
316322