You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
feat(providers): non-function-call model compat fallback - #225
降级名单 vs 能力白名单: 本模块维护的是保守的降级名单。缺点是新 model 发布后短时间可能被误拦(如果名字含 'reasoner');优点是绝不会漏掉不支持 fn_call 的模型。
消息互转的 fidelity:to_non_function_call_messages() 把 tool_calls 参数展开为自然语言描述("Calling tool X with args Y"),把 tool 结果包裹为 "Tool result from X: ..."。这保持了信息的完整性但丢失了结构化调用链——不影响单次执行但多轮分析时要注意。
Thank you for the submission, @raymondginger2018-sudo. Closing for three reasons. First, the capability already exists as configuration: ExecutionProfile.tool_calling (toolCalling) and validate_request_capabilities refuse tool requests for models declared without function calling, and core/providers/model_compat.py deliberately avoids name-substring detection, which this module reintroduces. Second, the list is wrong for current models (the o3/o4 series support function calling; "reasoner" as a substring is too broad). Third, the fallback is only half a mechanism: it converts tool_calls to text on the way out but never parses the model's text back into tool calls, so a degraded session cannot actually use tools. If you want to pursue a text-protocol fallback, it has to include that reverse parser and an end-to-end test against a real non-function-calling model.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
设计说明
问题:
deepseek-reasoner/o1/o3/o4等模型不支持(或官方不推荐)函数调用参数传递。直接发 tool_calls 会报错或静默降级,agent 失去工具能力。解法:三件套——
resolve_fn_call_policy():纯函数判定该模型是否走函数调用通道to_non_function_call_messages():把 tool_calls/tool 结果互转为纯文本消息build_fallback_system_reminder():降级时把工具清单以纯文本注入,让模型仍知道可用工具关键设计决策:
DEEPCODE_FN_CALL_COMPAT(on/off/auto)> 默认按模型名判定边界情况:
auto模式下非名单模型照常走函数调用测试建议:对
deepseek-reasoner验证 auto 判定 → 互转消息结构;对deepseek-chat验证正常通道