From e6bbce439d81443cf37da9573df1fc9bc4d813e8 Mon Sep 17 00:00:00 2001 From: Michael Poluektov Date: Thu, 8 Aug 2024 10:52:09 +0100 Subject: [PATCH] fix: repeat_penalty --- backend/apps/ollama/main.py | 3 --- backend/utils/misc.py | 7 ++++++- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/backend/apps/ollama/main.py b/backend/apps/ollama/main.py index 79a2773ba..3d86b852a 100644 --- a/backend/apps/ollama/main.py +++ b/backend/apps/ollama/main.py @@ -31,8 +31,6 @@ from utils.utils import ( get_verified_user, get_admin_user, ) -from utils.task import prompt_template - from config import ( SRC_LOG_LEVELS, @@ -47,7 +45,6 @@ from config import ( from utils.misc import ( apply_model_params_to_body_ollama, calculate_sha256, - add_or_update_system_message, apply_model_params_to_body_openai, apply_model_system_prompt_to_body, ) diff --git a/backend/utils/misc.py b/backend/utils/misc.py index ffe6a6e53..993aa9f60 100644 --- a/backend/utils/misc.py +++ b/backend/utils/misc.py @@ -181,7 +181,12 @@ def apply_model_params_to_body_ollama(params: dict, form_data: dict) -> dict: ] mappings = {i: lambda x: x for i in opts} mappings = {**mappings, **OPENAI_MAPPINGS} - return apply_model_params_to_body(params, form_data, mappings) + form_data = apply_model_params_to_body(params, form_data, mappings) + + # only param that changes name + if (param := params.get("frequency_penalty", None)) is not None: + form_data["repeat_penalty"] = param + return form_data def get_gravatar_url(email):