File tree Expand file tree Collapse file tree 1 file changed +38
-0
lines changed Expand file tree Collapse file tree 1 file changed +38
-0
lines changed Original file line number Diff line number Diff line change
1
+ set -eu
2
+
3
+ echo " [START safety_settings]"
4
+ # [START safety_settings]
5
+ echo ' {
6
+ "safetySettings": [
7
+ {' category' : HARM_CATEGORY_HARASSMENT, ' threshold' : BLOCK_ONLY_HIGH}
8
+ ],
9
+ "contents": [{
10
+ "parts":[{
11
+ "text": "' I support Martians Soccer Club and I think Jupiterians Football Club sucks! Write a ironic phrase about them.' "}]}]}' > request.json
12
+
13
+ curl " https://generativelanguage.googleapis.com/v1beta/models/gemini-pro:generateContent?key=$GOOGLE_API_KEY " \
14
+ -H ' Content-Type: application/json' \
15
+ -X POST \
16
+ -d @request.json 2> /dev/null > tee response.json
17
+
18
+ jq .promptFeedback > response.json
19
+ # [END safety_settings]
20
+
21
+ echo " [START safety_settings_multi]"
22
+ # [START safety_settings_multi]
23
+ echo ' {
24
+ "safetySettings": [
25
+ {' category' : HARM_CATEGORY_HARASSMENT, ' threshold' : BLOCK_ONLY_HIGH},
26
+ {' category' : HARM_CATEGORY_HATE_SPEECH, ' threshold' : BLOCK_MEDIUM_AND_ABOVE}
27
+ ],
28
+ "contents": [{
29
+ "parts":[{
30
+ "text": "' I support Martians Soccer Club and I think Jupiterians Football Club sucks! Write a ironic phrase about them.' "}]}]}' > request.json
31
+
32
+ curl " https://generativelanguage.googleapis.com/v1beta/models/gemini-pro:generateContent?key=$GOOGLE_API_KEY " \
33
+ -H ' Content-Type: application/json' \
34
+ -X POST \
35
+ -d @request.json 2> /dev/null > response.json
36
+
37
+ jq .promptFeedback > response.json
38
+ # [END safety_settings_multi]
You can’t perform that action at this time.
0 commit comments