#[non_exhaustive]pub struct SafetyRating {
pub category: HarmCategory,
pub probability: HarmProbability,
pub probability_score: f32,
pub severity: HarmSeverity,
pub severity_score: f32,
pub blocked: bool,
/* private fields */
}Available on crate feature
prediction-service only.Expand description
Safety rating corresponding to the generated content.
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Non-exhaustive structs could have additional fields added in future. Therefore, non-exhaustive structs cannot be constructed in external crates using the traditional
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.category: HarmCategoryOutput only. Harm category.
probability: HarmProbabilityOutput only. Harm probability levels in the content.
probability_score: f32Output only. Harm probability score.
severity: HarmSeverityOutput only. Harm severity levels in the content.
severity_score: f32Output only. Harm severity score.
blocked: boolOutput only. Indicates whether the content was filtered out because of this rating.
Implementations§
Source§impl SafetyRating
impl SafetyRating
pub fn new() -> Self
Sourcepub fn set_category<T: Into<HarmCategory>>(self, v: T) -> Self
pub fn set_category<T: Into<HarmCategory>>(self, v: T) -> Self
Sets the value of category.
§Example
ⓘ
use google_cloud_aiplatform_v1::model::HarmCategory;
let x0 = SafetyRating::new().set_category(HarmCategory::HateSpeech);
let x1 = SafetyRating::new().set_category(HarmCategory::DangerousContent);
let x2 = SafetyRating::new().set_category(HarmCategory::Harassment);Sourcepub fn set_probability<T: Into<HarmProbability>>(self, v: T) -> Self
pub fn set_probability<T: Into<HarmProbability>>(self, v: T) -> Self
Sets the value of probability.
§Example
ⓘ
use google_cloud_aiplatform_v1::model::safety_rating::HarmProbability;
let x0 = SafetyRating::new().set_probability(HarmProbability::Negligible);
let x1 = SafetyRating::new().set_probability(HarmProbability::Low);
let x2 = SafetyRating::new().set_probability(HarmProbability::Medium);Sourcepub fn set_probability_score<T: Into<f32>>(self, v: T) -> Self
pub fn set_probability_score<T: Into<f32>>(self, v: T) -> Self
Sets the value of probability_score.
§Example
ⓘ
let x = SafetyRating::new().set_probability_score(42.0);Sourcepub fn set_severity<T: Into<HarmSeverity>>(self, v: T) -> Self
pub fn set_severity<T: Into<HarmSeverity>>(self, v: T) -> Self
Sets the value of severity.
§Example
ⓘ
use google_cloud_aiplatform_v1::model::safety_rating::HarmSeverity;
let x0 = SafetyRating::new().set_severity(HarmSeverity::Negligible);
let x1 = SafetyRating::new().set_severity(HarmSeverity::Low);
let x2 = SafetyRating::new().set_severity(HarmSeverity::Medium);Sourcepub fn set_severity_score<T: Into<f32>>(self, v: T) -> Self
pub fn set_severity_score<T: Into<f32>>(self, v: T) -> Self
Trait Implementations§
Source§impl Clone for SafetyRating
impl Clone for SafetyRating
Source§fn clone(&self) -> SafetyRating
fn clone(&self) -> SafetyRating
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for SafetyRating
impl Debug for SafetyRating
Source§impl Default for SafetyRating
impl Default for SafetyRating
Source§fn default() -> SafetyRating
fn default() -> SafetyRating
Returns the “default value” for a type. Read more
Source§impl Message for SafetyRating
impl Message for SafetyRating
Source§impl PartialEq for SafetyRating
impl PartialEq for SafetyRating
impl StructuralPartialEq for SafetyRating
Auto Trait Implementations§
impl Freeze for SafetyRating
impl RefUnwindSafe for SafetyRating
impl Send for SafetyRating
impl Sync for SafetyRating
impl Unpin for SafetyRating
impl UnwindSafe for SafetyRating
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more