From 79d7e67e51be25e866681d1e0d7b61854041d65e Mon Sep 17 00:00:00 2001 From: Timothy Jaeryang Baek Date: Sun, 29 Dec 2024 16:30:36 -0800 Subject: [PATCH] fix: ollama options --- backend/open_webui/utils/middleware.py | 1 - backend/open_webui/utils/payload.py | 4 ++++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/backend/open_webui/utils/middleware.py b/backend/open_webui/utils/middleware.py index c476e8de8..4741623c4 100644 --- a/backend/open_webui/utils/middleware.py +++ b/backend/open_webui/utils/middleware.py @@ -561,7 +561,6 @@ def apply_params_to_form_data(form_data, model): if "frequency_penalty" in params: form_data["frequency_penalty"] = params["frequency_penalty"] - return form_data diff --git a/backend/open_webui/utils/payload.py b/backend/open_webui/utils/payload.py index 0125a799c..fdc62f79f 100644 --- a/backend/open_webui/utils/payload.py +++ b/backend/open_webui/utils/payload.py @@ -160,6 +160,10 @@ def convert_payload_openai_to_ollama(openai_payload: dict) -> dict: # If there are advanced parameters in the payload, format them in Ollama's options field ollama_options = {} + if openai_payload.get("options"): + ollama_payload["options"] = openai_payload["options"] + ollama_options = openai_payload["options"] + # Handle parameters which map directly for param in ["temperature", "top_p", "seed"]: if param in openai_payload: