summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorsigoden <sigoden@gmail.com>2024-03-04 10:51:30 +0800
committerGitHub <noreply@github.com>2024-03-04 10:51:30 +0800
commit9e15a3409e7080f0cf06b6dcfc0077142e3e8972 (patch)
tree50b8a5d3789d3300578ffdbcefe5c4ce177624ea
parente443905dc1f16202b29a8cdc783069ea72c2ac81 (diff)
downloadaichat-9e15a3409e7080f0cf06b6dcfc0077142e3e8972.tar.gz
feat: reduce gemini blocking of unsafe content with safetySettings (#334)
-rw-r--r--src/client/vertexai.rs6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/client/vertexai.rs b/src/client/vertexai.rs
index 50e4b21..94becdb 100644
--- a/src/client/vertexai.rs
+++ b/src/client/vertexai.rs
@@ -259,6 +259,12 @@ pub(crate) fn build_body(data: SendData, _model: String) -> Result<Value> {
let mut body = json!({
"contents": contents,
+ "safetySettings":[
+ {"category":"HARM_CATEGORY_HARASSMENT","threshold":"BLOCK_ONLY_HIGH"},
+ {"category":"HARM_CATEGORY_HATE_SPEECH","threshold":"BLOCK_ONLY_HIGH"},
+ {"category":"HARM_CATEGORY_SEXUALLY_EXPLICIT","threshold":"BLOCK_ONLY_HIGH"},
+ {"category":"HARM_CATEGORY_DANGEROUS_CONTENT","threshold":"BLOCK_ONLY_HIGH"}
+ ]
});
if let Some(temperature) = temperature {