Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Builder ¶
type Builder interface {
AddImage(url string) Builder
AddText(text string) Builder
Clear() Builder
Execute() ([]*Result, error)
SetMinConfidence(minPercent int) Builder
}
Builder is a builder for the Moderation API.
type Result ¶
type Result struct {
Flagged bool `json:"flagged"`
Categories map[string]bool `json:"categories"`
CategoryScores map[string]float64 `json:"category_scores"`
CategoryAppliedInputTypes map[string][]string `json:"category_applied_input_types"`
// filled by us for convenience
Input string `json:"-"`
}
Result is a single result of the Moderation API, includes the input, whether it was flagged and moderation categories with their scores.
func (*Result) WithConfidence ¶
WithConfidence checks if the result passes the confidence threshold. If not, it sets the result as not flagged. Categories with low confidence are removed from the result.
Click to show internal directories.
Click to hide internal directories.