feat(providers): non-function-call model compat fallback - #225
Open
raymondginger2018-sudo wants to merge 2 commits into
Open
feat(providers): non-function-call model compat fallback#225raymondginger2018-sudo wants to merge 2 commits into
raymondginger2018-sudo wants to merge 2 commits into
Conversation
Contributor
Author
关键设计决策补充
|
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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验证正常通道