songquanpeng / one-api

OpenAI 接口管理 & 分发系统,支持 Azure、Anthropic Claude、Google PaLM 2 & Gemini、智谱 ChatGLM、百度文心一言、讯飞星火认知、阿里通义千问、360 智脑以及腾讯混元,可用于二次分发管理 key,仅单可执行文件,已打包好 Docker 镜像,一键部署,开箱即用. OpenAI key management & redistribution system, using a single API for all LLMs, and features an English UI.
https://openai.justsong.cn/
MIT License
16.06k stars 3.73k forks source link

千问 stream=true 模式下,工具调用失败 #1573

Closed c121914yu closed 5 days ago

c121914yu commented 6 days ago

例行检查

问题描述 stream=false模式下正常,stream=true模式下无法正确返回 tool 的响应结构。

测试例子

{
  "model": "qwen-turbo",
  "temperature": 0,
  "stream": true,
  "messages": [
    {
      "role": "user",
      "content": "几点了"
    }
  ],
  "tools": [
    {
      "type": "function",
      "function": {
        "name": "nYGo9W",
        "description": "获取用户当前时区的时间。",
        "parameters": {
          "type": "object",
          "properties": {},
          "required": []
        }
      }
    }
  ],
  "tool_choice": "auto"
}
dirname commented 6 days ago

目前 Function call 信息暂时不支持增量输出,见 https://help.aliyun.com/zh/dashscope/developer-reference/api-details

c121914yu commented 5 days ago

目前 Function call 信息暂时不支持增量输出,见 https://help.aliyun.com/zh/dashscope/developer-reference/api-details

oneapi 可以做适配吧,不支持的,默认走非流,按流的格式返回即可