Anydoc / anydoc parser engine (push) Canceled after 0s
App / Format, vet, test, and build (push) Canceled after 0s
CLI / test (macos-latest / go 1.26) (push) Canceled after 0s
CLI / test (ubuntu-latest / go 1.26) (push) Canceled after 0s
CLI / test (windows-latest / go 1.26) (push) Canceled after 0s
Build and Push Docker Image / build-ui (push) Canceled after 0s
Build and Push Docker Image / build-docreader (push) Canceled after 0s
Build and Push Docker Image / build-sandbox (push) Canceled after 0s
Build and Push Docker Image / build-app (amd64, linux/amd64, ubuntu-latest) (push) Canceled after 0s
Build and Push Docker Image / build-app (arm64, linux/arm64, ubuntu-24.04-arm) (push) Canceled after 0s
DocReader / Python tests and Go client tests (push) Canceled after 0s
Build & Publish (dsh-weknora) / Typecheck, test, pack (push) Canceled after 0s
Build & Publish (dsh-weknora) / End-to-end inside dsh (pinned) (push) Canceled after 0s
Build & Publish (dsh-weknora) / End-to-end inside dsh (latest, advisory) (push) Canceled after 0s
Frontend / Test, type-check, and build (push) Canceled after 0s
Go Lint Cache / warm lint cache (.) (push) Canceled after 0s
Go Lint Cache / warm lint cache (cli) (push) Canceled after 0s
Go Lint Cache / warm lint cache (client) (push) Canceled after 0s
Build & Publish (mcp-server) / Test (Python 3.10) (push) Canceled after 0s
Build & Publish (mcp-server) / Test (Python 3.11) (push) Canceled after 0s
Build & Publish (mcp-server) / Test (Python 3.12) (push) Canceled after 0s
Build & Publish (mcp-server) / Test (Python 3.13) (push) Canceled after 0s
Build and Push Docker Image / merge (push) Canceled after 0s
Build & Publish (dsh-weknora) / Publish to npm (push) Canceled after 0s
Build & Publish (mcp-server) / Build sdist + wheel (push) Canceled after 0s
Build & Publish (mcp-server) / Publish to PyPI (push) Canceled after 0s
47 lines
1.3 KiB
Go
47 lines
1.3 KiB
Go
package provider
|
|
|
|
import "testing"
|
|
|
|
// TestIsOpenAIReasoningOrGPT5Model 验证 GPT-5 / o-series 模型识别逻辑。
|
|
// 见 issue #1283:这些模型必须使用 max_completion_tokens 替代 max_tokens。
|
|
func TestIsOpenAIReasoningOrGPT5Model(t *testing.T) {
|
|
cases := []struct {
|
|
name string
|
|
input string
|
|
want bool
|
|
}{
|
|
{"empty", "", false},
|
|
|
|
{"gpt-5", "gpt-5", true},
|
|
{"gpt-5-mini", "gpt-5-mini", true},
|
|
{"gpt-5.2", "gpt-5.2", true},
|
|
{"gpt-5.5-pro", "gpt-5.5-pro", true},
|
|
{"gpt-5 mixed case", "GPT-5.4-Mini", true},
|
|
|
|
{"o1", "o1", true},
|
|
{"o1-mini", "o1-mini", true},
|
|
{"o1-preview", "o1-preview", true},
|
|
{"o3", "o3", true},
|
|
{"o3-mini", "o3-mini", true},
|
|
{"o4-mini", "o4-mini", true},
|
|
|
|
{"gpt-4", "gpt-4", false},
|
|
{"gpt-4o", "gpt-4o", false},
|
|
{"gpt-4o-mini", "gpt-4o-mini", false},
|
|
{"gpt-3.5-turbo", "gpt-3.5-turbo", false},
|
|
|
|
{"name starting with 'o1' but not o-series", "olympus-1", false},
|
|
{"name starting with 'openai-'", "openai-gpt-4", false},
|
|
{"name starting with 'o3' but not o-series", "o3xtra", false},
|
|
{"random", "qwen-max", false},
|
|
}
|
|
for _, tc := range cases {
|
|
t.Run(tc.name, func(t *testing.T) {
|
|
got := IsOpenAIReasoningOrGPT5Model(tc.input)
|
|
if got != tc.want {
|
|
t.Errorf("IsOpenAIReasoningOrGPT5Model(%q) = %v, want %v", tc.input, got, tc.want)
|
|
}
|
|
})
|
|
}
|
|
}
|