Skip to content

armgit / dify

Public Imported from GitHub
0

Build Agentic workflows, RAG pipelines, with rich AI model and tool support on one collaborative workspace. Deploy on cloud, VPC, or self-hosted, so teams move from prototype to production without rebuilding the stack.

fix: baichuan frequency_penalty (#2446)

Yeuolye47b5b43b8c3
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 ae73c1735a6..639f6a21cef 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 @@ class BaichuanModel:
'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),