Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding new moderation model constants #875

Merged
merged 1 commit into from
Oct 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading