Skip to content

Commit 85f578b

Browse files
authored
fix: remove validateO1Specific (#939)
* fix: remove validateO1Specific * update golangci-lint-action version * fix actions * fix actions * fix actions * fix actions * remove some o1 test
1 parent c0a9a75 commit 85f578b

File tree

3 files changed

+2
-68
lines changed

3 files changed

+2
-68
lines changed

.github/workflows/pr.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,9 @@ jobs:
1818
run: |
1919
go vet .
2020
- name: Run golangci-lint
21-
uses: golangci/golangci-lint-action@v4
21+
uses: golangci/golangci-lint-action@v6
2222
with:
23-
version: latest
23+
version: v1.63.4
2424
- name: Run tests
2525
run: go test -race -covermode=atomic -coverprofile=coverage.out -v .
2626
- name: Upload coverage reports to Codecov

chat_test.go

-34
Original file line numberDiff line numberDiff line change
@@ -106,40 +106,6 @@ func TestO1ModelsChatCompletionsBetaLimitations(t *testing.T) {
106106
},
107107
expectedError: openai.ErrReasoningModelLimitationsLogprobs,
108108
},
109-
{
110-
name: "message_type_unsupported",
111-
in: openai.ChatCompletionRequest{
112-
MaxCompletionTokens: 1000,
113-
Model: openai.O1Mini,
114-
Messages: []openai.ChatCompletionMessage{
115-
{
116-
Role: openai.ChatMessageRoleSystem,
117-
},
118-
},
119-
},
120-
expectedError: openai.ErrO1BetaLimitationsMessageTypes,
121-
},
122-
{
123-
name: "tool_unsupported",
124-
in: openai.ChatCompletionRequest{
125-
MaxCompletionTokens: 1000,
126-
Model: openai.O1Mini,
127-
Messages: []openai.ChatCompletionMessage{
128-
{
129-
Role: openai.ChatMessageRoleUser,
130-
},
131-
{
132-
Role: openai.ChatMessageRoleAssistant,
133-
},
134-
},
135-
Tools: []openai.Tool{
136-
{
137-
Type: openai.ToolTypeFunction,
138-
},
139-
},
140-
},
141-
expectedError: openai.ErrO1BetaLimitationsTools,
142-
},
143109
{
144110
name: "set_temperature_unsupported",
145111
in: openai.ChatCompletionRequest{

reasoning_validator.go

-32
Original file line numberDiff line numberDiff line change
@@ -28,16 +28,6 @@ var (
2828
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
2929
)
3030

31-
var unsupportedToolsForO1Models = map[ToolType]struct{}{
32-
ToolTypeFunction: {},
33-
}
34-
35-
var availableMessageRoleForO1Models = map[string]struct{}{
36-
ChatMessageRoleUser: {},
37-
ChatMessageRoleAssistant: {},
38-
ChatMessageRoleDeveloper: {},
39-
}
40-
4131
// ReasoningValidator handles validation for o-series model requests.
4232
type ReasoningValidator struct{}
4333

@@ -59,12 +49,6 @@ func (v *ReasoningValidator) Validate(request ChatCompletionRequest) error {
5949
return err
6050
}
6151

62-
if o1Series {
63-
if err := v.validateO1Specific(request); err != nil {
64-
return err
65-
}
66-
}
67-
6852
return nil
6953
}
7054

@@ -94,19 +78,3 @@ func (v *ReasoningValidator) validateReasoningModelParams(request ChatCompletion
9478

9579
return nil
9680
}
97-
98-
// validateO1Specific checks O1-specific limitations.
99-
func (v *ReasoningValidator) validateO1Specific(request ChatCompletionRequest) error {
100-
for _, m := range request.Messages {
101-
if _, found := availableMessageRoleForO1Models[m.Role]; !found {
102-
return ErrO1BetaLimitationsMessageTypes
103-
}
104-
}
105-
106-
for _, t := range request.Tools {
107-
if _, found := unsupportedToolsForO1Models[t.Type]; found {
108-
return ErrO1BetaLimitationsTools
109-
}
110-
}
111-
return nil
112-
}

0 commit comments

Comments
 (0)