Skip to content

Commit

Permalink
Adding new moderation model constants (#875)
Browse files Browse the repository at this point in the history
  • Loading branch information
Mhjacobs authored Oct 14, 2024
1 parent cfe15ff commit 21f7134
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
12 changes: 8 additions & 4 deletions moderation.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,10 @@ import (
// 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"
ModerationOmniLatest = "omni-moderation-latest"
ModerationOmni20240926 = "omni-moderation-2024-09-26"
ModerationTextStable = "text-moderation-stable"
ModerationTextLatest = "text-moderation-latest"
// Deprecated: use ModerationTextStable and ModerationTextLatest instead.
ModerationText001 = "text-moderation-001"
)
Expand All @@ -25,8 +27,10 @@ var (
)

var validModerationModel = map[string]struct{}{
ModerationTextStable: {},
ModerationTextLatest: {},
ModerationOmniLatest: {},
ModerationOmni20240926: {},
ModerationTextStable: {},
ModerationTextLatest: {},
}

// ModerationRequest represents a request structure for moderation API.
Expand Down
2 changes: 2 additions & 0 deletions moderation_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@ func TestModerationsWithDifferentModelOptions(t *testing.T) {
getModerationModelTestOption(openai.GPT3Dot5Turbo, openai.ErrModerationInvalidModel),
getModerationModelTestOption(openai.ModerationTextStable, nil),
getModerationModelTestOption(openai.ModerationTextLatest, nil),
getModerationModelTestOption(openai.ModerationOmni20240926, nil),
getModerationModelTestOption(openai.ModerationOmniLatest, nil),
getModerationModelTestOption("", nil),
)
client, server, teardown := setupOpenAITestServer()
Expand Down

0 comments on commit 21f7134

Please sign in to comment.