Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

豆包模型在工具调用里用不了 #3489

Closed
3 of 7 tasks
linqinguang opened this issue Dec 27, 2024 · 2 comments · Fixed by #3493
Closed
3 of 7 tasks

豆包模型在工具调用里用不了 #3489

linqinguang opened this issue Dec 27, 2024 · 2 comments · Fixed by #3493
Labels
bug Something isn't working

Comments

@linqinguang
Copy link

linqinguang commented Dec 27, 2024

例行检查

  • 我已确认目前没有类似 issue
  • 我已完整查看过项目 README,以及项目文档
  • 我使用了自己的 key,并确认我的 key 是可正常使用的
  • 我理解并愿意跟进此 issue,协助测试和提供反馈
  • 我理解并认可上述内容,并理解项目维护者精力有限,不遵循规则的 issue 可能会被无视或直接关闭

你的版本

  • 公有云版本
  • 私有部署版本, 具体版本号: 4.8.15

问题描述, 日志截图,配置文件等
豆包模型具备Tool Call能力,但是在工具调用里却用不了Tool Call。通过curl看了下豆包模型和其他正常的模型的区别是豆包在触发tool_calls时,messages.content中会有选择工具的原因,而其他模型的content都是空字符串。例如

{
    "index": 0,
    "message": {
        "role": "assistant",
        "content": "当前提供了1个工具,分别是[\"b9NctXLecxTp\"],需求为查天气,需要先查询当前时间的天齐,此处应调用b9NctXLecxTp。",
        "tool_calls": [
            {
                "index": 0,
                "id": "b9NctXLecxTp:0",
                "type": "function",
                "function": {
                    "name": "b9NctXLecxTp",
                    "arguments": "{\n  \"now_time\": \"2024-02-29 23:59:59 Wednesday\"\n}"
                }
            }
        ]
    },
    "finish_reason": "tool_calls"
}

而在代码packages\service\core\workflow\dispatch\agent\runTool\toolChoice.ts的572行,if判断中的条件是responseChoice?.content,而非responseChoice?.tool_calls或part.choices?.[0]?.finish_reason==="tool_calls",导致豆包返回tool_calls但工具按照正常assistant回复处理。

虽然原因找到了,但是写不来ts,只好厚颜无耻当个伸手党了

@linqinguang linqinguang added the bug Something isn't working label Dec 27, 2024
@c121914yu
Copy link
Collaborator

好的,我们去试试。

@c121914yu
Copy link
Collaborator

c121914yu commented Dec 30, 2024

#3493 已处理,把 else if 去掉,改成并列 if 即可。
不过实测,豆包工具调用不是很好用。就和你发送的例子一样,会回复很多无关内容,并且有些没有参数的工具,经常不触发。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants