Skip to content

Commit 37060dd

Browse files
authored
Merge pull request #19 from muverystrong/feat/batch-complete
feat: batch domain add isComplete method
2 parents 0549d94 + 4d02187 commit 37060dd

File tree

5 files changed

+13
-4
lines changed

5 files changed

+13
-4
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.93</version>
9+
<version>0.23.94</version>
1010
</parent>
1111
<packaging>jar</packaging>
1212
<artifactId>openai-api</artifactId>

api/src/main/java/com/theokanning/openai/batch/Batch.java

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
package com.theokanning.openai.batch;
22

3+
import com.fasterxml.jackson.annotation.JsonIgnore;
34
import com.fasterxml.jackson.annotation.JsonProperty;
45
import lombok.AllArgsConstructor;
56
import lombok.Data;
@@ -126,4 +127,12 @@ public class Batch {
126127
*/
127128

128129
Map<String, String> metadata;
130+
131+
@JsonIgnore
132+
public boolean isCompleted() {
133+
long total = getRequestCounts().getTotal();
134+
long completed = getRequestCounts().getCompleted();
135+
long failed = getRequestCounts().getFailed();
136+
return completed + failed >= total;
137+
}
129138
}

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.93</version>
9+
<version>0.23.94</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.93</version>
8+
<version>0.23.94</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.93</version>
9+
<version>0.23.94</version>
1010
</parent>
1111
<packaging>jar</packaging>
1212

0 commit comments

Comments
 (0)