fix(gemini): 对 thinking_budget 不同模型的处理

pull/1204/head
foxplaying 2025-08-21 03:40:59 +08:00 committed by GitHub
parent bbf8bebb13
commit ea08aa05da
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 8 additions and 2 deletions

View File

@ -343,9 +343,15 @@ class GeminiClient(BaseClient):
@staticmethod @staticmethod
def clamp_thinking_budget(tb: int, model_id: str) -> int: def clamp_thinking_budget(tb: int, model_id: str) -> int:
""" """
按模型限制思考预算范围仅支持指定的模型 按模型限制思考预算范围仅支持指定的模型支持带数字后缀的新版本
""" """
limits = THINKING_BUDGET_LIMITS.get(model_id) # 前缀匹配
limits = None
for key, val in THINKING_BUDGET_LIMITS.items():
if model_id.startswith(key):
limits = val
break
if limits is None: if limits is None:
raise ValueError(f"模型 {model_id} 不支持 ThinkingConfig") raise ValueError(f"模型 {model_id} 不支持 ThinkingConfig")
if tb == GeminiClient.TB_DYNAMIC_MODE: if tb == GeminiClient.TB_DYNAMIC_MODE: