diff --git a/api/simple_chat.py b/api/simple_chat.py index 06d329a2..dae0625b 100644 --- a/api/simple_chat.py +++ b/api/simple_chat.py @@ -423,9 +423,11 @@ async def chat_completions_stream(request: ChatCompletionRequest): model_kwargs = { "model": request.model, "stream": True, - "temperature": model_config["temperature"], - "top_p": model_config["top_p"] + "temperature": model_config["temperature"] } + # Only add top_p if it exists in the model config + if "top_p" in model_config: + model_kwargs["top_p"] = model_config["top_p"] api_kwargs = model.convert_inputs_to_api_kwargs( input=prompt, diff --git a/api/websocket_wiki.py b/api/websocket_wiki.py index 2a7cce9e..93e7ebf4 100644 --- a/api/websocket_wiki.py +++ b/api/websocket_wiki.py @@ -502,9 +502,11 @@ async def handle_websocket_chat(websocket: WebSocket): model_kwargs = { "model": request.model, "stream": True, - "temperature": model_config["temperature"], - "top_p": model_config["top_p"] + "temperature": model_config["temperature"] } + # Only add top_p if it exists in the model config + if "top_p" in model_config: + model_kwargs["top_p"] = model_config["top_p"] api_kwargs = model.convert_inputs_to_api_kwargs( input=prompt,