The probability score of the harm category.This property is only supported when using the Vertex AI Gemini API (VertexAIBackend). When using the Gemini Developer API (GoogleAIBackend), this property is not supported and will default to 0.
The harm severity level.This property is only supported when using the Vertex AI Gemini API (VertexAIBackend). When using the Gemini Developer API (GoogleAIBackend), this property is not supported and will default to HarmSeverity.UNSUPPORTED.
The severity score of the harm category.This property is only supported when using the Vertex AI Gemini API (VertexAIBackend). When using the Gemini Developer API (GoogleAIBackend), this property is not supported and will default to 0.
SafetyRating.blocked
Signature:
blocked:boolean;
SafetyRating.category
Signature:
category:HarmCategory;
SafetyRating.probability
Signature:
probability:HarmProbability;
SafetyRating.probabilityScore
The probability score of the harm category.
This property is only supported when using the Vertex AI Gemini API (VertexAIBackend). When using the Gemini Developer API (GoogleAIBackend), this property is not supported and will default to 0.
Signature:
probabilityScore:number;
SafetyRating.severity
The harm severity level.
This property is only supported when using the Vertex AI Gemini API (VertexAIBackend). When using the Gemini Developer API (GoogleAIBackend), this property is not supported and will default to HarmSeverity.UNSUPPORTED.
Signature:
severity:HarmSeverity;
SafetyRating.severityScore
The severity score of the harm category.
This property is only supported when using the Vertex AI Gemini API (VertexAIBackend). When using the Gemini Developer API (GoogleAIBackend), this property is not supported and will default to 0.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-05-20 UTC."],[],[],null,["# SafetyRating interface\n\nA safety rating associated with a [GenerateContentCandidate](./ai.generatecontentcandidate.md#generatecontentcandidate_interface)\n\n**Signature:** \n\n export interface SafetyRating \n\nProperties\n----------\n\n| Property | Type | Description |\n|-----------------------------------------------------------------------|--------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| [blocked](./ai.safetyrating.md#safetyratingblocked) | boolean | |\n| [category](./ai.safetyrating.md#safetyratingcategory) | [HarmCategory](./ai.md#harmcategory) | |\n| [probability](./ai.safetyrating.md#safetyratingprobability) | [HarmProbability](./ai.md#harmprobability) | |\n| [probabilityScore](./ai.safetyrating.md#safetyratingprobabilityscore) | number | The probability score of the harm category.This property is only supported when using the Vertex AI Gemini API ([VertexAIBackend](./ai.vertexaibackend.md#vertexaibackend_class)). When using the Gemini Developer API ([GoogleAIBackend](./ai.googleaibackend.md#googleaibackend_class)), this property is not supported and will default to 0. |\n| [severity](./ai.safetyrating.md#safetyratingseverity) | [HarmSeverity](./ai.md#harmseverity) | The harm severity level.This property is only supported when using the Vertex AI Gemini API ([VertexAIBackend](./ai.vertexaibackend.md#vertexaibackend_class)). When using the Gemini Developer API ([GoogleAIBackend](./ai.googleaibackend.md#googleaibackend_class)), this property is not supported and will default to `HarmSeverity.UNSUPPORTED`. |\n| [severityScore](./ai.safetyrating.md#safetyratingseverityscore) | number | The severity score of the harm category.This property is only supported when using the Vertex AI Gemini API ([VertexAIBackend](./ai.vertexaibackend.md#vertexaibackend_class)). When using the Gemini Developer API ([GoogleAIBackend](./ai.googleaibackend.md#googleaibackend_class)), this property is not supported and will default to 0. |\n\nSafetyRating.blocked\n--------------------\n\n**Signature:** \n\n blocked: boolean;\n\nSafetyRating.category\n---------------------\n\n**Signature:** \n\n category: HarmCategory;\n\nSafetyRating.probability\n------------------------\n\n**Signature:** \n\n probability: HarmProbability;\n\nSafetyRating.probabilityScore\n-----------------------------\n\nThe probability score of the harm category.\n\nThis property is only supported when using the Vertex AI Gemini API ([VertexAIBackend](./ai.vertexaibackend.md#vertexaibackend_class)). When using the Gemini Developer API ([GoogleAIBackend](./ai.googleaibackend.md#googleaibackend_class)), this property is not supported and will default to 0.\n\n**Signature:** \n\n probabilityScore: number;\n\nSafetyRating.severity\n---------------------\n\nThe harm severity level.\n\nThis property is only supported when using the Vertex AI Gemini API ([VertexAIBackend](./ai.vertexaibackend.md#vertexaibackend_class)). When using the Gemini Developer API ([GoogleAIBackend](./ai.googleaibackend.md#googleaibackend_class)), this property is not supported and will default to `HarmSeverity.UNSUPPORTED`.\n\n**Signature:** \n\n severity: HarmSeverity;\n\nSafetyRating.severityScore\n--------------------------\n\nThe severity score of the harm category.\n\nThis property is only supported when using the Vertex AI Gemini API ([VertexAIBackend](./ai.vertexaibackend.md#vertexaibackend_class)). When using the Gemini Developer API ([GoogleAIBackend](./ai.googleaibackend.md#googleaibackend_class)), this property is not supported and will default to 0.\n\n**Signature:** \n\n severityScore: number;"]]