NAME
Google::Ai::Generativelanguage::V1beta::Safety - Compiled Protocol Buffers messages for google/ai/generativelanguage/v1beta/safety.proto
SYNOPSIS
use Google::Ai::Generativelanguage::V1beta::Safety;
my $msg = Google::Ai::Generativelanguage::V1beta::Safety::ContentFilter->new({
reason => $reason,
message => $message,
});
# Read or update a field
my $val = $msg->reason();
# Binary wire-format roundtrip
my $bytes = $msg->serialize();
my $decoded = Google::Ai::Generativelanguage::V1beta::Safety::ContentFilter->parse($bytes);
# Canonical ProtoJSON
my $json = $msg->to_json();
DESCRIPTION
Auto-generated Protobuf message classes compiled from google/ai/generativelanguage/v1beta/safety.proto. All message classes inherit from Protobuf::Message and support new(), serialize(), parse(), to_json(), from_json(), to_text(), and to_perl().
MESSAGES
Google::Ai::Generativelanguage::V1beta::Safety::ContentFilter
Content filtering metadata associated with processing a single request.
ContentFilter contains a reason and an optional supporting string. The reason may be unspecified.
Inherits from Protobuf::Message.
Accessors
$msg->reason()/$msg->reason($value)Type:
Enum(Google::Ai::Generativelanguage::V1beta::ContentFilter::BlockedReason)The reason content was blocked during request processing.
$msg->message()/$msg->message($value)Type:
StringA string that describes the filtering behavior in more detail.
Enum: ContentFilter::BlockedReason
BLOCKED_REASON_UNSPECIFIED=>0SAFETY=>1OTHER=>2
Google::Ai::Generativelanguage::V1beta::Safety::SafetyFeedback
Safety feedback for an entire request.
This field is populated if content in the input and/or response is blocked due to safety settings. SafetyFeedback may not exist for every HarmCategory. Each SafetyFeedback will return the safety settings used by the request as well as the lowest HarmProbability that should be allowed in order to return a result.
Inherits from Protobuf::Message.
Accessors
$msg->rating()/$msg->rating($value)Type:
Message(Google::Ai::Generativelanguage::V1beta::Safety::SafetyRating)Safety rating evaluated from content.
$msg->setting()/$msg->setting($value)Type:
Message(Google::Ai::Generativelanguage::V1beta::Safety::SafetySetting)Safety settings applied to the request.
Google::Ai::Generativelanguage::V1beta::Safety::SafetyRating
Safety rating for a piece of content.
The safety rating contains the category of harm and the harm probability level in that category for a piece of content. Content is classified for safety across a number of harm categories and the probability of the harm classification is included here.
Inherits from Protobuf::Message.
Accessors
$msg->category()/$msg->category($value)Type:
Enum(Google::Ai::Generativelanguage::V1beta::HarmCategory)Required. The category for this rating.
$msg->probability()/$msg->probability($value)Type:
Enum(Google::Ai::Generativelanguage::V1beta::SafetyRating::HarmProbability)Required. The probability of harm for this content.
$msg->blocked()/$msg->blocked($value)Type:
BoolWas this content blocked because of this rating?
Enum: SafetyRating::HarmProbability
HARM_PROBABILITY_UNSPECIFIED=>0NEGLIGIBLE=>1LOW=>2MEDIUM=>3HIGH=>4
Google::Ai::Generativelanguage::V1beta::Safety::SafetySetting
Safety setting, affecting the safety-blocking behavior.
Passing a safety setting for a category changes the allowed probability that content is blocked.
Inherits from Protobuf::Message.
Accessors
$msg->category()/$msg->category($value)Type:
Enum(Google::Ai::Generativelanguage::V1beta::HarmCategory)Required. The category for this setting.
$msg->threshold()/$msg->threshold($value)Type:
Enum(Google::Ai::Generativelanguage::V1beta::SafetySetting::HarmBlockThreshold)Required. Controls the probability threshold at which harm is blocked.
Enum: SafetySetting::HarmBlockThreshold
HARM_BLOCK_THRESHOLD_UNSPECIFIED=>0BLOCK_LOW_AND_ABOVE=>1BLOCK_MEDIUM_AND_ABOVE=>2BLOCK_ONLY_HIGH=>3BLOCK_NONE=>4OFF=>5
SEE ALSO
Protobuf, Protobuf::Message, Google::Ai::Generativelanguage::V1beta::Safety::Types, https://protobuf.dev/
LICENSE AND COPYRIGHT
Copyright (C) 2026 Google LLC
This program is released under the Apache 2.0 license.