Skip to content

Commit 2b371b6

Browse files
authored
Merge pull request #1590 from ksylvan/0706-webui-topp-fix
Do not pass non-default TopP values
2 parents 0882c43 + 6222a61 commit 2b371b6

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

plugins/ai/openai/chat_completions.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,9 @@ func (o *Client) buildChatCompletionParams(
6969

7070
if !opts.Raw {
7171
ret.Temperature = openai.Float(opts.Temperature)
72-
ret.TopP = openai.Float(opts.TopP)
72+
if opts.TopP != 0 {
73+
ret.TopP = openai.Float(opts.TopP)
74+
}
7375
if opts.MaxTokens != 0 {
7476
ret.MaxTokens = openai.Int(int64(opts.MaxTokens))
7577
}

plugins/ai/openai/openai.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -221,7 +221,9 @@ func (o *Client) buildResponseParams(
221221

222222
if !opts.Raw {
223223
ret.Temperature = openai.Float(opts.Temperature)
224-
ret.TopP = openai.Float(opts.TopP)
224+
if opts.TopP != 0 {
225+
ret.TopP = openai.Float(opts.TopP)
226+
}
225227
if opts.MaxTokens != 0 {
226228
ret.MaxOutputTokens = openai.Int(int64(opts.MaxTokens))
227229
}

0 commit comments

Comments
 (0)