moderation

package
v1.11.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 19, 2025 License: CC0-1.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Categories

type Categories struct {
	Hate            bool `json:"hate"`
	HateThreatening bool `json:"hate/threatening"`
	SelfHarm        bool `json:"self-harm"`
	Sexual          bool `json:"sexual"`
	SexualMinors    bool `json:"sexual/minors"`
	Violence        bool `json:"violence"`
	ViolenceGraphic bool `json:"violence/graphic"`
}

type CategoryScores

type CategoryScores struct {
	Hate            float64 `json:"hate"`
	HateThreatening float64 `json:"hate/threatening"`
	SelfHarm        float64 `json:"self-harm"`
	Sexual          float64 `json:"sexual"`
	SexualMinors    float64 `json:"sexual/minors"`
	Violence        float64 `json:"violence"`
	ViolenceGraphic float64 `json:"violence/graphic"`
}

type Client

type Client struct {
	// contains filtered or unexported fields
}

func New added in v1.9.0

func New(httpCli *http.Client, apiKey string) *Client

func (Client) Check

func (c Client) Check(ctx context.Context, input string) (*Response, error)

type Request

type Request struct {
	Input string `json:"input"`
}

type Response

type Response struct {
	ID      string    `json:"id"`
	Model   string    `json:"model"`
	Results []Results `json:"results"`
}

func (Response) Flagged added in v1.7.0

func (r Response) Flagged() bool

func (Response) Reasons added in v1.7.0

func (r Response) Reasons() string

type Results

type Results struct {
	Categories     Categories     `json:"categories"`
	CategoryScores CategoryScores `json:"category_scores"`
	Flagged        bool           `json:"flagged"`
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL