🐛 fix: support Gemini 2.0 HarmBlockThreshold (#5422)

* Update index.ts

* Update index.ts
This commit is contained in:
sxjeru
2025-01-14 22:52:54 +08:00
committed by GitHub
parent 3cffc7e5fc
commit 4d1a4cd800
+5 -4
View File
@@ -36,6 +36,7 @@ enum HarmCategory {
enum HarmBlockThreshold {
BLOCK_NONE = 'BLOCK_NONE',
OFF = 'OFF', // https://discuss.ai.google.dev/t/59352
}
export class LobeGoogleAI implements LobeRuntimeAI {
@@ -70,19 +71,19 @@ export class LobeGoogleAI implements LobeRuntimeAI {
safetySettings: [
{
category: HarmCategory.HARM_CATEGORY_HATE_SPEECH,
threshold: HarmBlockThreshold.BLOCK_NONE,
threshold: model.includes('2.0') ? (HarmBlockThreshold.OFF as any) : HarmBlockThreshold.BLOCK_NONE,
},
{
category: HarmCategory.HARM_CATEGORY_SEXUALLY_EXPLICIT,
threshold: HarmBlockThreshold.BLOCK_NONE,
threshold: model.includes('2.0') ? (HarmBlockThreshold.OFF as any) : HarmBlockThreshold.BLOCK_NONE,
},
{
category: HarmCategory.HARM_CATEGORY_HARASSMENT,
threshold: HarmBlockThreshold.BLOCK_NONE,
threshold: model.includes('2.0') ? (HarmBlockThreshold.OFF as any) : HarmBlockThreshold.BLOCK_NONE,
},
{
category: HarmCategory.HARM_CATEGORY_DANGEROUS_CONTENT,
threshold: HarmBlockThreshold.BLOCK_NONE,
threshold: model.includes('2.0') ? (HarmBlockThreshold.OFF as any) : HarmBlockThreshold.BLOCK_NONE,
},
],
},