Skip to content

Commit 1a75d71

Browse files
committed
feat: updates with probablity and severity info
1 parent 1ee081a commit 1a75d71

File tree

1 file changed

+39
-39
lines changed

1 file changed

+39
-39
lines changed

gemini/responsible-ai/gemini_safety_ratings.ipynb

+39-39
Original file line numberDiff line numberDiff line change
@@ -136,8 +136,8 @@
136136
"cell_type": "code",
137137
"execution_count": null,
138138
"metadata": {
139-
"tags": [],
140-
"id": "SBUtvsQHPJQ8"
139+
"id": "SBUtvsQHPJQ8",
140+
"tags": []
141141
},
142142
"outputs": [],
143143
"source": [
@@ -168,14 +168,14 @@
168168
},
169169
"outputs": [
170170
{
171-
"output_type": "execute_result",
172171
"data": {
173172
"text/plain": [
174173
"{'status': 'ok', 'restart': True}"
175174
]
176175
},
176+
"execution_count": 2,
177177
"metadata": {},
178-
"execution_count": 2
178+
"output_type": "execute_result"
179179
}
180180
],
181181
"source": [
@@ -299,8 +299,8 @@
299299
"cell_type": "code",
300300
"execution_count": null,
301301
"metadata": {
302-
"tags": [],
303-
"id": "5X9BCtm2PJQ-"
302+
"id": "5X9BCtm2PJQ-",
303+
"tags": []
304304
},
305305
"outputs": [],
306306
"source": [
@@ -346,8 +346,8 @@
346346
},
347347
"outputs": [
348348
{
349-
"output_type": "stream",
350349
"name": "stdout",
350+
"output_type": "stream",
351351
"text": [
352352
"1. You are a kind and compassionate person. You always put others first and are always willing to help those in need.\n",
353353
"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 @@
399399
},
400400
"outputs": [
401401
{
402-
"output_type": "stream",
403402
"name": "stdout",
403+
"output_type": "stream",
404404
"text": [
405405
"candidates {\n",
406406
" content {\n",
@@ -566,7 +566,7 @@
566566
"id": "8bd5SnfOSR0n"
567567
},
568568
"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",
570570
"\n",
571571
"The `category` types include:\n",
572572
"\n",
@@ -590,6 +590,9 @@
590590
},
591591
{
592592
"cell_type": "markdown",
593+
"metadata": {
594+
"id": "ncwjPVYfk19K"
595+
},
593596
"source": [
594597
"#### Comparing Probablity and Severity\n",
595598
"\n",
@@ -607,10 +610,7 @@
607610
"- The robot slashed me up.\n",
608611
"\n",
609612
"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."
610-
],
611-
"metadata": {
612-
"id": "ncwjPVYfk19K"
613-
}
613+
]
614614
},
615615
{
616616
"cell_type": "markdown",
@@ -625,17 +625,17 @@
625625
"cell_type": "code",
626626
"execution_count": null,
627627
"metadata": {
628-
"id": "pcw5s7Jo1Axm",
629-
"tags": [],
630-
"outputId": "5a326cd7-51f0-42f2-e02c-a0b8288eeef3",
631628
"colab": {
632629
"base_uri": "https://localhost:8080/"
633-
}
630+
},
631+
"id": "pcw5s7Jo1Axm",
632+
"outputId": "5a326cd7-51f0-42f2-e02c-a0b8288eeef3",
633+
"tags": []
634634
},
635635
"outputs": [
636636
{
637-
"output_type": "stream",
638637
"name": "stdout",
638+
"output_type": "stream",
639639
"text": [
640640
"candidates {\n",
641641
" content {\n",
@@ -768,8 +768,8 @@
768768
},
769769
"outputs": [
770770
{
771-
"output_type": "stream",
772771
"name": "stdout",
772+
"output_type": "stream",
773773
"text": [
774774
"candidates {\n",
775775
" content {\n",
@@ -954,8 +954,8 @@
954954
"cell_type": "code",
955955
"execution_count": null,
956956
"metadata": {
957-
"tags": [],
958-
"id": "T0YohSf1PJRB"
957+
"id": "T0YohSf1PJRB",
958+
"tags": []
959959
},
960960
"outputs": [],
961961
"source": [
@@ -982,17 +982,17 @@
982982
"cell_type": "code",
983983
"execution_count": null,
984984
"metadata": {
985-
"tags": [],
986-
"id": "Vq3at7EmPJRB",
987-
"outputId": "22d88743-b8a2-458d-f5d2-635db319e4a5",
988985
"colab": {
989986
"base_uri": "https://localhost:8080/"
990-
}
987+
},
988+
"id": "Vq3at7EmPJRB",
989+
"outputId": "22d88743-b8a2-458d-f5d2-635db319e4a5",
990+
"tags": []
991991
},
992992
"outputs": [
993993
{
994-
"output_type": "stream",
995994
"name": "stdout",
995+
"output_type": "stream",
996996
"text": [
997997
"candidates {\n",
998998
" content {\n",
@@ -1060,15 +1060,18 @@
10601060
},
10611061
{
10621062
"cell_type": "markdown",
1063-
"source": [
1064-
"Let's look at how we understand block resopnses in the next section."
1065-
],
10661063
"metadata": {
10671064
"id": "mYudAfc6gDi8"
1068-
}
1065+
},
1066+
"source": [
1067+
"Let's look at how we understand block responses in the next section."
1068+
]
10691069
},
10701070
{
10711071
"cell_type": "markdown",
1072+
"metadata": {
1073+
"id": "l2v6VnECf-fC"
1074+
},
10721075
"source": [
10731076
"## Understanding Blocked Responses\n",
10741077
"\n",
@@ -1078,13 +1081,13 @@
10781081
"> 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",
10791082
"\n",
10801083
"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+
]
10851085
},
10861086
{
10871087
"cell_type": "markdown",
1088+
"metadata": {
1089+
"id": "FhbbwYhJijfa"
1090+
},
10881091
"source": [
10891092
"\n",
10901093
"Finish Reason | Explanation\n",
@@ -1098,10 +1101,7 @@
10981101
"BLOCKLIST |\tThe token generation was stopped as the response was flagged for the terms which are included from the terminology blocklist.\n",
10991102
"PROHIBITED_CONTENT\t| The token generation was stopped as the response was flagged for the prohibited contents.\n",
11001103
"SPII\t| The token generation was stopped as the response was flagged for Sensitive Personally Identifiable Information (SPII) contents."
1101-
],
1102-
"metadata": {
1103-
"id": "FhbbwYhJijfa"
1104-
}
1104+
]
11051105
}
11061106
],
11071107
"metadata": {
@@ -1135,4 +1135,4 @@
11351135
},
11361136
"nbformat": 4,
11371137
"nbformat_minor": 0
1138-
}
1138+
}

0 commit comments

Comments
 (0)