diff --git a/moderation.go b/moderation.go index ff789a6..b386ddb 100644 --- a/moderation.go +++ b/moderation.go @@ -5,10 +5,23 @@ import ( "net/http" ) +// The moderation endpoint is a tool you can use to check whether content complies with OpenAI's usage policies. +// Developers can thus identify content that our usage policies prohibits and take action, for instance by filtering it. + +// The default is text-moderation-latest which will be automatically upgraded over time. +// This ensures you are always using our most accurate model. +// If you use text-moderation-stable, we will provide advanced notice before updating the model. +// Accuracy of text-moderation-stable may be slightly lower than for text-moderation-latest. +const ( + ModerationTextStable = "text-moderation-stable" + ModerationTextLatest = "text-moderation-latest" + ModerationText001 = "text-moderation-001" +) + // ModerationRequest represents a request structure for moderation API. type ModerationRequest struct { - Input string `json:"input,omitempty"` - Model *string `json:"model,omitempty"` + Input string `json:"input,omitempty"` + Model string `json:"model,omitempty"` } // Result represents one of possible moderation results. diff --git a/moderation_test.go b/moderation_test.go index 3535bc8..2c11456 100644 --- a/moderation_test.go +++ b/moderation_test.go @@ -34,7 +34,7 @@ func TestModerations(t *testing.T) { // create an edit request model := "text-moderation-stable" moderationReq := ModerationRequest{ - Model: &model, + Model: model, Input: "I want to kill them.", } _, err = client.Moderations(ctx, moderationReq) @@ -77,7 +77,7 @@ func handleModerationEndpoint(w http.ResponseWriter, r *http.Request) { res := ModerationResponse{ ID: strconv.Itoa(int(time.Now().Unix())), - Model: *moderationReq.Model, + Model: moderationReq.Model, } res.Results = append(res.Results, result)