Skip to content

Commit ba9c069

Browse files
committed
feat: fix serialize bugs
1 parent 5c3026d commit ba9c069

File tree

7 files changed

+19
-21
lines changed

7 files changed

+19
-21
lines changed

api/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
<parent>
77
<groupId>top.bella</groupId>
88
<artifactId>openai-java</artifactId>
9-
<version>0.23.32</version>
9+
<version>0.23.33</version>
1010
</parent>
1111
<packaging>jar</packaging>
1212
<artifactId>openai-api</artifactId>

api/src/main/java/com/theokanning/openai/assistants/assistant/Tool.java

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,6 @@ public interface Tool {
4545
*/
4646
@Data
4747
class Function implements Tool {
48-
private String type = "function";
4948
private FunctionDefinition function;
5049
@JsonProperty("is_final")
5150
private Boolean isFinal = false;
@@ -61,7 +60,6 @@ public String getType() {
6160
*/
6261
@Data
6362
class Retrieval implements Tool {
64-
private String type = "retrieval";
6563
@JsonProperty("default_metadata")
6664
private DefaultMetadata defaultMetadata = new DefaultMetadata();
6765

@@ -76,7 +74,6 @@ public String getType() {
7674
*/
7775
@Data
7876
class Rag implements Tool {
79-
private String type = "rag";
8077
@JsonProperty("default_metadata")
8178
private DefaultMetadata defaultMetadata = new DefaultMetadata();
8279

@@ -91,7 +88,6 @@ public String getType() {
9188
*/
9289
@Data
9390
class WebSearch implements Tool {
94-
private String type = "web_search";
9591

9692
@Override
9793
public String getType() {
@@ -104,7 +100,6 @@ public String getType() {
104100
*/
105101
@Data
106102
class WebSearchTavily implements Tool {
107-
private String type = "web_search_tavily";
108103

109104
@Override
110105
public String getType() {
@@ -117,7 +112,6 @@ public String getType() {
117112
*/
118113
@Data
119114
class WeatherSearch implements Tool {
120-
private String type = "weather_search";
121115

122116
@Override
123117
public String getType() {
@@ -130,7 +124,6 @@ public String getType() {
130124
*/
131125
@Data
132126
class ImgVision implements Tool {
133-
private String type = "img_vision";
134127

135128
@Override
136129
public String getType() {
@@ -143,7 +136,6 @@ public String getType() {
143136
*/
144137
@Data
145138
class ImgGenerate implements Tool {
146-
private String type = "img_generate";
147139

148140
@Override
149141
public String getType() {
@@ -156,7 +148,6 @@ public String getType() {
156148
*/
157149
@Data
158150
class Bar implements Tool {
159-
private String type = "generate_bar";
160151

161152
@Override
162153
public String getType() {
@@ -169,7 +160,6 @@ public String getType() {
169160
*/
170161
@Data
171162
class Line implements Tool {
172-
private String type = "generate_line";
173163

174164
@Override
175165
public String getType() {
@@ -182,7 +172,6 @@ public String getType() {
182172
*/
183173
@Data
184174
class Pie implements Tool {
185-
private String type = "generate_pie";
186175

187176
@Override
188177
public String getType() {
@@ -195,7 +184,6 @@ public String getType() {
195184
*/
196185
@Data
197186
class WikiSearch implements Tool {
198-
private String type = "wiki_search";
199187

200188
@Override
201189
public String getType() {
@@ -208,7 +196,6 @@ public String getType() {
208196
*/
209197
@Data
210198
class MyWeekReport implements Tool {
211-
private String type = "my_week_report";
212199

213200
@Override
214201
public String getType() {
@@ -221,7 +208,6 @@ public String getType() {
221208
*/
222209
@Data
223210
class WeekReportToMe implements Tool {
224-
private String type = "week_report_to_me";
225211

226212
@Override
227213
public String getType() {
@@ -234,7 +220,6 @@ public String getType() {
234220
*/
235221
@Data
236222
class ReadFiles implements Tool {
237-
private String type = "read_files";
238223

239224
@Override
240225
public String getType() {
@@ -247,7 +232,6 @@ public String getType() {
247232
*/
248233
@Data
249234
class WebCrawler implements Tool {
250-
private String type = "web_crawler";
251235

252236
@Override
253237
public String getType() {

api/src/main/java/com/theokanning/openai/assistants/message/MessageContent.java

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,4 +41,15 @@ public class MessageContent {
4141
@JsonProperty("image_url")
4242
@JsonInclude(JsonInclude.Include.NON_NULL)
4343
ImageUrl imageUrl;
44+
45+
public boolean empty() {
46+
switch (type) {
47+
case "image_file":
48+
return imageFile == null;
49+
case "image_url":
50+
return imageUrl == null;
51+
default:
52+
return text == null || text.getValue() == null || text.getValue().trim().isEmpty();
53+
}
54+
}
4455
}

api/src/main/java/com/theokanning/openai/assistants/run/SubmitToolOutputsRequest.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
package com.theokanning.openai.assistants.run;
22

33
import com.fasterxml.jackson.annotation.JsonProperty;
4+
import com.theokanning.openai.assistants.IUssrRequest;
45
import lombok.AllArgsConstructor;
56
import lombok.Builder;
67
import lombok.Data;
@@ -20,7 +21,7 @@
2021
@Builder
2122
@NoArgsConstructor
2223
@AllArgsConstructor
23-
public class SubmitToolOutputsRequest {
24+
public class SubmitToolOutputsRequest implements IUssrRequest {
2425

2526
Boolean stream;
2627

@@ -30,6 +31,8 @@ public class SubmitToolOutputsRequest {
3031
@JsonProperty("tool_outputs")
3132
private List<SubmitToolOutputRequestItem> toolOutputs;
3233

34+
String user;
35+
3336

3437
/**
3538
* 单个函数调用的请求对象构造

client/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
<parent>
77
<groupId>top.bella</groupId>
88
<artifactId>openai-java</artifactId>
9-
<version>0.23.32</version>
9+
<version>0.23.33</version>
1010
</parent>
1111
<packaging>jar</packaging>
1212

pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
<groupId>top.bella</groupId>
77
<artifactId>openai-java</artifactId>
8-
<version>0.23.32</version>
8+
<version>0.23.33</version>
99
<packaging>pom</packaging>
1010
<description>openai java 版本</description>
1111
<name>openai-java</name>

service/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
<parent>
77
<groupId>top.bella</groupId>
88
<artifactId>openai-java</artifactId>
9-
<version>0.23.32</version>
9+
<version>0.23.33</version>
1010
</parent>
1111
<packaging>jar</packaging>
1212

0 commit comments

Comments
 (0)