SafetyRating interface

A safety rating associated with a GenerateContentCandidate

Signature:

export interface SafetyRating 

Properties

Property Type Description
blocked boolean
category HarmCategory
probability HarmProbability
probabilityScore number 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.
severity HarmSeverity 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.
severityScore number 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.

Signature:

severityScore: number;