Skip to content

Agent框架调用FastGPT发布的服务,工具函数调用失效 #6182

@towsix36

Description

@towsix36

例行检查

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

你的版本

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

问题描述, 日志截图,配置文件等
curl --location --request POST 'http://*:3000/api/v1/chat/completions'
--header 'Authorization: Bearer fastgpt-
'
--header 'Content-Type: application/json'
--data-raw '{
"model": "openai",
"messages": [
{
"role": "user",
"content": "现在的时间是?"
}
],
"chatId": "113",
"stream": false,
"detail": false,
"tool_choice":"auto",
"tools": [
{
"type": "function",
"function": {
"name": "get_current_time",
"description": "Get the current time",
"parameters": {
"type": "object",
"properties": {},
"required": []
}
}
}
]
}'

反馈:
{
"id": "113",
"model": "",
"usage": {
"prompt_tokens": 1,
"completion_tokens": 1,
"total_tokens": 1
},
"choices": [
{
"message": {
"role": "assistant",
"content": "我注意到您重复询问了时间。不过,为了获取最准确的信息,我需要调用外部工具来核实当前时间。目前,我无法直接调用时间查询工具,建议您查看设备上的时钟或使用在线时间服务来获取当前准确时间。\n\n如果您需要其他帮助,比如天气信息,我可以协助您查询。"
},
"finish_reason": "stop",
"index": 0
}
]
}

期望FastGPT API 服务能反馈函数调用:
{
"id": "113",
"model": "",
"usage": {
"prompt_tokens": 1,
"completion_tokens": 1,
"total_tokens": 1
},
"choices": [
{
"index": 0,
"message": {
"role": "assistant",
"content": "我来帮您查看当前时间。",
"tool_calls": [
{
"index": 0,
"id": "call_00_esfQST4qAtIVZ7yFxXNB0R4f",
"type": "function",
"function": {
"name": "get_current_time",
"arguments": "{}"
}
}
]
},
"logprobs": null,
"finish_reason": "tool_calls"
}
],
}
复现步骤

预期结果
期望回复函数调用:
{
"id": "113",
"model": "",
"usage": {
"prompt_tokens": 1,
"completion_tokens": 1,
"total_tokens": 1
},
"choices": [
{
"index": 0,
"message": {
"role": "assistant",
"content": "我来帮您查看当前时间。",
"tool_calls": [
{
"index": 0,
"id": "call_00_esfQST4qAtIVZ7yFxXNB0R4f",
"type": "function",
"function": {
"name": "get_current_time",
"arguments": "{}"
}
}
]
},
"logprobs": null,
"finish_reason": "tool_calls"
}
],
}
相关截图

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions