Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ Add the following dependency to your `pom.xml`:
<dependency>
<groupId>ai.z.openapi</groupId>
<artifactId>zai-sdk</artifactId>
<version>0.0.5</version>
<version>0.0.6</version>
</dependency>
```

Expand All @@ -39,7 +39,7 @@ Add the following dependency to your `build.gradle` (for Groovy DSL):

```groovy
dependencies {
implementation 'ai.z.openapi:zai-sdk:0.0.5'
implementation 'ai.z.openapi:zai-sdk:0.0.6'
}
```

Expand Down Expand Up @@ -124,7 +124,7 @@ ZaiClient client = ZaiClient.builder()

// Create chat request
ChatCompletionCreateParams request = ChatCompletionCreateParams.builder()
.model(Constants.ModelChatGLM4)
.model("glm-4.6")
.messages(Arrays.asList(
ChatMessage.builder()
.role(ChatMessageRole.USER.value())
Expand Down Expand Up @@ -152,7 +152,7 @@ if (response.isSuccess()) {
```java
// Create streaming request
ChatCompletionCreateParams streamRequest = ChatCompletionCreateParams.builder()
.model(Constants.ModelChatGLM4)
.model("glm-4.6")
.messages(Arrays.asList(
ChatMessage.builder()
.role(ChatMessageRole.USER.value())
Expand Down Expand Up @@ -281,7 +281,7 @@ public class AIController {
@PostMapping("/chat")
public ResponseEntity<String> chat(@RequestBody ChatRequest request) {
ChatCompletionCreateParams params = ChatCompletionCreateParams.builder()
.model(Constants.ModelChatGLM4)
.model("glm-4.6")
.messages(Arrays.asList(
ChatMessage.builder()
.role(ChatMessageRole.USER.value())
Expand Down
10 changes: 5 additions & 5 deletions README_CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ Z.ai AI 平台官方 Java SDK,提供统一接口访问强大的AI能力,包
<dependency>
<groupId>ai.z.openapi</groupId>
<artifactId>zai-sdk</artifactId>
<version>0.0.5</version>
<version>0.0.6</version>
</dependency>
```

Expand All @@ -39,7 +39,7 @@ Z.ai AI 平台官方 Java SDK,提供统一接口访问强大的AI能力,包

```groovy
dependencies {
implementation 'ai.z.openapi:zai-sdk:0.0.5'
implementation 'ai.z.openapi:zai-sdk:0.0.6'
}
```

Expand Down Expand Up @@ -123,7 +123,7 @@ ZaiClient client = ZaiClient.builder()

// 创建对话请求
ChatCompletionCreateParams request = ChatCompletionCreateParams.builder()
.model(Constants.ModelChatGLM4)
.model("glm-4.6")
.messages(Arrays.asList(
ChatMessage.builder()
.role(ChatMessageRole.USER.value())
Expand Down Expand Up @@ -151,7 +151,7 @@ if (response.isSuccess()) {
```java
// 创建流式请求
ChatCompletionCreateParams streamRequest = ChatCompletionCreateParams.builder()
.model(Constants.ModelChatGLM4)
.model("glm-4.6")
.messages(Arrays.asList(
ChatMessage.builder()
.role(ChatMessageRole.USER.value())
Expand Down Expand Up @@ -282,7 +282,7 @@ public class AIController {
@PostMapping("/chat")
public ResponseEntity<String> chat(@RequestBody ChatRequest request) {
ChatCompletionCreateParams params = ChatCompletionCreateParams.builder()
.model(Constants.ModelChatGLM4)
.model("glm-4.6")
.messages(Arrays.asList(
ChatMessage.builder()
.role(ChatMessageRole.USER.value())
Expand Down
15 changes: 15 additions & 0 deletions core/src/main/java/ai/z/openapi/core/Constants.java
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,21 @@ private Constants() {
// Text Generation Models
// =============================================================================

/**
* GLM-4.6 model code
*/
public static final String ModelGLM4_6 = "glm-4.6";

/**
* GLM-4.6-air model code
*/
public static final String ModelGLM4_6_AIR = "glm-4.6-air";

/**
* GLM-4.6-flash model code
*/
public static final String ModelGLM4_6_FLASH = "glm-4.6-flash";

/**
* GLM-4.5 model code
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ public Response intercept(Chain chain) throws IOException {
.newBuilder()
.header("Authorization", "Bearer " + accessToken)
.header("x-source-channel", source_channel)
.header("Zai-SDK-Ver", "0.0.5")
.header("Zai-SDK-Ver", "0.0.6")
.header("Accept-Language", "en-US,en");
if (Objects.nonNull(config.getCustomHeaders())) {
for (Map.Entry<String, String> entry : config.getCustomHeaders().entrySet()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,21 +42,19 @@ public class ChatCompletionCreateParams extends CommonRequest implements ClientR
private Boolean stream;

/**
* Sampling temperature, controls output randomness, must be positive Range:
* (0.0,1.0], cannot equal 0, default value is 0.95 Higher values make output more
* random and creative; lower values make output more stable or deterministic It's
* recommended to adjust either top_p or temperature parameter based on your use case,
* but not both simultaneously
* Sampling temperature, controls output randomness, must be positive Range: [0.0,1.0]
* default value is 0.95 Higher values make output more random and creative; lower
* values make output more stable or deterministic It's recommended to adjust either
* top_p or temperature parameter based on your use case, but not both simultaneously
*/
private Float temperature;

/**
* Another method for temperature sampling, called nucleus sampling Range: (0.0, 1.0)
* open interval, cannot equal 0 or 1, default value is 0.7 Model considers results
* with top_p probability mass tokens For example: 0.1 means the model decoder only
* considers tokens from the top 10% probability candidate set It's recommended to
* adjust either top_p or temperature parameter based on your use case, but not both
* simultaneously
* Another method for temperature sampling, called nucleus sampling Range: (0.0, 1.0]
* Model considers results with top_p probability mass tokens For example: 0.1 means
* the model decoder only considers tokens from the top 10% probability candidate set
* It's recommended to adjust either top_p or temperature parameter based on your use
* case, but not both simultaneously
*/
@JsonProperty("top_p")
private Float topP;
Expand Down Expand Up @@ -118,6 +116,11 @@ public class ChatCompletionCreateParams extends CommonRequest implements ClientR
*/
private ChatThinking thinking;

/**
* Whether to stream tool calls
*/
private Boolean tool_stream;

/**
* Forced watermark switch
*/
Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
</scm>

<properties>
<revision>0.0.5.1</revision>
<revision>0.0.6</revision>
<java.version>8</java.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ public static void main(String[] args) {

// Create chat request
ChatCompletionCreateParams request = ChatCompletionCreateParams.builder()
.model(Constants.ModelChatGLM4_5)
.model("glm-4.6")
.messages(Arrays.asList(
ChatMessage.builder()
.role(ChatMessageRole.USER.value())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ public static void main(String[] args) {

// Create chat request
ChatCompletionCreateParams request = ChatCompletionCreateParams.builder()
.model(Constants.ModelChatGLM4_5)
.model("glm-4.6")
.messages(Arrays.asList(
ChatMessage.builder()
.role(ChatMessageRole.USER.value())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ public static void main(String[] args) {

// Create chat request
ChatCompletionCreateParams streamRequest = ChatCompletionCreateParams.builder()
.model(Constants.ModelChatGLM4_5)
.model("glm-4.6")
.messages(Arrays.asList(
ChatMessage.builder()
.role(ChatMessageRole.USER.value())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ public static void main(String[] args) {

// Create chat request
ChatCompletionCreateParams request = ChatCompletionCreateParams.builder()
.model(Constants.ModelChatGLM4_5)
.model("glm-4.6")
.messages(Arrays.asList(
ChatMessage.builder()
.role(ChatMessageRole.USER.value())
Expand Down