diff --git a/pom.xml b/pom.xml index 1976f50248764a550d17e7b2e4bb80a8c4801842..debd4570995204e8b0a5d37dfe5208688b0d54c7 100644 --- a/pom.xml +++ b/pom.xml @@ -6,7 +6,7 @@ cn.bugstack chatglm-sdk-java - 2.0 + 2.1 chatglm-sdk-java OpenAI Java SDK, ZhiPuAi ChatGLM Java SDK . Copyright © 2023 bugstack虫洞栈 All rights reserved. 版权所有(C)小傅哥 https://github.com/fuzhengwei/chatglm-sdk-java diff --git a/src/main/java/cn/bugstack/chatglm/model/ChatCompletionSyncResponse.java b/src/main/java/cn/bugstack/chatglm/model/ChatCompletionSyncResponse.java index 485f97258276dfe568e62f72e8a294ca36237970..dc0e67514fefa73e50f0b57e1d3fdac446ce171c 100644 --- a/src/main/java/cn/bugstack/chatglm/model/ChatCompletionSyncResponse.java +++ b/src/main/java/cn/bugstack/chatglm/model/ChatCompletionSyncResponse.java @@ -6,6 +6,7 @@ import java.util.List; /** * 同步调用响应 + * * @author max * @date 2023/12/14 15:41 */ @@ -17,6 +18,17 @@ public class ChatCompletionSyncResponse { private Boolean success; private ChatGLMData data; + // 24年1月发布模型新增字段 GLM3、GLM4 + private String task_status; + private List choices; + + public void setChoices(List choices) { + this.choices = choices; + this.data = new ChatGLMData(); + this.data.setChoices(choices); + } + + @Data public static class ChatGLMData { private List choices; @@ -35,6 +47,18 @@ public class ChatCompletionSyncResponse { @Data public static class Choice { + + private String role; + private String content; + + // 24年1月发布模型新增字段 GLM3、GLM4 + private String finish_reason; + private int index; + private Message message; + } + + @Data + public static class Message { private String role; private String content; } diff --git a/src/test/java/cn/bugstack/chatglm/test/ApiTest.java b/src/test/java/cn/bugstack/chatglm/test/ApiTest.java index f0d7224be4f86b4f10324663c353d253e36177e7..0be80a91bcbd947f5276c31e48fec8e611d22c91 100644 --- a/src/test/java/cn/bugstack/chatglm/test/ApiTest.java +++ b/src/test/java/cn/bugstack/chatglm/test/ApiTest.java @@ -283,7 +283,7 @@ public class ApiTest { public void test_completions_sync() throws Exception { // 入参;模型、请求信息 ChatCompletionRequest request = new ChatCompletionRequest(); - request.setModel(Model.GLM_4V); // chatGLM_6b_SSE、chatglm_lite、chatglm_lite_32k、chatglm_std、chatglm_pro + request.setModel(Model.GLM_3_5_TURBO); // chatGLM_6b_SSE、chatglm_lite、chatglm_lite_32k、chatglm_std、chatglm_pro request.setPrompt(new ArrayList() { private static final long serialVersionUID = -7988151926241837899L;