Back to Firebase Js Sdk

SafetyRating interface

docs-devsite/ai.safetyrating.md

12.12.13.8 KB
Original Source

Project: /docs/reference/js/_project.yaml Book: /docs/reference/_book.yaml page_type: reference

{% comment %} DO NOT EDIT THIS FILE! This is generated by the JS SDK team, and any local changes will be overwritten. Changes should be made in the source code at https://github.com/firebase/firebase-js-sdk {% endcomment %}

SafetyRating interface

A safety rating associated with a GenerateContentCandidate

<b>Signature:</b>

typescript
export interface SafetyRating 

Properties

PropertyTypeDescription
blockedboolean
categoryHarmCategory
probabilityHarmProbability
probabilityScorenumberThe 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.
severityHarmSeverityThe 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 <code>HarmSeverity.UNSUPPORTED</code>.
severityScorenumberThe 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

<b>Signature:</b>

typescript
blocked: boolean;

SafetyRating.category

<b>Signature:</b>

typescript
category: HarmCategory;

SafetyRating.probability

<b>Signature:</b>

typescript
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.

<b>Signature:</b>

typescript
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<!-- -->.

<b>Signature:</b>

typescript
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.

<b>Signature:</b>

typescript
severityScore: number;