chatanywhere / GPT_API_free

Free ChatGPT API Key,免费ChatGPT API,支持GPT4 API(免费),ChatGPT国内可用免费转发API,直连无需代理。可以搭配ChatBox等软件/插件使用,极大降低接口使用成本。国内即可无限制畅快聊天。
MIT License
25.35k stars 1.9k forks source link

streaming 下 function call tool_calls index 为 null #254

Open Kugaaa opened 5 months ago

Kugaaa commented 5 months ago

Describe the bug 描述bug streaming 下 function call tool_calls index 为 null

To Reproduce 复现方法

  1. stream 使用 function call

Screenshots 截图 返回结构

{
    "id": "chatcmpl-9bs8FJY0e9Jfp8gRPNQqHps9AG8Dn",
    "object": "chat.completion.chunk",
    "created": 1718813247,
    "model": "gpt-3.5-turbo-0613",
    "choices": [
        {
            "index": 0,
            "delta": {
                "role": "assistant",
                "tool_calls": [
                    {
                        // no index
                        "id": "call_UnVtKL0WOa8iFRgWgrvdf4JY",
                        "type": "function",
                        "function": {
                            "name": "squareRoot",
                            "arguments": ""
                        }
                    }
                ]
            },
            "logprobs": null,
            "finish_reason": null
        }
    ],
    "system_fingerprint": null
}

Tools or Programming Language 使用的工具或编程语言 Java 17

chatanywhere commented 5 months ago
image

以上官方文档截图中,tool_calls对象下并没有index字段

猜测您需要的index字段应该在choices字段下,如下图

image
Kugaaa commented 5 months ago

好的,我再看一下 方便把文档链接发我吗,感谢

chatanywhere commented 5 months ago

https://platform.openai.com/docs/api-reference/chat/object

Kugaaa commented 5 months ago

https://platform.openai.com/docs/api-reference/chat/object

我是使用的流式

image
Kugaaa commented 5 months ago

麻烦提高下优先级

chatanywhere commented 5 months ago

抱歉上周比较忙没有时间维护

排查发现确实缺失了Stream下的index参数,我们将在6月26日8:00前通过热补丁修复该问题