From 635bf0258c6f117f7f5964054c7ed743d43e1eea Mon Sep 17 00:00:00 2001 From: liushuang Date: Sat, 15 Feb 2025 18:30:12 +0800 Subject: [PATCH 1/7] fix: remove validateO1Specific --- reasoning_validator.go | 32 -------------------------------- 1 file changed, 32 deletions(-) diff --git a/reasoning_validator.go b/reasoning_validator.go index 4d4671b1..040d6b49 100644 --- a/reasoning_validator.go +++ b/reasoning_validator.go @@ -28,16 +28,6 @@ var ( ErrReasoningModelLimitationsOther = errors.New("this model has beta-limitations, temperature, top_p and n are fixed at 1, while presence_penalty and frequency_penalty are fixed at 0") //nolint:lll ) -var unsupportedToolsForO1Models = map[ToolType]struct{}{ - ToolTypeFunction: {}, -} - -var availableMessageRoleForO1Models = map[string]struct{}{ - ChatMessageRoleUser: {}, - ChatMessageRoleAssistant: {}, - ChatMessageRoleDeveloper: {}, -} - // ReasoningValidator handles validation for o-series model requests. type ReasoningValidator struct{} @@ -59,12 +49,6 @@ func (v *ReasoningValidator) Validate(request ChatCompletionRequest) error { return err } - if o1Series { - if err := v.validateO1Specific(request); err != nil { - return err - } - } - return nil } @@ -94,19 +78,3 @@ func (v *ReasoningValidator) validateReasoningModelParams(request ChatCompletion return nil } - -// validateO1Specific checks O1-specific limitations. -func (v *ReasoningValidator) validateO1Specific(request ChatCompletionRequest) error { - for _, m := range request.Messages { - if _, found := availableMessageRoleForO1Models[m.Role]; !found { - return ErrO1BetaLimitationsMessageTypes - } - } - - for _, t := range request.Tools { - if _, found := unsupportedToolsForO1Models[t.Type]; found { - return ErrO1BetaLimitationsTools - } - } - return nil -} From c16ec8112463ed72e9ee8939f488db903c826dd2 Mon Sep 17 00:00:00 2001 From: liushuang Date: Sat, 15 Feb 2025 18:48:06 +0800 Subject: [PATCH 2/7] update golangci-lint-action version --- .github/workflows/pr.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/pr.yml b/.github/workflows/pr.yml index a41fff92..ee7324de 100644 --- a/.github/workflows/pr.yml +++ b/.github/workflows/pr.yml @@ -18,7 +18,7 @@ jobs: run: | go vet . - name: Run golangci-lint - uses: golangci/golangci-lint-action@v4 + uses: golangci/golangci-lint-action@v6 with: version: latest - name: Run tests From 967f06c78522d76d27b4f6cd5239323d4e188b1a Mon Sep 17 00:00:00 2001 From: liushuang Date: Sat, 15 Feb 2025 19:02:38 +0800 Subject: [PATCH 3/7] fix actions --- .github/workflows/pr.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/pr.yml b/.github/workflows/pr.yml index ee7324de..72511c87 100644 --- a/.github/workflows/pr.yml +++ b/.github/workflows/pr.yml @@ -13,7 +13,7 @@ jobs: - name: Setup Go uses: actions/setup-go@v5 with: - go-version: '1.21' + go-version: '1.22' - name: Run vet run: | go vet . From 83e8adb8ec48af6e0128eceb6db01f5ce08096f3 Mon Sep 17 00:00:00 2001 From: liushuang Date: Sat, 15 Feb 2025 19:12:40 +0800 Subject: [PATCH 4/7] fix actions --- .github/workflows/pr.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.github/workflows/pr.yml b/.github/workflows/pr.yml index 72511c87..060c30f8 100644 --- a/.github/workflows/pr.yml +++ b/.github/workflows/pr.yml @@ -19,8 +19,6 @@ jobs: go vet . - name: Run golangci-lint uses: golangci/golangci-lint-action@v6 - with: - version: latest - name: Run tests run: go test -race -covermode=atomic -coverprofile=coverage.out -v . - name: Upload coverage reports to Codecov From ba53408ab576655ab05bc5fa5cd1cd6846d2a8ca Mon Sep 17 00:00:00 2001 From: liushuang Date: Sat, 15 Feb 2025 19:22:04 +0800 Subject: [PATCH 5/7] fix actions --- .github/workflows/pr.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/pr.yml b/.github/workflows/pr.yml index 060c30f8..20ef76d3 100644 --- a/.github/workflows/pr.yml +++ b/.github/workflows/pr.yml @@ -13,12 +13,14 @@ jobs: - name: Setup Go uses: actions/setup-go@v5 with: - go-version: '1.22' + go-version: '1.21' - name: Run vet run: | go vet . - name: Run golangci-lint uses: golangci/golangci-lint-action@v6 + with: + version: v1.64.4 - name: Run tests run: go test -race -covermode=atomic -coverprofile=coverage.out -v . - name: Upload coverage reports to Codecov From 37627ec41e32c32cb440094eda161f2482e63a48 Mon Sep 17 00:00:00 2001 From: liushuang Date: Sat, 15 Feb 2025 19:24:25 +0800 Subject: [PATCH 6/7] fix actions --- .github/workflows/pr.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/pr.yml b/.github/workflows/pr.yml index 20ef76d3..ea0c327f 100644 --- a/.github/workflows/pr.yml +++ b/.github/workflows/pr.yml @@ -20,7 +20,7 @@ jobs: - name: Run golangci-lint uses: golangci/golangci-lint-action@v6 with: - version: v1.64.4 + version: v1.63.4 - name: Run tests run: go test -race -covermode=atomic -coverprofile=coverage.out -v . - name: Upload coverage reports to Codecov From aa8f40891c154a9245fca21f9f5056c4f89a137d Mon Sep 17 00:00:00 2001 From: liushuang Date: Sat, 15 Feb 2025 19:28:45 +0800 Subject: [PATCH 7/7] remove some o1 test --- chat_test.go | 34 ---------------------------------- 1 file changed, 34 deletions(-) diff --git a/chat_test.go b/chat_test.go index fc6c4a93..e90142da 100644 --- a/chat_test.go +++ b/chat_test.go @@ -106,40 +106,6 @@ func TestO1ModelsChatCompletionsBetaLimitations(t *testing.T) { }, expectedError: openai.ErrReasoningModelLimitationsLogprobs, }, - { - name: "message_type_unsupported", - in: openai.ChatCompletionRequest{ - MaxCompletionTokens: 1000, - Model: openai.O1Mini, - Messages: []openai.ChatCompletionMessage{ - { - Role: openai.ChatMessageRoleSystem, - }, - }, - }, - expectedError: openai.ErrO1BetaLimitationsMessageTypes, - }, - { - name: "tool_unsupported", - in: openai.ChatCompletionRequest{ - MaxCompletionTokens: 1000, - Model: openai.O1Mini, - Messages: []openai.ChatCompletionMessage{ - { - Role: openai.ChatMessageRoleUser, - }, - { - Role: openai.ChatMessageRoleAssistant, - }, - }, - Tools: []openai.Tool{ - { - Type: openai.ToolTypeFunction, - }, - }, - }, - expectedError: openai.ErrO1BetaLimitationsTools, - }, { name: "set_temperature_unsupported", in: openai.ChatCompletionRequest{