Skip to content

Commit e586ee4

Browse files
change default temperature of OAI compat API from 0 to 1 (#7226)
* change default temperature of OAI compat API from 0 to 1 * make tests explicitly send temperature to OAI API
1 parent cbf7589 commit e586ee4

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

examples/server/tests/features/steps/steps.py

+5-2
Original file line numberDiff line numberDiff line change
@@ -887,6 +887,7 @@ async def oai_chat_completions(user_prompt,
887887
base_path,
888888
async_client,
889889
debug=False,
890+
temperature=None,
890891
model=None,
891892
n_predict=None,
892893
enable_streaming=None,
@@ -913,7 +914,8 @@ async def oai_chat_completions(user_prompt,
913914
"model": model,
914915
"max_tokens": n_predict,
915916
"stream": enable_streaming,
916-
"seed": seed
917+
"temperature": temperature if temperature is not None else 0.0,
918+
"seed": seed,
917919
}
918920
if response_format is not None:
919921
payload['response_format'] = response_format
@@ -978,7 +980,8 @@ async def oai_chat_completions(user_prompt,
978980
max_tokens=n_predict,
979981
stream=enable_streaming,
980982
response_format=payload.get('response_format'),
981-
seed=seed
983+
seed=seed,
984+
temperature=payload['temperature']
982985
)
983986
except openai.error.AuthenticationError as e:
984987
if expect_api_error is not None and expect_api_error:

examples/server/utils.hpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -371,7 +371,7 @@ static json oaicompat_completion_params_parse(
371371
llama_params["presence_penalty"] = json_value(body, "presence_penalty", 0.0);
372372
llama_params["seed"] = json_value(body, "seed", LLAMA_DEFAULT_SEED);
373373
llama_params["stream"] = json_value(body, "stream", false);
374-
llama_params["temperature"] = json_value(body, "temperature", 0.0);
374+
llama_params["temperature"] = json_value(body, "temperature", 1.0);
375375
llama_params["top_p"] = json_value(body, "top_p", 1.0);
376376

377377
// Apply chat template to the list of messages

0 commit comments

Comments
 (0)