feat(models): expand supported reasoning levels for Codex
- Added new reasoning levels: `none`, `minimal`, and `unsupported` to Codex model configurations. - Introduced metadata sanitization and normalization for reasoning levels in API response. - Extended unit tests to cover reasoning levels validation and metadata sanitation logic.
This commit is contained in:
@@ -263,7 +263,7 @@ func TestModelsWithClientVersionReturnsCodexCatalog(t *testing.T) {
|
||||
DisplayName: "Custom Codex Model",
|
||||
Description: "Custom model from registry",
|
||||
ContextLength: 123456,
|
||||
Thinking: ®istry.ThinkingSupport{Levels: []string{"low", "medium"}},
|
||||
Thinking: ®istry.ThinkingSupport{Levels: []string{"none", "minimal", "low", "medium", "unsupported", "high", "xhigh"}},
|
||||
},
|
||||
{ID: "grok-imagine-image-quality", Object: "model", OwnedBy: "xai", Type: "openai"},
|
||||
{ID: "gpt-image-2", Object: "model", OwnedBy: "openai", Type: "openai"},
|
||||
@@ -334,6 +334,7 @@ func TestModelsWithClientVersionReturnsCodexCatalog(t *testing.T) {
|
||||
if got, _ := custom["context_window"].(float64); got != 123456 {
|
||||
t.Fatalf("custom context_window = %v, want 123456", custom["context_window"])
|
||||
}
|
||||
assertCodexSupportedReasoningLevels(t, custom, []string{"none", "low", "medium", "high", "xhigh"})
|
||||
if custom["base_instructions"] != gpt55["base_instructions"] {
|
||||
t.Fatal("expected custom model to use gpt-5.5 base_instructions fallback")
|
||||
}
|
||||
@@ -376,6 +377,27 @@ func TestModelsWithClientVersionReturnsCodexCatalog(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
func assertCodexSupportedReasoningLevels(t *testing.T, model map[string]any, want []string) {
|
||||
t.Helper()
|
||||
|
||||
rawLevels, ok := model["supported_reasoning_levels"].([]any)
|
||||
if !ok {
|
||||
t.Fatalf("expected supported_reasoning_levels, got %#v", model["supported_reasoning_levels"])
|
||||
}
|
||||
if len(rawLevels) != len(want) {
|
||||
t.Fatalf("supported_reasoning_levels length = %d, want %d: %#v", len(rawLevels), len(want), rawLevels)
|
||||
}
|
||||
for index, rawLevel := range rawLevels {
|
||||
levelEntry, ok := rawLevel.(map[string]any)
|
||||
if !ok {
|
||||
t.Fatalf("supported_reasoning_levels[%d] = %#v, want object", index, rawLevel)
|
||||
}
|
||||
if got, _ := levelEntry["effort"].(string); got != want[index] {
|
||||
t.Fatalf("supported_reasoning_levels[%d].effort = %q, want %q", index, got, want[index])
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func TestDefaultRequestLoggerFactory_UsesResolvedLogDirectory(t *testing.T) {
|
||||
t.Setenv("WRITABLE_PATH", "")
|
||||
t.Setenv("writable_path", "")
|
||||
|
||||
Reference in New Issue
Block a user