#[non_exhaustive]pub struct SafetySetting {
pub category: HarmCategory,
pub threshold: HarmBlockThreshold,
pub method: HarmBlockMethod,
/* private fields */
}Available on crate feature
prediction-service only.Expand description
Safety settings.
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: HarmCategoryRequired. Harm category.
threshold: HarmBlockThresholdRequired. The harm block threshold.
method: HarmBlockMethodOptional. Specify if the threshold is used for probability or severity score. If not specified, the threshold is used for probability score.
Implementations§
Source§impl SafetySetting
impl SafetySetting
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 = SafetySetting::new().set_category(HarmCategory::HateSpeech);
let x1 = SafetySetting::new().set_category(HarmCategory::DangerousContent);
let x2 = SafetySetting::new().set_category(HarmCategory::Harassment);Sourcepub fn set_threshold<T: Into<HarmBlockThreshold>>(self, v: T) -> Self
pub fn set_threshold<T: Into<HarmBlockThreshold>>(self, v: T) -> Self
Sets the value of threshold.
§Example
ⓘ
use google_cloud_aiplatform_v1::model::safety_setting::HarmBlockThreshold;
let x0 = SafetySetting::new().set_threshold(HarmBlockThreshold::BlockLowAndAbove);
let x1 = SafetySetting::new().set_threshold(HarmBlockThreshold::BlockMediumAndAbove);
let x2 = SafetySetting::new().set_threshold(HarmBlockThreshold::BlockOnlyHigh);Sourcepub fn set_method<T: Into<HarmBlockMethod>>(self, v: T) -> Self
pub fn set_method<T: Into<HarmBlockMethod>>(self, v: T) -> Self
Trait Implementations§
Source§impl Clone for SafetySetting
impl Clone for SafetySetting
Source§fn clone(&self) -> SafetySetting
fn clone(&self) -> SafetySetting
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 SafetySetting
impl Debug for SafetySetting
Source§impl Default for SafetySetting
impl Default for SafetySetting
Source§fn default() -> SafetySetting
fn default() -> SafetySetting
Returns the “default value” for a type. Read more
Source§impl Message for SafetySetting
impl Message for SafetySetting
Source§impl PartialEq for SafetySetting
impl PartialEq for SafetySetting
impl StructuralPartialEq for SafetySetting
Auto Trait Implementations§
impl Freeze for SafetySetting
impl RefUnwindSafe for SafetySetting
impl Send for SafetySetting
impl Sync for SafetySetting
impl Unpin for SafetySetting
impl UnwindSafe for SafetySetting
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