Skip to content

Commit

Permalink
Update failure-finish-reason-safety with Vertex responses (#21)
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewheard authored Oct 14, 2024
1 parent 510e9f6 commit fa4ce87
Show file tree
Hide file tree
Showing 3 changed files with 64 additions and 70 deletions.
2 changes: 1 addition & 1 deletion mock-responses/streaming-failure-finish-reason-safety.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
data: {"candidates": [{"content": {"parts": [{"text": "<redacted>"}],"role": "model"},"finishReason": "SAFETY","index": 0,"safetyRatings": [{"category": "HARM_CATEGORY_SEXUALLY_EXPLICIT","probability": "NEGLIGIBLE"},{"category": "HARM_CATEGORY_HATE_SPEECH","probability": "HIGH"},{"category": "HARM_CATEGORY_HARASSMENT","probability": "NEGLIGIBLE"},{"category": "HARM_CATEGORY_DANGEROUS_CONTENT","probability": "NEGLIGIBLE"}]}],"promptFeedback": {"safetyRatings": [{"category": "HARM_CATEGORY_SEXUALLY_EXPLICIT","probability": "NEGLIGIBLE"},{"category": "HARM_CATEGORY_HATE_SPEECH","probability": "NEGLIGIBLE"},{"category": "HARM_CATEGORY_HARASSMENT","probability": "NEGLIGIBLE"},{"category": "HARM_CATEGORY_DANGEROUS_CONTENT","probability": "NEGLIGIBLE"}]}}
data: {"candidates": [{"content": {"parts": [{"text": "<redacted>"}],"role": "model"},"finishReason": "SAFETY","safetyRatings": [{"category": "HARM_CATEGORY_HATE_SPEECH","probability": "NEGLIGIBLE","probabilityScore": 0.40429688,"severity": "HARM_SEVERITY_NEGLIGIBLE","severityScore": 0.18554688},{"category": "HARM_CATEGORY_DANGEROUS_CONTENT","probability": "NEGLIGIBLE","probabilityScore": 0.15820313,"severity": "HARM_SEVERITY_NEGLIGIBLE","severityScore": 0.030639648},{"category": "HARM_CATEGORY_HARASSMENT","probability": "LOW","blocked": true,"probabilityScore": 0.55078125,"severity": "HARM_SEVERITY_LOW","severityScore": 0.24804688},{"category": "HARM_CATEGORY_SEXUALLY_EXPLICIT","probability": "NEGLIGIBLE","probabilityScore": 0.17675781,"severity": "HARM_SEVERITY_NEGLIGIBLE","severityScore": 0.17871094}]}],"usageMetadata": {"promptTokenCount": 10,"candidatesTokenCount": 66,"totalTokenCount": 76},"modelVersion": "gemini-1.5-flash"}

79 changes: 38 additions & 41 deletions mock-responses/unary-failure-finish-reason-safety-no-content.json
Original file line number Diff line number Diff line change
@@ -1,46 +1,43 @@
{
"candidates": [
"candidates": [
{
"finishReason": "SAFETY",
"safetyRatings": [
{
"finishReason": "SAFETY",
"index": 0,
"safetyRatings": [
{
"category": "HARM_CATEGORY_SEXUALLY_EXPLICIT",
"probability": "NEGLIGIBLE"
},
{
"category": "HARM_CATEGORY_HATE_SPEECH",
"probability": "HIGH"
},
{
"category": "HARM_CATEGORY_HARASSMENT",
"probability": "NEGLIGIBLE"
},
{
"category": "HARM_CATEGORY_DANGEROUS_CONTENT",
"probability": "NEGLIGIBLE"
}
]
"category": "HARM_CATEGORY_HATE_SPEECH",
"probability": "NEGLIGIBLE",
"probabilityScore": 0.3984375,
"severity": "HARM_SEVERITY_LOW",
"severityScore": 0.21582031
},
{
"category": "HARM_CATEGORY_DANGEROUS_CONTENT",
"probability": "NEGLIGIBLE",
"probabilityScore": 0.14941406,
"severity": "HARM_SEVERITY_NEGLIGIBLE",
"severityScore": 0.02331543
},
{
"category": "HARM_CATEGORY_HARASSMENT",
"probability": "LOW",
"blocked": true,
"probabilityScore": 0.61328125,
"severity": "HARM_SEVERITY_LOW",
"severityScore": 0.31835938
},
{
"category": "HARM_CATEGORY_SEXUALLY_EXPLICIT",
"probability": "NEGLIGIBLE",
"probabilityScore": 0.13476563,
"severity": "HARM_SEVERITY_NEGLIGIBLE",
"severityScore": 0.12109375
}
],
"promptFeedback": {
"safetyRatings": [
{
"category": "HARM_CATEGORY_SEXUALLY_EXPLICIT",
"probability": "NEGLIGIBLE"
},
{
"category": "HARM_CATEGORY_HATE_SPEECH",
"probability": "NEGLIGIBLE"
},
{
"category": "HARM_CATEGORY_HARASSMENT",
"probability": "NEGLIGIBLE"
},
{
"category": "HARM_CATEGORY_DANGEROUS_CONTENT",
"probability": "NEGLIGIBLE"
}
]
]
}
],
"usageMetadata": {
"promptTokenCount": 8,
"totalTokenCount": 8
},
"modelVersion": "gemini-1.5-flash"
}
53 changes: 25 additions & 28 deletions mock-responses/unary-failure-finish-reason-safety.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,45 +10,42 @@
"role": "model"
},
"finishReason": "SAFETY",
"index": 0,
"safetyRatings": [
{
"category": "HARM_CATEGORY_SEXUALLY_EXPLICIT",
"probability": "NEGLIGIBLE"
"category": "HARM_CATEGORY_HATE_SPEECH",
"probability": "NEGLIGIBLE",
"probabilityScore": 0.3984375,
"severity": "HARM_SEVERITY_LOW",
"severityScore": 0.21582031
},
{
"category": "HARM_CATEGORY_HATE_SPEECH",
"probability": "HIGH"
"category": "HARM_CATEGORY_DANGEROUS_CONTENT",
"probability": "NEGLIGIBLE",
"probabilityScore": 0.14941406,
"severity": "HARM_SEVERITY_NEGLIGIBLE",
"severityScore": 0.02331543
},
{
"category": "HARM_CATEGORY_HARASSMENT",
"probability": "NEGLIGIBLE"
"probability": "LOW",
"blocked": true,
"probabilityScore": 0.61328125,
"severity": "HARM_SEVERITY_LOW",
"severityScore": 0.31835938
},
{
"category": "HARM_CATEGORY_DANGEROUS_CONTENT",
"probability": "NEGLIGIBLE"
"category": "HARM_CATEGORY_SEXUALLY_EXPLICIT",
"probability": "NEGLIGIBLE",
"probabilityScore": 0.13476563,
"severity": "HARM_SEVERITY_NEGLIGIBLE",
"severityScore": 0.12109375
}
]
}
],
"promptFeedback": {
"safetyRatings": [
{
"category": "HARM_CATEGORY_SEXUALLY_EXPLICIT",
"probability": "NEGLIGIBLE"
},
{
"category": "HARM_CATEGORY_HATE_SPEECH",
"probability": "NEGLIGIBLE"
},
{
"category": "HARM_CATEGORY_HARASSMENT",
"probability": "NEGLIGIBLE"
},
{
"category": "HARM_CATEGORY_DANGEROUS_CONTENT",
"probability": "NEGLIGIBLE"
}
]
}
"usageMetadata": {
"promptTokenCount": 8,
"totalTokenCount": 8
},
"modelVersion": "gemini-1.5-flash"
}

0 comments on commit fa4ce87

Please sign in to comment.