-
Notifications
You must be signed in to change notification settings - Fork 396
/
Copy pathsafety_settings.sh
38 lines (32 loc) · 1.42 KB
/
safety_settings.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
set -eu
echo "[START safety_settings]"
# [START safety_settings]
echo '{
"safetySettings": [
{'category': HARM_CATEGORY_HARASSMENT, 'threshold': BLOCK_ONLY_HIGH}
],
"contents": [{
"parts":[{
"text": "'I support Martians Soccer Club and I think Jupiterians Football Club sucks! Write a ironic phrase about them.'"}]}]}' > request.json
curl "https://generativelanguage.googleapis.com/v1beta/models/gemini-pro:generateContent?key=$GOOGLE_API_KEY" \
-H 'Content-Type: application/json' \
-X POST \
-d @request.json 2> /dev/null > tee response.json
jq .promptFeedback > response.json
# [END safety_settings]
echo "[START safety_settings_multi]"
# [START safety_settings_multi]
echo '{
"safetySettings": [
{'category': HARM_CATEGORY_HARASSMENT, 'threshold': BLOCK_ONLY_HIGH},
{'category': HARM_CATEGORY_HATE_SPEECH, 'threshold': BLOCK_MEDIUM_AND_ABOVE}
],
"contents": [{
"parts":[{
"text": "'I support Martians Soccer Club and I think Jupiterians Football Club sucks! Write a ironic phrase about them.'"}]}]}' > request.json
curl "https://generativelanguage.googleapis.com/v1beta/models/gemini-pro:generateContent?key=$GOOGLE_API_KEY" \
-H 'Content-Type: application/json' \
-X POST \
-d @request.json 2> /dev/null > response.json
jq .promptFeedback > response.json
# [END safety_settings_multi]