提交 70aa9f5f 编写于 作者: 小傅哥's avatar 小傅哥

fix:v1.1 test_completions_sync 参数兼容

上级 77cd4b0c
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
<groupId>cn.bugstack</groupId> <groupId>cn.bugstack</groupId>
<artifactId>chatglm-sdk-java</artifactId> <artifactId>chatglm-sdk-java</artifactId>
<version>2.0</version> <version>2.1</version>
<name>chatglm-sdk-java</name> <name>chatglm-sdk-java</name>
<description>OpenAI Java SDK, ZhiPuAi ChatGLM Java SDK . Copyright © 2023 bugstack虫洞栈 All rights reserved. 版权所有(C)小傅哥 https://github.com/fuzhengwei/chatglm-sdk-java</description> <description>OpenAI Java SDK, ZhiPuAi ChatGLM Java SDK . Copyright © 2023 bugstack虫洞栈 All rights reserved. 版权所有(C)小傅哥 https://github.com/fuzhengwei/chatglm-sdk-java</description>
......
...@@ -6,6 +6,7 @@ import java.util.List; ...@@ -6,6 +6,7 @@ import java.util.List;
/** /**
* 同步调用响应 * 同步调用响应
*
* @author max * @author max
* @date 2023/12/14 15:41 * @date 2023/12/14 15:41
*/ */
...@@ -17,6 +18,17 @@ public class ChatCompletionSyncResponse { ...@@ -17,6 +18,17 @@ public class ChatCompletionSyncResponse {
private Boolean success; private Boolean success;
private ChatGLMData data; private ChatGLMData data;
// 24年1月发布模型新增字段 GLM3、GLM4
private String task_status;
private List<Choice> choices;
public void setChoices(List<Choice> choices) {
this.choices = choices;
this.data = new ChatGLMData();
this.data.setChoices(choices);
}
@Data @Data
public static class ChatGLMData { public static class ChatGLMData {
private List<Choice> choices; private List<Choice> choices;
...@@ -35,6 +47,18 @@ public class ChatCompletionSyncResponse { ...@@ -35,6 +47,18 @@ public class ChatCompletionSyncResponse {
@Data @Data
public static class Choice { 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 role;
private String content; private String content;
} }
......
...@@ -283,7 +283,7 @@ public class ApiTest { ...@@ -283,7 +283,7 @@ public class ApiTest {
public void test_completions_sync() throws Exception { public void test_completions_sync() throws Exception {
// 入参;模型、请求信息 // 入参;模型、请求信息
ChatCompletionRequest request = new ChatCompletionRequest(); 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<ChatCompletionRequest.Prompt>() { request.setPrompt(new ArrayList<ChatCompletionRequest.Prompt>() {
private static final long serialVersionUID = -7988151926241837899L; private static final long serialVersionUID = -7988151926241837899L;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册