diff --git a/README.md b/README.md
index a4e8957..20a7c63 100644
--- a/README.md
+++ b/README.md
@@ -59,13 +59,13 @@ maven
com.github.plexpt
chatgpt
- 4.2.0
+ 4.4.0
```
gradle
```
-implementation group: 'com.github.plexpt', name: 'chatgpt', version: '4.2.0'
+implementation group: 'com.github.plexpt', name: 'chatgpt', version: '4.4.0'
```
diff --git a/README_en.md b/README_en.md
index ed45d6e..9555487 100644
--- a/README_en.md
+++ b/README_en.md
@@ -39,14 +39,14 @@ SDK for OpenAI ChatGPT. If you find it helpful, please give it a star in the upp
com.github.plexpt
chatgpt
- 4.2.0
+ 4.4.0
```
#### gradle
```
-implementation group: 'com.github.plexpt', name: 'chatgpt', version: '4.2.0'
+implementation group: 'com.github.plexpt', name: 'chatgpt', version: '4.4.0'
```
### Quick Start
diff --git a/pom.xml b/pom.xml
index b03c156..fbbad48 100644
--- a/pom.xml
+++ b/pom.xml
@@ -5,7 +5,7 @@
com.github.plexpt
chatgpt
- 4.3.0
+ 4.4.0
chatgpt
ChatGPT4.0、 ChatGPT Java SDK.
https://chat.plexpt.com
diff --git a/src/main/java/com/plexpt/chatgpt/entity/chat/ChatChoice.java b/src/main/java/com/plexpt/chatgpt/entity/chat/ChatChoice.java
index a03ee86..8994865 100644
--- a/src/main/java/com/plexpt/chatgpt/entity/chat/ChatChoice.java
+++ b/src/main/java/com/plexpt/chatgpt/entity/chat/ChatChoice.java
@@ -11,6 +11,25 @@
@Data
@JsonIgnoreProperties(ignoreUnknown = true)
public class ChatChoice {
+ // {
+ // "index": 0,
+ // "message": {
+ // "role": "assistant",
+ // "content": null,
+ // "tool_calls": [
+ // {
+ // "id": "call_abc123",
+ // "type": "function",
+ // "function": {
+ // "name": "get_current_weather",
+ // "arguments": "{\n\"location\": \"Boston, MA\"\n}"
+ // }
+ // }
+ // ]
+ // },
+ // "logprobs": null,
+ // "finish_reason": "tool_calls"
+ // }
private long index;
/**
* 请求参数stream为true返回是delta
diff --git a/src/main/java/com/plexpt/chatgpt/entity/chat/ChatCompletion.java b/src/main/java/com/plexpt/chatgpt/entity/chat/ChatCompletion.java
index 23da82e..7396b8f 100644
--- a/src/main/java/com/plexpt/chatgpt/entity/chat/ChatCompletion.java
+++ b/src/main/java/com/plexpt/chatgpt/entity/chat/ChatCompletion.java
@@ -4,19 +4,12 @@
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.plexpt.chatgpt.util.TokensUtil;
+import lombok.*;
+import lombok.extern.slf4j.Slf4j;
-import java.io.Serializable;
import java.util.List;
import java.util.Map;
-import lombok.AllArgsConstructor;
-import lombok.Builder;
-import lombok.Data;
-import lombok.Getter;
-import lombok.NoArgsConstructor;
-import lombok.NonNull;
-import lombok.extern.slf4j.Slf4j;
-
/**
* chat
*
@@ -29,11 +22,11 @@
@NoArgsConstructor(force = true)
@JsonInclude(JsonInclude.Include.NON_NULL)
@JsonIgnoreProperties(ignoreUnknown = true)
-public class ChatCompletion implements Serializable {
+public class ChatCompletion {
@NonNull
@Builder.Default
- private String model = Model.GPT_3_5_TURBO_0613.getName();
+ private String model = "gpt-3.5-turbo";
@NonNull
private List messages;
@@ -60,6 +53,11 @@ public class ChatCompletion implements Serializable {
*/
String function_call;
+ @JsonProperty("tool_choice")
+ String toolChoice;
+
+ List tools;
+
List functions;
/**
@@ -124,13 +122,16 @@ public enum Model {
*/
GPT_3_5_TURBO_0301("gpt-3.5-turbo-0301"),
GPT_3_5_TURBO_1106("gpt-3.5-turbo-1106"),
+ GPT_3_5_TURBO_0125("gpt-3.5-turbo-0125"),
GPT_3_5_TURBO_INSTRUCT("gpt-3.5-turbo-instruct"),
/**
* GPT4.0
*/
GPT_4("gpt-4"),
GPT4Turbo("gpt-4-1106-preview"),
+ GPT4Turbo0125("gpt-4-0125-preview"),
GPT_4VP("gpt-4-vision-preview"),
+ GPT_4V("gpt-4-vision-preview"),
/**
* 临时模型,不建议使用
*/
diff --git a/src/main/java/com/plexpt/chatgpt/entity/chat/ChatCompletionResponse.java b/src/main/java/com/plexpt/chatgpt/entity/chat/ChatCompletionResponse.java
index c3b1dc7..92b04a1 100644
--- a/src/main/java/com/plexpt/chatgpt/entity/chat/ChatCompletionResponse.java
+++ b/src/main/java/com/plexpt/chatgpt/entity/chat/ChatCompletionResponse.java
@@ -23,4 +23,5 @@ public class ChatCompletionResponse {
private String systemFingerprint;
private List choices;
private Usage usage;
+
}
diff --git a/src/main/java/com/plexpt/chatgpt/entity/chat/ChatTool.java b/src/main/java/com/plexpt/chatgpt/entity/chat/ChatTool.java
new file mode 100644
index 0000000..0c0064e
--- /dev/null
+++ b/src/main/java/com/plexpt/chatgpt/entity/chat/ChatTool.java
@@ -0,0 +1,27 @@
+package com.plexpt.chatgpt.entity.chat;
+
+
+import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
+import com.fasterxml.jackson.annotation.JsonInclude;
+import lombok.AllArgsConstructor;
+import lombok.Builder;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+
+@Data
+@AllArgsConstructor
+@NoArgsConstructor
+@Builder
+@JsonInclude(JsonInclude.Include.NON_NULL)
+@JsonIgnoreProperties(ignoreUnknown = true)
+public class ChatTool {
+
+ /**
+ * The name of the tool being called, only function supported for now.
+ */
+ @Builder.Default
+ String type = "function";
+
+ ChatToolFunction function;
+
+}
diff --git a/src/main/java/com/plexpt/chatgpt/entity/chat/ChatToolFunction.java b/src/main/java/com/plexpt/chatgpt/entity/chat/ChatToolFunction.java
new file mode 100644
index 0000000..b384f3b
--- /dev/null
+++ b/src/main/java/com/plexpt/chatgpt/entity/chat/ChatToolFunction.java
@@ -0,0 +1,40 @@
+package com.plexpt.chatgpt.entity.chat;
+
+
+import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
+import com.fasterxml.jackson.annotation.JsonInclude;
+import lombok.AllArgsConstructor;
+import lombok.Builder;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+
+import java.util.List;
+
+@Data
+@AllArgsConstructor
+@NoArgsConstructor
+@Builder
+@JsonInclude(JsonInclude.Include.NON_NULL)
+@JsonIgnoreProperties(ignoreUnknown = true)
+public class ChatToolFunction {
+
+ String name;
+
+ String description;
+
+ ChatParameter parameters;
+
+
+ @Data
+ @AllArgsConstructor
+ @NoArgsConstructor
+ @Builder
+ @JsonInclude(JsonInclude.Include.NON_NULL)
+ public static class ChatParameter {
+
+ String type;
+ List required;
+ Object properties;
+ }
+
+}
diff --git a/src/main/java/com/plexpt/chatgpt/entity/chat/Message.java b/src/main/java/com/plexpt/chatgpt/entity/chat/Message.java
index ace96ea..91f0719 100644
--- a/src/main/java/com/plexpt/chatgpt/entity/chat/Message.java
+++ b/src/main/java/com/plexpt/chatgpt/entity/chat/Message.java
@@ -3,12 +3,9 @@
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
+import lombok.*;
-import lombok.AllArgsConstructor;
-import lombok.Builder;
-import lombok.Data;
-import lombok.Getter;
-import lombok.NoArgsConstructor;
+import java.util.List;
/**
* @author plexpt
@@ -30,6 +27,9 @@ public class Message {
@JsonProperty("function_call")
private FunctionCallResult functionCall;
+ @JsonProperty("tool_calls")
+ private List toolCalls;
+
public Message(String role, String content) {
this.role = role;
this.content = content;
diff --git a/src/main/java/com/plexpt/chatgpt/entity/chat/ToolCallResult.java b/src/main/java/com/plexpt/chatgpt/entity/chat/ToolCallResult.java
new file mode 100644
index 0000000..597e663
--- /dev/null
+++ b/src/main/java/com/plexpt/chatgpt/entity/chat/ToolCallResult.java
@@ -0,0 +1,16 @@
+package com.plexpt.chatgpt.entity.chat;
+
+
+import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
+import lombok.Data;
+
+@Data
+@JsonIgnoreProperties(ignoreUnknown = true)
+public class ToolCallResult {
+
+ String id;
+
+ String type;
+
+ FunctionCallResult function;
+}