Grt1228 / chatgpt-java

ChatGPT Java SDK支持流式输出、Gpt插件、联网。支持OpenAI官方所有接口。ChatGPT的Java客户端。OpenAI GPT-3.5-Turb GPT-4 Api Client for Java
https://chatgpt-java.unfbx.com
Apache License 2.0
3.3k stars 810 forks source link

使用Plugin功能报Unrecognized field "code" #208

Closed AIchovy closed 11 months ago

AIchovy commented 11 months ago

版本:1.1.1-beta0 调用地址:官方地址 调用方式:

 TimePlugin plugin = new TimePlugin(TimePlugin.class);
        plugin.setName("当前时间");
        plugin.setFunction("getCurrentTime");
        plugin.setDescription("询问当前时间,方法将会获取当前时间。");
        PluginAbstract.Arg arg = new PluginAbstract.Arg();
        plugin.setArgs(Collections.singletonList(arg));
       openaiClient.chatCompletionWithPlugin(chatCompletion, plugin)

报错内容:

com.fasterxml.jackson.databind.exc.UnrecognizedPropertyException: Unrecognized field "code" (class com.unfbx.chatgpt.entity.chat.ChatCompletionResponse), not marked as ignorable (6 known properties: "usage", "choices", "created", "model", "id", "object"])

原因是openai返回:

{
  "error": {
    "message": "None is not of type 'object' - 'functions.0.parameters'",
    "type": "invalid_request_error",
    "param": null,
    "code": null
  }
}