fix: 修正thinking_config

This commit is contained in:
Raven95676
2025-05-02 15:36:07 +08:00
parent 4d1a6994aa
commit f5b3d94d16
2 changed files with 11 additions and 13 deletions
+1 -7
View File
@@ -569,7 +569,6 @@ CONFIG_METADATA_2 = {
"dangerous_content": "BLOCK_MEDIUM_AND_ABOVE",
},
"gm_thinking_config": {
"enable": False,
"budget": 0,
},
},
@@ -809,15 +808,10 @@ CONFIG_METADATA_2 = {
"description": "Gemini思考设置",
"type": "object",
"items": {
"enable": {
"description": "启用思考",
"type": "bool",
"hint": "启用后,模型将在可用时输出思考过程",
},
"budget": {
"description": "思考预算",
"type": "int",
"hint": "模型应该生成的思考Token的数量",
"hint": "模型应该生成的思考Token的数量,设为0关闭思考。除gemini-2.5-flash外的模型会静默忽略此参数。",
},
},
},
+10 -6
View File
@@ -179,13 +179,17 @@ class ProviderGoogleGenAI(Provider):
tools=tool_list,
safety_settings=self.safety_settings if self.safety_settings else None,
thinking_config=types.ThinkingConfig(
include_thoughts=self.provider_config.get("gm_thinking_config", {}).get(
"enable", False
thinking_budget=min(
int(
self.provider_config.get("gm_thinking_config", {}).get(
"budget", 0
)
),
24576,
),
thinking_budget=self.provider_config.get("gm_thinking_config", {}).get(
"budget", 0
),
),
)
if "gemini-2.5-flash" in self.get_model()
else None,
automatic_function_calling=types.AutomaticFunctionCallingConfig(
disable=True
),