Skip to content

Commit 6390dfd

Browse files
stainless-app[bot]TomerAberbachmssfang
authored
release: 0.22.0 (#210)
* fix(api): add missing `@MustBeClosed` annotations (#205) fix(api): switch `CompletableFuture<Void>` to `CompletableFuture<Void?>` fix(client): always provide a body for `PATCH` methods fix(client): add missing validation calls on response chore(internal): minor formatting/style changes chore(internal): rename some tests * fix(api): add missing reasoning effort + model enums (#207) * feat(pagination): avoid fetching when has_more: false (#209) * fix: deploymentModel arg * feat(api): Add more new Azure service versions (#208) * add more new Azure service version and update azure samples * revert samples changes * release: 0.22.0 --------- Co-authored-by: stainless-app[bot] <142633134+stainless-app[bot]@users.noreply.github.com> Co-authored-by: Tomer Aberbach <[email protected]> Co-authored-by: Shawn Fang <[email protected]>
1 parent 054403d commit 6390dfd

File tree

140 files changed

+2346
-868
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

140 files changed

+2346
-868
lines changed

.release-please-manifest.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
{
2-
".": "0.21.1"
2+
".": "0.22.0"
33
}

.stats.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
configured_endpoints: 61
2-
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/openai-fc5dbc19505b0035f9e7f88868619f4fb519b048bde011f6154f3132d4be71fb.yml
2+
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/openai-dfb00c627f58e5180af7a9b29ed2f2aa0764a3b9daa6a32a1cc45bc8e48dfe15.yml

CHANGELOG.md

+25
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,30 @@
11
# Changelog
22

3+
## 0.22.0 (2025-02-06)
4+
5+
Full Changelog: [v0.21.1...v0.22.0](https://github.com/openai/openai-java/compare/v0.21.1...v0.22.0)
6+
7+
### Features
8+
9+
* **api:** Add more new Azure service versions ([#208](https://github.com/openai/openai-java/issues/208)) ([a117892](https://github.com/openai/openai-java/commit/a11789220599540173f09d6cc9583365abe5f4e0))
10+
* **pagination:** avoid fetching when has_more: false ([#209](https://github.com/openai/openai-java/issues/209)) ([183b132](https://github.com/openai/openai-java/commit/183b132bba24beb90168fa77df84a93f0ea92fbe))
11+
12+
13+
### Bug Fixes
14+
15+
* **api:** add missing `@MustBeClosed` annotations ([#205](https://github.com/openai/openai-java/issues/205)) ([0a60b9a](https://github.com/openai/openai-java/commit/0a60b9a40ad7f97ed51be3f6a70d674a6a9f1854))
16+
* **api:** add missing reasoning effort + model enums ([#207](https://github.com/openai/openai-java/issues/207)) ([8eb2394](https://github.com/openai/openai-java/commit/8eb2394b4ea937b19720d97dae84ed56660845c0))
17+
* **api:** switch `CompletableFuture&lt;Void&gt;` to `CompletableFuture<Void?>` ([0a60b9a](https://github.com/openai/openai-java/commit/0a60b9a40ad7f97ed51be3f6a70d674a6a9f1854))
18+
* **client:** add missing validation calls on response ([0a60b9a](https://github.com/openai/openai-java/commit/0a60b9a40ad7f97ed51be3f6a70d674a6a9f1854))
19+
* **client:** always provide a body for `PATCH` methods ([0a60b9a](https://github.com/openai/openai-java/commit/0a60b9a40ad7f97ed51be3f6a70d674a6a9f1854))
20+
* deploymentModel arg ([3ab4110](https://github.com/openai/openai-java/commit/3ab41105d8b3fbb3db24ee96e825611f27713bb2))
21+
22+
23+
### Chores
24+
25+
* **internal:** minor formatting/style changes ([0a60b9a](https://github.com/openai/openai-java/commit/0a60b9a40ad7f97ed51be3f6a70d674a6a9f1854))
26+
* **internal:** rename some tests ([0a60b9a](https://github.com/openai/openai-java/commit/0a60b9a40ad7f97ed51be3f6a70d674a6a9f1854))
27+
328
## 0.21.1 (2025-02-05)
429

530
Full Changelog: [v0.21.0...v0.21.1](https://github.com/openai/openai-java/compare/v0.21.0...v0.21.1)

README.md

+4-4
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@
99
1010
<!-- x-release-please-start-version -->
1111

12-
[![Maven Central](https://img.shields.io/maven-central/v/com.openai/openai-java)](https://central.sonatype.com/artifact/com.openai/openai-java/0.21.1)
13-
[![javadoc](https://javadoc.io/badge2/com.openai/openai-java/0.21.1/javadoc.svg)](https://javadoc.io/doc/com.openai/openai-java/0.21.1)
12+
[![Maven Central](https://img.shields.io/maven-central/v/com.openai/openai-java)](https://central.sonatype.com/artifact/com.openai/openai-java/0.22.0)
13+
[![javadoc](https://javadoc.io/badge2/com.openai/openai-java/0.22.0/javadoc.svg)](https://javadoc.io/doc/com.openai/openai-java/0.22.0)
1414

1515
<!-- x-release-please-end -->
1616

@@ -25,7 +25,7 @@ The REST API documentation can be found on [platform.openai.com](https://platfor
2525
### Gradle
2626

2727
```kotlin
28-
implementation("com.openai:openai-java:0.21.1")
28+
implementation("com.openai:openai-java:0.22.0")
2929
```
3030

3131
### Maven
@@ -34,7 +34,7 @@ implementation("com.openai:openai-java:0.21.1")
3434
<dependency>
3535
<groupId>com.openai</groupId>
3636
<artifactId>openai-java</artifactId>
37-
<version>0.21.1</version>
37+
<version>0.22.0</version>
3838
</dependency>
3939
```
4040

build.gradle.kts

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ repositories {
88

99
allprojects {
1010
group = "com.openai"
11-
version = "0.21.1" // x-release-please-version
11+
version = "0.22.0" // x-release-please-version
1212
}
1313

1414
subprojects {

openai-java-client-okhttp/src/main/kotlin/com/openai/client/okhttp/OkHttpClient.kt

+10-2
Original file line numberDiff line numberDiff line change
@@ -106,8 +106,7 @@ private constructor(private val okHttpClient: okhttp3.OkHttpClient, private val
106106

107107
private fun HttpRequest.toRequest(client: okhttp3.OkHttpClient): Request {
108108
var body: RequestBody? = body?.toRequestBody()
109-
// OkHttpClient always requires a request body for PUT and POST methods.
110-
if (body == null && (method == HttpMethod.PUT || method == HttpMethod.POST)) {
109+
if (body == null && requiresBody(method)) {
111110
body = "".toRequestBody()
112111
}
113112

@@ -134,6 +133,15 @@ private constructor(private val okHttpClient: okhttp3.OkHttpClient, private val
134133
return builder.build()
135134
}
136135

136+
/** `OkHttpClient` always requires a request body for some methods. */
137+
private fun requiresBody(method: HttpMethod): Boolean =
138+
when (method) {
139+
HttpMethod.POST,
140+
HttpMethod.PUT,
141+
HttpMethod.PATCH -> true
142+
else -> false
143+
}
144+
137145
private fun HttpRequest.toUrl(): String {
138146
url?.let {
139147
return it

openai-java-core/src/main/kotlin/com/openai/azure/AzureOpenAIServiceVersion.kt

+4
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ class AzureOpenAIServiceVersion private constructor(@get:JvmName("value") val va
1616
@JvmStatic val V2023_05_15 = fromString("2023-05-15")
1717
@JvmStatic val V2024_02_01 = fromString("2024-02-01")
1818
@JvmStatic val V2024_06_01 = fromString("2024-06-01")
19+
@JvmStatic val V2024_10_21 = fromString("2024-10-21")
1920
@JvmStatic val V2023_06_01_PREVIEW = fromString("2023-06-01-preview")
2021
@JvmStatic val V2023_07_01_PREVIEW = fromString("2023-07-01-preview")
2122
@JvmStatic val V2024_02_15_PREVIEW = fromString("2024-02-15-preview")
@@ -25,6 +26,9 @@ class AzureOpenAIServiceVersion private constructor(@get:JvmName("value") val va
2526
@JvmStatic val V2024_07_01_PREVIEW = fromString("2024-07-01-preview")
2627
@JvmStatic val V2024_08_01_PREVIEW = fromString("2024-08-01-preview")
2728
@JvmStatic val V2024_09_01_PREVIEW = fromString("2024-09-01-preview")
29+
@JvmStatic val V2024_10_01_PREVIEW = fromString("2024-10-01-preview")
30+
@JvmStatic val V2024_12_01_PREVIEW = fromString("2024-12-01-preview")
31+
@JvmStatic val V2025_01_01_PREVIEW = fromString("2025-01-01-preview")
2832
}
2933

3034
override fun equals(other: Any?): Boolean =

openai-java-core/src/main/kotlin/com/openai/core/ClientOptions.kt

+2-2
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ package com.openai.core
44

55
import com.fasterxml.jackson.databind.json.JsonMapper
66
import com.openai.azure.AzureOpenAIServiceVersion
7-
import com.openai.azure.AzureOpenAIServiceVersion.Companion.V2024_06_01
7+
import com.openai.azure.AzureOpenAIServiceVersion.Companion.V2024_10_21
88
import com.openai.azure.credential.AzureApiKeyCredential
99
import com.openai.core.http.Headers
1010
import com.openai.core.http.HttpClient
@@ -262,7 +262,7 @@ private constructor(
262262
// Default Azure OpenAI version is used if Azure user doesn't
263263
// specific a service API version in 'queryParams'.
264264
// We can update the default value every major announcement if needed.
265-
replaceQueryParams("api-version", (azureServiceVersion ?: V2024_06_01).value)
265+
replaceQueryParams("api-version", (azureServiceVersion ?: V2024_10_21).value)
266266
}
267267

268268
headers.replaceAll(this.headers.build())

openai-java-core/src/main/kotlin/com/openai/models/BatchListPage.kt

+25-4
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,8 @@ private constructor(
3131

3232
fun data(): List<Batch> = response().data()
3333

34+
fun hasMore(): Optional<Boolean> = response().hasMore()
35+
3436
override fun equals(other: Any?): Boolean {
3537
if (this === other) {
3638
return true
@@ -78,15 +80,21 @@ private constructor(
7880
@JsonCreator
7981
constructor(
8082
@JsonProperty("data") private val data: JsonField<List<Batch>> = JsonMissing.of(),
83+
@JsonProperty("has_more") private val hasMore: JsonField<Boolean> = JsonMissing.of(),
8184
@JsonAnySetter
8285
private val additionalProperties: Map<String, JsonValue> = immutableEmptyMap(),
8386
) {
8487

8588
fun data(): List<Batch> = data.getNullable("data") ?: listOf()
8689

90+
fun hasMore(): Optional<Boolean> = Optional.ofNullable(hasMore.getNullable("has_more"))
91+
8792
@JsonProperty("data")
8893
fun _data(): Optional<JsonField<List<Batch>>> = Optional.ofNullable(data)
8994

95+
@JsonProperty("has_more")
96+
fun _hasMore(): Optional<JsonField<Boolean>> = Optional.ofNullable(hasMore)
97+
9098
@JsonAnyGetter
9199
@ExcludeMissing
92100
fun _additionalProperties(): Map<String, JsonValue> = additionalProperties
@@ -99,6 +107,7 @@ private constructor(
99107
}
100108

101109
data().map { it.validate() }
110+
hasMore()
102111
validated = true
103112
}
104113

@@ -109,12 +118,13 @@ private constructor(
109118
return true
110119
}
111120

112-
return /* spotless:off */ other is Response && data == other.data && additionalProperties == other.additionalProperties /* spotless:on */
121+
return /* spotless:off */ other is Response && data == other.data && hasMore == other.hasMore && additionalProperties == other.additionalProperties /* spotless:on */
113122
}
114123

115-
override fun hashCode(): Int = /* spotless:off */ Objects.hash(data, additionalProperties) /* spotless:on */
124+
override fun hashCode(): Int = /* spotless:off */ Objects.hash(data, hasMore, additionalProperties) /* spotless:on */
116125

117-
override fun toString() = "Response{data=$data, additionalProperties=$additionalProperties}"
126+
override fun toString() =
127+
"Response{data=$data, hasMore=$hasMore, additionalProperties=$additionalProperties}"
118128

119129
companion object {
120130

@@ -124,23 +134,34 @@ private constructor(
124134
class Builder {
125135

126136
private var data: JsonField<List<Batch>> = JsonMissing.of()
137+
private var hasMore: JsonField<Boolean> = JsonMissing.of()
127138
private var additionalProperties: MutableMap<String, JsonValue> = mutableMapOf()
128139

129140
@JvmSynthetic
130141
internal fun from(page: Response) = apply {
131142
this.data = page.data
143+
this.hasMore = page.hasMore
132144
this.additionalProperties.putAll(page.additionalProperties)
133145
}
134146

135147
fun data(data: List<Batch>) = data(JsonField.of(data))
136148

137149
fun data(data: JsonField<List<Batch>>) = apply { this.data = data }
138150

151+
fun hasMore(hasMore: Boolean) = hasMore(JsonField.of(hasMore))
152+
153+
fun hasMore(hasMore: JsonField<Boolean>) = apply { this.hasMore = hasMore }
154+
139155
fun putAdditionalProperty(key: String, value: JsonValue) = apply {
140156
this.additionalProperties.put(key, value)
141157
}
142158

143-
fun build() = Response(data, additionalProperties.toImmutable())
159+
fun build() =
160+
Response(
161+
data,
162+
hasMore,
163+
additionalProperties.toImmutable(),
164+
)
144165
}
145166
}
146167

openai-java-core/src/main/kotlin/com/openai/models/BatchListPageAsync.kt

+25-4
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,8 @@ private constructor(
3232

3333
fun data(): List<Batch> = response().data()
3434

35+
fun hasMore(): Optional<Boolean> = response().hasMore()
36+
3537
override fun equals(other: Any?): Boolean {
3638
if (this === other) {
3739
return true
@@ -81,15 +83,21 @@ private constructor(
8183
@JsonCreator
8284
constructor(
8385
@JsonProperty("data") private val data: JsonField<List<Batch>> = JsonMissing.of(),
86+
@JsonProperty("has_more") private val hasMore: JsonField<Boolean> = JsonMissing.of(),
8487
@JsonAnySetter
8588
private val additionalProperties: Map<String, JsonValue> = immutableEmptyMap(),
8689
) {
8790

8891
fun data(): List<Batch> = data.getNullable("data") ?: listOf()
8992

93+
fun hasMore(): Optional<Boolean> = Optional.ofNullable(hasMore.getNullable("has_more"))
94+
9095
@JsonProperty("data")
9196
fun _data(): Optional<JsonField<List<Batch>>> = Optional.ofNullable(data)
9297

98+
@JsonProperty("has_more")
99+
fun _hasMore(): Optional<JsonField<Boolean>> = Optional.ofNullable(hasMore)
100+
93101
@JsonAnyGetter
94102
@ExcludeMissing
95103
fun _additionalProperties(): Map<String, JsonValue> = additionalProperties
@@ -102,6 +110,7 @@ private constructor(
102110
}
103111

104112
data().map { it.validate() }
113+
hasMore()
105114
validated = true
106115
}
107116

@@ -112,12 +121,13 @@ private constructor(
112121
return true
113122
}
114123

115-
return /* spotless:off */ other is Response && data == other.data && additionalProperties == other.additionalProperties /* spotless:on */
124+
return /* spotless:off */ other is Response && data == other.data && hasMore == other.hasMore && additionalProperties == other.additionalProperties /* spotless:on */
116125
}
117126

118-
override fun hashCode(): Int = /* spotless:off */ Objects.hash(data, additionalProperties) /* spotless:on */
127+
override fun hashCode(): Int = /* spotless:off */ Objects.hash(data, hasMore, additionalProperties) /* spotless:on */
119128

120-
override fun toString() = "Response{data=$data, additionalProperties=$additionalProperties}"
129+
override fun toString() =
130+
"Response{data=$data, hasMore=$hasMore, additionalProperties=$additionalProperties}"
121131

122132
companion object {
123133

@@ -127,23 +137,34 @@ private constructor(
127137
class Builder {
128138

129139
private var data: JsonField<List<Batch>> = JsonMissing.of()
140+
private var hasMore: JsonField<Boolean> = JsonMissing.of()
130141
private var additionalProperties: MutableMap<String, JsonValue> = mutableMapOf()
131142

132143
@JvmSynthetic
133144
internal fun from(page: Response) = apply {
134145
this.data = page.data
146+
this.hasMore = page.hasMore
135147
this.additionalProperties.putAll(page.additionalProperties)
136148
}
137149

138150
fun data(data: List<Batch>) = data(JsonField.of(data))
139151

140152
fun data(data: JsonField<List<Batch>>) = apply { this.data = data }
141153

154+
fun hasMore(hasMore: Boolean) = hasMore(JsonField.of(hasMore))
155+
156+
fun hasMore(hasMore: JsonField<Boolean>) = apply { this.hasMore = hasMore }
157+
142158
fun putAdditionalProperty(key: String, value: JsonValue) = apply {
143159
this.additionalProperties.put(key, value)
144160
}
145161

146-
fun build() = Response(data, additionalProperties.toImmutable())
162+
fun build() =
163+
Response(
164+
data,
165+
hasMore,
166+
additionalProperties.toImmutable(),
167+
)
147168
}
148169
}
149170

0 commit comments

Comments
 (0)