set maxcompletiontokens (#1260)

This commit is contained in:
Mike Sawka 2024-11-11 10:52:59 -08:00 committed by GitHub
parent 3a21d3183c
commit 38eeba5bd2
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -264,10 +264,11 @@ func RunLocalCompletionStream(ctx context.Context, request wshrpc.OpenAiStreamRe
} }
client := openaiapi.NewClientWithConfig(clientConfig) client := openaiapi.NewClientWithConfig(clientConfig)
req := openaiapi.ChatCompletionRequest{ req := openaiapi.ChatCompletionRequest{
Model: request.Opts.Model, Model: request.Opts.Model,
Messages: ConvertPrompt(request.Prompt), Messages: ConvertPrompt(request.Prompt),
MaxTokens: request.Opts.MaxTokens, MaxTokens: request.Opts.MaxTokens,
Stream: true, MaxCompletionTokens: request.Opts.MaxTokens,
Stream: true,
} }
if request.Opts.MaxChoices > 1 { if request.Opts.MaxChoices > 1 {
req.N = request.Opts.MaxChoices req.N = request.Opts.MaxChoices