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) {
308 ) && request.body.use_makersuite_sysprompt;308 ) && request.body.use_makersuite_sysprompt;
309309
310 const prompt = convertGooglePrompt(request.body.messages, model, should_use_system_prompt, getPromptNames(request));310 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
311 let body = {317 let body = {
312 contents: prompt.contents,318 contents: prompt.contents,
313 safetySettings: GEMINI_SAFETY,319 safetySettings: safetySettings,
314 generationConfig: generationConfig,320 generationConfig: generationConfig,
315 };321 };
316322
323
317 if (should_use_system_prompt) {324 if (should_use_system_prompt) {
318 body.system_instruction = prompt.system_instruction;325 body.system_instruction = prompt.system_instruction;
319 }326 }