Adding new moderation model constants (#875)
This commit is contained in:
@@ -14,8 +14,10 @@ import (
|
|||||||
// If you use text-moderation-stable, we will provide advanced notice before updating the 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.
|
// Accuracy of text-moderation-stable may be slightly lower than for text-moderation-latest.
|
||||||
const (
|
const (
|
||||||
ModerationTextStable = "text-moderation-stable"
|
ModerationOmniLatest = "omni-moderation-latest"
|
||||||
ModerationTextLatest = "text-moderation-latest"
|
ModerationOmni20240926 = "omni-moderation-2024-09-26"
|
||||||
|
ModerationTextStable = "text-moderation-stable"
|
||||||
|
ModerationTextLatest = "text-moderation-latest"
|
||||||
// Deprecated: use ModerationTextStable and ModerationTextLatest instead.
|
// Deprecated: use ModerationTextStable and ModerationTextLatest instead.
|
||||||
ModerationText001 = "text-moderation-001"
|
ModerationText001 = "text-moderation-001"
|
||||||
)
|
)
|
||||||
@@ -25,8 +27,10 @@ var (
|
|||||||
)
|
)
|
||||||
|
|
||||||
var validModerationModel = map[string]struct{}{
|
var validModerationModel = map[string]struct{}{
|
||||||
ModerationTextStable: {},
|
ModerationOmniLatest: {},
|
||||||
ModerationTextLatest: {},
|
ModerationOmni20240926: {},
|
||||||
|
ModerationTextStable: {},
|
||||||
|
ModerationTextLatest: {},
|
||||||
}
|
}
|
||||||
|
|
||||||
// ModerationRequest represents a request structure for moderation API.
|
// ModerationRequest represents a request structure for moderation API.
|
||||||
|
|||||||
@@ -37,6 +37,8 @@ func TestModerationsWithDifferentModelOptions(t *testing.T) {
|
|||||||
getModerationModelTestOption(openai.GPT3Dot5Turbo, openai.ErrModerationInvalidModel),
|
getModerationModelTestOption(openai.GPT3Dot5Turbo, openai.ErrModerationInvalidModel),
|
||||||
getModerationModelTestOption(openai.ModerationTextStable, nil),
|
getModerationModelTestOption(openai.ModerationTextStable, nil),
|
||||||
getModerationModelTestOption(openai.ModerationTextLatest, nil),
|
getModerationModelTestOption(openai.ModerationTextLatest, nil),
|
||||||
|
getModerationModelTestOption(openai.ModerationOmni20240926, nil),
|
||||||
|
getModerationModelTestOption(openai.ModerationOmniLatest, nil),
|
||||||
getModerationModelTestOption("", nil),
|
getModerationModelTestOption("", nil),
|
||||||
)
|
)
|
||||||
client, server, teardown := setupOpenAITestServer()
|
client, server, teardown := setupOpenAITestServer()
|
||||||
|
|||||||
Reference in New Issue
Block a user