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
15.95k stars 3.69k forks source link

调用讯飞星火Spark Pro/Max Function Call 不能按预期返回 Function Call 形式的结果,只会返回普通对话形式的结果 #1543

Closed shijilin0116 closed 1 week ago

shijilin0116 commented 1 week ago

例行检查

问题描述

1526 修复了 Spark Lite/Spark Pro/Max 函数调用有报错的问题。但是,按照目前的代码,Spark Pro/Max 虽然不会报错,但也不会返回函数调用格式的回答,而是返回普通对话的回答。

复现步骤 按照openai的标准使用以下请求体发起请求,得到的结果是普通对话回答,而不是 Function Call形式的回答。

{
  "model": "SparkDesk",
  "messages": [
    {
      "role": "user",
      "content": "What's the weather like in Boston today?"
    }
  ],
  "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"
}

预期结果 调用Spark Pro/Max 的 Function Call 应该能够返回正确的函数调用的结果。 相关截图

image