Merge pull request #902 from SuanmoSuanyangTechnology/fix/Timebomb_030
fix(model)
This commit is contained in:
@@ -112,22 +112,23 @@ class RedBearModelFactory:
|
|||||||
params["stream_usage"] = True
|
params["stream_usage"] = True
|
||||||
# 深度思考模式
|
# 深度思考模式
|
||||||
is_streaming = bool(config.extra_params.get("streaming"))
|
is_streaming = bool(config.extra_params.get("streaming"))
|
||||||
if is_streaming and not config.is_omni:
|
if config.support_thinking:
|
||||||
if provider == ModelProvider.VOLCANO:
|
if is_streaming and not config.is_omni:
|
||||||
# 火山引擎深度思考仅流式调用支持,非流式时不传 thinking 参数
|
if provider == ModelProvider.VOLCANO:
|
||||||
thinking_config: Dict[str, Any] = {
|
# 火山引擎深度思考仅流式调用支持,非流式时不传 thinking 参数
|
||||||
"type": "enabled" if config.deep_thinking else "disabled"
|
thinking_config: Dict[str, Any] = {
|
||||||
}
|
"type": "enabled" if config.deep_thinking else "disabled"
|
||||||
if config.deep_thinking and config.thinking_budget_tokens:
|
}
|
||||||
thinking_config["budget_tokens"] = config.thinking_budget_tokens
|
if config.deep_thinking and config.thinking_budget_tokens:
|
||||||
params["extra_body"] = {"thinking": thinking_config}
|
thinking_config["budget_tokens"] = config.thinking_budget_tokens
|
||||||
else:
|
params["extra_body"] = {"thinking": thinking_config}
|
||||||
# 始终显式传递 enable_thinking,不支持该参数的模型(如 DeepSeek-R1)会直接忽略
|
else:
|
||||||
model_kwargs: Dict[str, Any] = config.extra_params.get("model_kwargs", {})
|
# 始终显式传递 enable_thinking,不支持该参数的模型(如 DeepSeek-R1)会直接忽略
|
||||||
model_kwargs["enable_thinking"] = config.deep_thinking
|
model_kwargs: Dict[str, Any] = config.extra_params.get("model_kwargs", {})
|
||||||
if config.deep_thinking and config.thinking_budget_tokens:
|
model_kwargs["enable_thinking"] = config.deep_thinking
|
||||||
model_kwargs["thinking_budget"] = config.thinking_budget_tokens
|
if config.deep_thinking and config.thinking_budget_tokens:
|
||||||
params["model_kwargs"] = model_kwargs
|
model_kwargs["thinking_budget"] = config.thinking_budget_tokens
|
||||||
|
params["model_kwargs"] = model_kwargs
|
||||||
return params
|
return params
|
||||||
elif provider == ModelProvider.DASHSCOPE:
|
elif provider == ModelProvider.DASHSCOPE:
|
||||||
params = {
|
params = {
|
||||||
|
|||||||
Reference in New Issue
Block a user