From 251d34892eb6eb918aafcf7006718a38db996646 Mon Sep 17 00:00:00 2001 From: Andreas Bielawski Date: Thu, 9 Jan 2025 17:39:44 +0100 Subject: [PATCH] gemini: Adjust safety filters - new value "OFF" and new category "HARM_CATEGORY_CIVIC_INTEGRITY" --- plugin/gemini/api.go | 4 ++-- plugin/gemini/gemini.go | 12 ++++++++---- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/plugin/gemini/api.go b/plugin/gemini/api.go index 9e0624b..6ef2b57 100644 --- a/plugin/gemini/api.go +++ b/plugin/gemini/api.go @@ -26,8 +26,8 @@ type ( } SafetySetting struct { - Category string `json:"category"` - Threshold string `json:"threshold"` + Category string `json:"category"` // https://ai.google.dev/api/generate-content#v1beta.HarmCategory + Threshold string `json:"threshold"` // https://ai.google.dev/api/generate-content#HarmBlockThreshold } GenerationConfig struct { diff --git a/plugin/gemini/gemini.go b/plugin/gemini/gemini.go index 8342990..a214cf9 100644 --- a/plugin/gemini/gemini.go +++ b/plugin/gemini/gemini.go @@ -237,19 +237,23 @@ func (p *Plugin) onGemini(b *gotgbot.Bot, c plugin.GobotContext) error { SafetySettings: []SafetySetting{ { Category: "HARM_CATEGORY_HARASSMENT", - Threshold: "BLOCK_NONE", + Threshold: "OFF", }, { Category: "HARM_CATEGORY_HATE_SPEECH", - Threshold: "BLOCK_NONE", + Threshold: "OFF", }, { Category: "HARM_CATEGORY_SEXUALLY_EXPLICIT", - Threshold: "BLOCK_NONE", + Threshold: "OFF", }, { Category: "HARM_CATEGORY_DANGEROUS_CONTENT", - Threshold: "BLOCK_NONE", + Threshold: "OFF", + }, + { + Category: "HARM_CATEGORY_CIVIC_INTEGRITY", + Threshold: "OFF", }, }, GenerationConfig: GenerationConfig{