openai: align chat temperature and frequency_penalty options with completion (#6688)
release / build-darwin (push) Has been cancelled
release / generate-windows-cpu (push) Has been cancelled
release / generate-windows-rocm (push) Has been cancelled
release / generate-windows-cuda (map[url:https://developer.download.nvidia.com/compute/cuda/11.3.1/local_installers/cuda_11.3.1_465.89_win10.exe version:11]) (push) Has been cancelled
release / generate-windows-cuda (map[url:https://developer.download.nvidia.com/compute/cuda/12.4.0/local_installers/cuda_12.4.0_551.61_windows.exe version:12]) (push) Has been cancelled
release / build-linux-amd64 (push) Has been cancelled
release / build-linux-arm64 (push) Has been cancelled
release / build-windows (push) Has been cancelled
release / release (push) Has been cancelled
release / build-darwin (push) Has been cancelled
release / generate-windows-cpu (push) Has been cancelled
release / generate-windows-rocm (push) Has been cancelled
release / generate-windows-cuda (map[url:https://developer.download.nvidia.com/compute/cuda/11.3.1/local_installers/cuda_11.3.1_465.89_win10.exe version:11]) (push) Has been cancelled
release / generate-windows-cuda (map[url:https://developer.download.nvidia.com/compute/cuda/12.4.0/local_installers/cuda_12.4.0_551.61_windows.exe version:12]) (push) Has been cancelled
release / build-linux-amd64 (push) Has been cancelled
release / build-linux-arm64 (push) Has been cancelled
release / build-windows (push) Has been cancelled
release / release (push) Has been cancelled
This commit is contained in:
+3
-3
@@ -452,7 +452,7 @@ func fromChatRequest(r ChatCompletionRequest) (*api.ChatRequest, error) {
|
||||
}
|
||||
|
||||
if r.Temperature != nil {
|
||||
options["temperature"] = *r.Temperature * 2.0
|
||||
options["temperature"] = *r.Temperature
|
||||
} else {
|
||||
options["temperature"] = 1.0
|
||||
}
|
||||
@@ -462,11 +462,11 @@ func fromChatRequest(r ChatCompletionRequest) (*api.ChatRequest, error) {
|
||||
}
|
||||
|
||||
if r.FrequencyPenalty != nil {
|
||||
options["frequency_penalty"] = *r.FrequencyPenalty * 2.0
|
||||
options["frequency_penalty"] = *r.FrequencyPenalty
|
||||
}
|
||||
|
||||
if r.PresencePenalty != nil {
|
||||
options["presence_penalty"] = *r.PresencePenalty * 2.0
|
||||
options["presence_penalty"] = *r.PresencePenalty
|
||||
}
|
||||
|
||||
if r.TopP != nil {
|
||||
|
||||
@@ -102,9 +102,9 @@ func TestChatMiddleware(t *testing.T) {
|
||||
"num_predict": 999.0, // float because JSON doesn't distinguish between float and int
|
||||
"seed": 123.0,
|
||||
"stop": []any{"\n", "stop"},
|
||||
"temperature": 6.0,
|
||||
"frequency_penalty": 8.0,
|
||||
"presence_penalty": 10.0,
|
||||
"temperature": 3.0,
|
||||
"frequency_penalty": 4.0,
|
||||
"presence_penalty": 5.0,
|
||||
"top_p": 6.0,
|
||||
},
|
||||
Format: "json",
|
||||
|
||||
Reference in New Issue
Block a user