diff --git a/api/core/model_runtime/model_providers/baichuan/llm/baichuan_turbo.py b/api/core/model_runtime/model_providers/baichuan/llm/baichuan_turbo.py index ae73c1735a6600..639f6a21cefcde 100644 --- a/api/core/model_runtime/model_providers/baichuan/llm/baichuan_turbo.py +++ b/api/core/model_runtime/model_providers/baichuan/llm/baichuan_turbo.py @@ -128,8 +128,10 @@ def _build_parameters(self, model: str, stream: bool, messages: list[BaichuanMes 'role': message.role, }) # [baichuan] frequency_penalty must be between 1 and 2 - if parameters['frequency_penalty'] < 1 or parameters['frequency_penalty'] > 2: - parameters['frequency_penalty'] = 1 + if 'frequency_penalty' in parameters: + if parameters['frequency_penalty'] < 1 or parameters['frequency_penalty'] > 2: + parameters['frequency_penalty'] = 1 + # turbo api accepts flat parameters return { 'model': self._model_mapping(model),