Skip to content

Commit

Permalink
Allow streaming for O1 model family
Browse files Browse the repository at this point in the history
Signed-off-by: Eduard Diachenko <[email protected]>
  • Loading branch information
handsomefox committed Nov 19, 2024
1 parent 6d066bb commit 851ea2a
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 9 deletions.
4 changes: 2 additions & 2 deletions chat_stream_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,8 @@ func TestChatCompletionsStreamWithO1BetaLimitations(t *testing.T) {
},
}
_, err := client.CreateChatCompletionStream(ctx, req)
if !errors.Is(err, openai.ErrO1BetaLimitationsStreaming) {
t.Fatalf("CreateChatCompletion should return ErrO1BetaLimitationsStreaming, but returned: %v", err)
if err != nil {
t.Fatalf("CreateChatCompletionStream should not return error, but returned: %v", err)
}
}

Expand Down
7 changes: 0 additions & 7 deletions completion.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ var (

var (
ErrO1BetaLimitationsMessageTypes = errors.New("this model has beta-limitations, user and assistant messages only, system messages are not supported") //nolint:lll
ErrO1BetaLimitationsStreaming = errors.New("this model has beta-limitations, streaming not supported") //nolint:lll
ErrO1BetaLimitationsTools = errors.New("this model has beta-limitations, tools, function calling, and response format parameters are not supported") //nolint:lll
ErrO1BetaLimitationsLogprobs = errors.New("this model has beta-limitations, logprobs not supported") //nolint:lll
ErrO1BetaLimitationsOther = 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
Expand Down Expand Up @@ -199,12 +198,6 @@ func validateRequestForO1Models(request ChatCompletionRequest) error {
return ErrO1MaxTokensDeprecated
}

// Beta Limitations
// refs:https://platform.openai.com/docs/guides/reasoning/beta-limitations
// Streaming: not supported
if request.Stream {
return ErrO1BetaLimitationsStreaming
}
// Logprobs: not supported.
if request.LogProbs {
return ErrO1BetaLimitationsLogprobs
Expand Down

0 comments on commit 851ea2a

Please sign in to comment.