pub struct ModerationResponse {
pub flagged: bool,
pub categories: ModerationCategories,
pub category_scores: ModerationScores,
pub model: String,
}Expand description
Response from a moderation request.
Fields§
§flagged: boolWhether any content was flagged.
categories: ModerationCategoriesCategory flags indicating which categories were triggered.
category_scores: ModerationScoresCategory scores (0.0 to 1.0).
model: StringModel used for moderation.
Implementations§
Source§impl ModerationResponse
impl ModerationResponse
Sourcepub fn with_model(self, model: impl Into<String>) -> Self
pub fn with_model(self, model: impl Into<String>) -> Self
Set the model name.
Sourcepub fn with_categories(self, categories: ModerationCategories) -> Self
pub fn with_categories(self, categories: ModerationCategories) -> Self
Set category flags.
Sourcepub fn with_scores(self, scores: ModerationScores) -> Self
pub fn with_scores(self, scores: ModerationScores) -> Self
Set category scores.
Sourcepub fn flagged_categories(&self) -> Vec<&'static str>
pub fn flagged_categories(&self) -> Vec<&'static str>
Get a list of flagged category names.
Trait Implementations§
Source§impl Clone for ModerationResponse
impl Clone for ModerationResponse
Source§fn clone(&self) -> ModerationResponse
fn clone(&self) -> ModerationResponse
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 moreAuto Trait Implementations§
impl Freeze for ModerationResponse
impl RefUnwindSafe for ModerationResponse
impl Send for ModerationResponse
impl Sync for ModerationResponse
impl Unpin for ModerationResponse
impl UnwindSafe for ModerationResponse
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