Fix: Apply OFF safety settings for gemini-2.0-flash-exp model

2103e6238cbdf08232147edb165c26c32725dc02

tincansimagine <tincansimagine@gmail.com>

1 files changed, +8 -1Ignore whitespace
src/endpoints/backends/chat-completions.js+8 -1
@@ -308,12 +308,19 @@ 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
323+
317324 if (should_use_system_prompt) {
318325 body.system_instruction = prompt.system_instruction;
319326 }