You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardexpand all lines: gemini/responsible-ai/gemini_safety_ratings.ipynb
+39-39
Original file line number
Diff line number
Diff line change
@@ -136,8 +136,8 @@
136
136
"cell_type": "code",
137
137
"execution_count": null,
138
138
"metadata": {
139
-
"tags": [],
140
-
"id": "SBUtvsQHPJQ8"
139
+
"id": "SBUtvsQHPJQ8",
140
+
"tags": []
141
141
},
142
142
"outputs": [],
143
143
"source": [
@@ -168,14 +168,14 @@
168
168
},
169
169
"outputs": [
170
170
{
171
-
"output_type": "execute_result",
172
171
"data": {
173
172
"text/plain": [
174
173
"{'status': 'ok', 'restart': True}"
175
174
]
176
175
},
176
+
"execution_count": 2,
177
177
"metadata": {},
178
-
"execution_count": 2
178
+
"output_type": "execute_result"
179
179
}
180
180
],
181
181
"source": [
@@ -299,8 +299,8 @@
299
299
"cell_type": "code",
300
300
"execution_count": null,
301
301
"metadata": {
302
-
"tags": [],
303
-
"id": "5X9BCtm2PJQ-"
302
+
"id": "5X9BCtm2PJQ-",
303
+
"tags": []
304
304
},
305
305
"outputs": [],
306
306
"source": [
@@ -346,8 +346,8 @@
346
346
},
347
347
"outputs": [
348
348
{
349
-
"output_type": "stream",
350
349
"name": "stdout",
350
+
"output_type": "stream",
351
351
"text": [
352
352
"1. You are a kind and compassionate person. You always put others first and are always willing to help those in need.\n",
353
353
"2. You are a creative and intelligent person. You have a unique way of looking at the world and are always coming up with new ideas.\n",
@@ -399,8 +399,8 @@
399
399
},
400
400
"outputs": [
401
401
{
402
-
"output_type": "stream",
403
402
"name": "stdout",
403
+
"output_type": "stream",
404
404
"text": [
405
405
"candidates {\n",
406
406
" content {\n",
@@ -566,7 +566,7 @@
566
566
"id": "8bd5SnfOSR0n"
567
567
},
568
568
"source": [
569
-
"You can see the safety ratings, including each `category` type and its associated `probability` label, as well as a `probability_score`. Additionally, saftey ratings have been expanded to `severity` and `severity_score`.\n",
569
+
"You can see the safety ratings, including each `category` type and its associated `probability` label, as well as a `probability_score`. Additionally, safety ratings have been expanded to `severity` and `severity_score`.\n",
570
570
"\n",
571
571
"The `category` types include:\n",
572
572
"\n",
@@ -590,6 +590,9 @@
590
590
},
591
591
{
592
592
"cell_type": "markdown",
593
+
"metadata": {
594
+
"id": "ncwjPVYfk19K"
595
+
},
593
596
"source": [
594
597
"#### Comparing Probablity and Severity\n",
595
598
"\n",
@@ -607,10 +610,7 @@
607
610
"- The robot slashed me up.\n",
608
611
"\n",
609
612
"The first sentence might cause a higher probability of being unsafe and the second sentence might have a higher severity in terms of violence. Because of this, it's important to carefully test and consider the appropriate level of blocking required to support your key use cases and also minimize harm to end users."
"Let's look at how we understand block resopnses in the next section."
1065
-
],
1066
1063
"metadata": {
1067
1064
"id": "mYudAfc6gDi8"
1068
-
}
1065
+
},
1066
+
"source": [
1067
+
"Let's look at how we understand block responses in the next section."
1068
+
]
1069
1069
},
1070
1070
{
1071
1071
"cell_type": "markdown",
1072
+
"metadata": {
1073
+
"id": "l2v6VnECf-fC"
1074
+
},
1072
1075
"source": [
1073
1076
"## Understanding Blocked Responses\n",
1074
1077
"\n",
@@ -1078,13 +1081,13 @@
1078
1081
"> The token generation was stopped as the response was flagged for safety reasons. NOTE: When streaming the Candidate.content will be empty if content filters blocked the output.\n",
1079
1082
"\n",
1080
1083
"As of this writing, the table from the [FinishReason docs](https://cloud.google.com/vertex-ai/docs/reference/rest/v1/GenerateContentResponse#finishreason) have been reproduced below, but please look at the docs for the definitive explanations\n"
1081
-
],
1082
-
"metadata": {
1083
-
"id": "l2v6VnECf-fC"
1084
-
}
1084
+
]
1085
1085
},
1086
1086
{
1087
1087
"cell_type": "markdown",
1088
+
"metadata": {
1089
+
"id": "FhbbwYhJijfa"
1090
+
},
1088
1091
"source": [
1089
1092
"\n",
1090
1093
"Finish Reason | Explanation\n",
@@ -1098,10 +1101,7 @@
1098
1101
"BLOCKLIST |\tThe token generation was stopped as the response was flagged for the terms which are included from the terminology blocklist.\n",
1099
1102
"PROHIBITED_CONTENT\t| The token generation was stopped as the response was flagged for the prohibited contents.\n",
1100
1103
"SPII\t| The token generation was stopped as the response was flagged for Sensitive Personally Identifiable Information (SPII) contents."
0 commit comments