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

通义千问流式输出的情况下function call异常 #1403

Open
5 tasks done
hejuntt1014 opened this issue May 1, 2024 · 1 comment
Open
5 tasks done

通义千问流式输出的情况下function call异常 #1403

hejuntt1014 opened this issue May 1, 2024 · 1 comment
Labels
bug Something isn't working function call

Comments

@hejuntt1014
Copy link

hejuntt1014 commented May 1, 2024

例行检查

  • 我已确认目前没有类似 issue
  • 我已确认我已升级到最新版本
  • 我已完整查看过项目 README,尤其是常见问题部分
  • 我理解并愿意跟进此 issue,协助测试和提供反馈
  • 我理解并认可上述内容,并理解项目维护者精力有限,不遵循规则的 issue 可能会被无视或直接关闭

问题描述
通义千问流式输出的情况下function call异常,阿里官方文档显示incremental_output和stream是不支持同时设置的,但是源码中IncrementalOutput直接用request.Stream赋值了,这会使得Stream下function call输出异常
image

复现步骤

curl http://127.0.0.1:3000/v1/chat/completions \
-H "Authorization: Bearer sk-" \
-H "Content-Type: application/json" \
-d '{
  "model": "qwen1.5-72b-chat",
  "stream": true, 
  "messages": [
    {
      "role": "user",
      "content": "茂名天气怎样"
    }
  ],
  "tools": [
    {
      "type": "function",
      "function": {
        "name": "get_current_weather",
        "description": "Get the current weather in a given location",
        "parameters": {
          "type": "object",
          "properties": {
            "location": {
              "type": "string",
              "description": "The city and state, e.g. San Francisco, CA"
            },
            "unit": {
              "type": "string",
              "enum": ["celsius", "fahrenheit"]
            }
          },
          "required": ["location"]
        }
      }
    }
  ],
  "tool_choice": "auto"
}'

预期结果
希望在Stream流式输出的情况下获得openai官方api一致的输出结果

相关截图
异常数据:
image

@hejuntt1014 hejuntt1014 added the bug Something isn't working label May 1, 2024
@hejuntt1014
Copy link
Author

另外,tool_calls也没有组装进message的消息体里面
image

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

No branches or pull requests

2 participants