From e164662a2f1a31b608ffef7aceb910fb590add3d Mon Sep 17 00:00:00 2001 From: Ronny Gunawan <3048897+ronnygunawan@users.noreply.github.com> Date: Thu, 1 Feb 2024 21:33:31 +0700 Subject: [PATCH] Block none --- BotNet.Services/Gemini/GeminiClient.cs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/BotNet.Services/Gemini/GeminiClient.cs b/BotNet.Services/Gemini/GeminiClient.cs index 4b67a79..161466b 100644 --- a/BotNet.Services/Gemini/GeminiClient.cs +++ b/BotNet.Services/Gemini/GeminiClient.cs @@ -23,7 +23,12 @@ ILogger logger public async Task ChatAsync(IEnumerable messages, int maxTokens, CancellationToken cancellationToken) { GeminiRequest geminiRequest = new( Contents: messages.ToImmutableList(), - SafetySettings: null, + SafetySettings: [ + new SafetySettings("HARM_CATEGORY_HARASSMENT", "BLOCK_NONE"), + new SafetySettings("HARM_CATEGORY_HATE_SPEECH", "BLOCK_NONE"), + new SafetySettings("HARM_CATEGORY_SEXUALLY_EXPLICIT", "BLOCK_NONE"), + new SafetySettings("HARM_CATEGORY_DANGEROUS_CONTENT", "BLOCK_NONE") + ], GenerationConfig: new( MaxOutputTokens: maxTokens )