SafetySetting interface
Stay organized with collections
Save and categorize content based on your preferences.
Safety setting that can be sent as part of request parameters.
Signature:
export interface SafetySetting
Properties
SafetySetting.category
Signature:
category: HarmCategory;
SafetySetting.method
The harm block method.
This property is only supported in the Vertex AI Gemini API (VertexAIBackend). When using the Gemini Developer API (GoogleAIBackend), an AIError will be thrown if this property is defined.
Signature:
method?: HarmBlockMethod;
SafetySetting.threshold
Signature:
threshold: HarmBlockThreshold;
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2025-05-20 UTC.
[null,null,["Last updated 2025-05-20 UTC."],[],[],null,["Safety setting that can be sent as part of request parameters.\n\n**Signature:** \n\n export interface SafetySetting \n\nProperties\n\nSafetySetting.category\n\n**Signature:** \n\n category: HarmCategory;\n\nSafetySetting.method\n\nThe harm block method.\n\nThis property is only supported in the Vertex AI Gemini API ([VertexAIBackend](./ai.vertexaibackend.md#vertexaibackend_class)). When using the Gemini Developer API ([GoogleAIBackend](./ai.googleaibackend.md#googleaibackend_class)), an [AIError](./ai.aierror.md#aierror_class) will be thrown if this property is defined.\n\n**Signature:** \n\n method?: HarmBlockMethod;\n\nSafetySetting.threshold\n\n**Signature:** \n\n threshold: HarmBlockThreshold;"]]