Skip to content

Commit 21f21e0

Browse files
authored
Merge pull request #653 from openai/release-please--branches--main--changes--next
release: 4.9.0
2 parents 5729c58 + babb353 commit 21f21e0

File tree

97 files changed

+5780
-651
lines changed

Some content is hidden

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

97 files changed

+5780
-651
lines changed

.release-please-manifest.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
{
2-
".": "4.8.0"
2+
".": "4.9.0"
33
}

.stats.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
configured_endpoints: 135
2-
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/openai%2Fopenai-ca24bc4d8125b5153514ce643c4e3220f25971b7d67ca384d56d493c72c0d977.yml
3-
openapi_spec_hash: c6f048c7b3d29f4de48fde0e845ba33f
4-
config_hash: b876221dfb213df9f0a999e75d38a65e
1+
configured_endpoints: 136
2+
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/openai%2Fopenai-fe8a79e6fd407e6c9afec60971f03076b65f711ccd6ea16457933b0e24fb1f6d.yml
3+
openapi_spec_hash: 38c0a73f4e08843732c5f8002a809104
4+
config_hash: 2c350086d87a4b4532077363087840e7

CHANGELOG.md

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,24 @@
11
# Changelog
22

3+
## 4.9.0 (2025-12-04)
4+
5+
Full Changelog: [v4.8.0...v4.9.0](https://github.com/openai/openai-java/compare/v4.8.0...v4.9.0)
6+
7+
### Features
8+
9+
* **api:** gpt-5.1-codex-max and responses/compact ([651c44f](https://github.com/openai/openai-java/commit/651c44f570ba07784d715a382d94b255fd3afa60))
10+
11+
12+
### Bug Fixes
13+
14+
* **api:** align types of input items / output items for typescript ([9202c69](https://github.com/openai/openai-java/commit/9202c695d939def7c9598e9ee75999b8ebd87e32))
15+
* **client:** cancel okhttp call when future cancelled ([c665e21](https://github.com/openai/openai-java/commit/c665e21c83123931baed5b21b9bbaa96a4d77495))
16+
17+
18+
### Documentation
19+
20+
* remove `$` for better copy-pasteabality ([66f7a4b](https://github.com/openai/openai-java/commit/66f7a4b3d2b88fc3e80c1552d0a0df86cd45c1ff))
21+
322
## 4.8.0 (2025-11-13)
423

524
Full Changelog: [v4.7.2...v4.8.0](https://github.com/openai/openai-java/compare/v4.7.2...v4.8.0)

README.md

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,16 @@
22

33
<!-- x-release-please-start-version -->
44

5-
[![Maven Central](https://img.shields.io/maven-central/v/com.openai/openai-java)](https://central.sonatype.com/artifact/com.openai/openai-java/4.8.0)
6-
[![javadoc](https://javadoc.io/badge2/com.openai/openai-java/4.8.0/javadoc.svg)](https://javadoc.io/doc/com.openai/openai-java/4.8.0)
5+
[![Maven Central](https://img.shields.io/maven-central/v/com.openai/openai-java)](https://central.sonatype.com/artifact/com.openai/openai-java/4.9.0)
6+
[![javadoc](https://javadoc.io/badge2/com.openai/openai-java/4.9.0/javadoc.svg)](https://javadoc.io/doc/com.openai/openai-java/4.9.0)
77

88
<!-- x-release-please-end -->
99

1010
The OpenAI Java SDK provides convenient access to the [OpenAI REST API](https://platform.openai.com/docs) from applications written in Java.
1111

1212
<!-- x-release-please-start-version -->
1313

14-
The REST API documentation can be found on [platform.openai.com](https://platform.openai.com/docs). Javadocs are available on [javadoc.io](https://javadoc.io/doc/com.openai/openai-java/4.8.0).
14+
The REST API documentation can be found on [platform.openai.com](https://platform.openai.com/docs). Javadocs are available on [javadoc.io](https://javadoc.io/doc/com.openai/openai-java/4.9.0).
1515

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

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

2626
```kotlin
27-
implementation("com.openai:openai-java:4.8.0")
27+
implementation("com.openai:openai-java:4.9.0")
2828
```
2929

3030
### Maven
@@ -33,7 +33,7 @@ implementation("com.openai:openai-java:4.8.0")
3333
<dependency>
3434
<groupId>com.openai</groupId>
3535
<artifactId>openai-java</artifactId>
36-
<version>4.8.0</version>
36+
<version>4.9.0</version>
3737
</dependency>
3838
```
3939

@@ -1310,13 +1310,13 @@ The SDK uses the standard [OkHttp logging interceptor](https://github.com/square
13101310
Enable logging by setting the `OPENAI_LOG` environment variable to `info`:
13111311

13121312
```sh
1313-
$ export OPENAI_LOG=info
1313+
export OPENAI_LOG=info
13141314
```
13151315

13161316
Or to `debug` for more verbose logging:
13171317

13181318
```sh
1319-
$ export OPENAI_LOG=debug
1319+
export OPENAI_LOG=debug
13201320
```
13211321

13221322
## ProGuard and R8
@@ -1342,7 +1342,7 @@ If you're using Spring Boot, then you can use the SDK's [Spring Boot starter](ht
13421342
#### Gradle
13431343

13441344
```kotlin
1345-
implementation("com.openai:openai-java-spring-boot-starter:4.8.0")
1345+
implementation("com.openai:openai-java-spring-boot-starter:4.9.0")
13461346
```
13471347

13481348
#### Maven
@@ -1351,7 +1351,7 @@ implementation("com.openai:openai-java-spring-boot-starter:4.8.0")
13511351
<dependency>
13521352
<groupId>com.openai</groupId>
13531353
<artifactId>openai-java-spring-boot-starter</artifactId>
1354-
<version>4.8.0</version>
1354+
<version>4.9.0</version>
13551355
</dependency>
13561356
```
13571357

build.gradle.kts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ repositories {
88

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

1414
subprojects {

gradle.properties

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@ org.gradle.caching=true
22
org.gradle.configuration-cache=true
33
org.gradle.parallel=true
44
org.gradle.daemon=false
5+
kotlin.daemon.enabled=false
6+
kotlin.compiler.execution.strategy=in-process
7+
kotlin.incremental=false
58
# These options improve our compilation and test performance. They are inherited by the Kotlin daemon.
69
org.gradle.jvmargs=\
710
-Xms2g \

openai-java-client-okhttp/build.gradle.kts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,4 +11,5 @@ dependencies {
1111

1212
testImplementation(kotlin("test"))
1313
testImplementation("org.assertj:assertj-core:3.25.3")
14+
testImplementation("com.github.tomakehurst:wiremock-jre8:2.35.2")
1415
}

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

Lines changed: 20 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ import java.io.IOException
1313
import java.io.InputStream
1414
import java.net.Proxy
1515
import java.time.Duration
16+
import java.util.concurrent.CancellationException
1617
import java.util.concurrent.CompletableFuture
1718
import javax.net.ssl.HostnameVerifier
1819
import javax.net.ssl.SSLSocketFactory
@@ -29,8 +30,8 @@ import okhttp3.Response
2930
import okhttp3.logging.HttpLoggingInterceptor
3031
import okio.BufferedSink
3132

32-
class OkHttpClient private constructor(private val okHttpClient: okhttp3.OkHttpClient) :
33-
HttpClient {
33+
class OkHttpClient
34+
private constructor(@JvmSynthetic internal val okHttpClient: okhttp3.OkHttpClient) : HttpClient {
3435

3536
override fun execute(request: HttpRequest, requestOptions: RequestOptions): HttpResponse {
3637
val call = newCall(request, requestOptions)
@@ -50,20 +51,25 @@ class OkHttpClient private constructor(private val okHttpClient: okhttp3.OkHttpC
5051
): CompletableFuture<HttpResponse> {
5152
val future = CompletableFuture<HttpResponse>()
5253

53-
request.body?.run { future.whenComplete { _, _ -> close() } }
54-
55-
newCall(request, requestOptions)
56-
.enqueue(
57-
object : Callback {
58-
override fun onResponse(call: Call, response: Response) {
59-
future.complete(response.toResponse())
60-
}
54+
val call = newCall(request, requestOptions)
55+
call.enqueue(
56+
object : Callback {
57+
override fun onResponse(call: Call, response: Response) {
58+
future.complete(response.toResponse())
59+
}
6160

62-
override fun onFailure(call: Call, e: IOException) {
63-
future.completeExceptionally(OpenAIIoException("Request failed", e))
64-
}
61+
override fun onFailure(call: Call, e: IOException) {
62+
future.completeExceptionally(OpenAIIoException("Request failed", e))
6563
}
66-
)
64+
}
65+
)
66+
67+
future.whenComplete { _, e ->
68+
if (e is CancellationException) {
69+
call.cancel()
70+
}
71+
request.body?.close()
72+
}
6773

6874
return future
6975
}
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
package com.openai.client.okhttp
2+
3+
import com.github.tomakehurst.wiremock.client.WireMock.*
4+
import com.github.tomakehurst.wiremock.junit5.WireMockRuntimeInfo
5+
import com.github.tomakehurst.wiremock.junit5.WireMockTest
6+
import com.openai.core.http.HttpMethod
7+
import com.openai.core.http.HttpRequest
8+
import org.assertj.core.api.Assertions.assertThat
9+
import org.junit.jupiter.api.BeforeEach
10+
import org.junit.jupiter.api.Test
11+
import org.junit.jupiter.api.parallel.ResourceLock
12+
13+
@WireMockTest
14+
@ResourceLock("https://github.com/wiremock/wiremock/issues/169")
15+
internal class OkHttpClientTest {
16+
17+
private lateinit var baseUrl: String
18+
private lateinit var httpClient: OkHttpClient
19+
20+
@BeforeEach
21+
fun beforeEach(wmRuntimeInfo: WireMockRuntimeInfo) {
22+
baseUrl = wmRuntimeInfo.httpBaseUrl
23+
httpClient = OkHttpClient.builder().build()
24+
}
25+
26+
@Test
27+
fun executeAsync_whenFutureCancelled_cancelsUnderlyingCall() {
28+
stubFor(post(urlPathEqualTo("/something")).willReturn(ok()))
29+
val responseFuture =
30+
httpClient.executeAsync(
31+
HttpRequest.builder()
32+
.method(HttpMethod.POST)
33+
.baseUrl(baseUrl)
34+
.addPathSegment("something")
35+
.build()
36+
)
37+
val call = httpClient.okHttpClient.dispatcher.runningCalls().single()
38+
39+
responseFuture.cancel(false)
40+
41+
// Should have cancelled the underlying call
42+
assertThat(call.isCanceled()).isTrue()
43+
}
44+
}

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

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -258,6 +258,8 @@ private constructor(
258258

259259
@JvmField val GPT_5_PRO_2025_10_06 = of("gpt-5-pro-2025-10-06")
260260

261+
@JvmField val GPT_5_1_CODEX_MAX = of("gpt-5.1-codex-max")
262+
261263
@JvmStatic fun of(value: String) = ResponsesOnlyModel(JsonField.of(value))
262264
}
263265

@@ -276,6 +278,7 @@ private constructor(
276278
GPT_5_CODEX,
277279
GPT_5_PRO,
278280
GPT_5_PRO_2025_10_06,
281+
GPT_5_1_CODEX_MAX,
279282
}
280283

281284
/**
@@ -301,6 +304,7 @@ private constructor(
301304
GPT_5_CODEX,
302305
GPT_5_PRO,
303306
GPT_5_PRO_2025_10_06,
307+
GPT_5_1_CODEX_MAX,
304308
/**
305309
* An enum member indicating that [ResponsesOnlyModel] was instantiated with an unknown
306310
* value.
@@ -330,6 +334,7 @@ private constructor(
330334
GPT_5_CODEX -> Value.GPT_5_CODEX
331335
GPT_5_PRO -> Value.GPT_5_PRO
332336
GPT_5_PRO_2025_10_06 -> Value.GPT_5_PRO_2025_10_06
337+
GPT_5_1_CODEX_MAX -> Value.GPT_5_1_CODEX_MAX
333338
else -> Value._UNKNOWN
334339
}
335340

@@ -357,6 +362,7 @@ private constructor(
357362
GPT_5_CODEX -> Known.GPT_5_CODEX
358363
GPT_5_PRO -> Known.GPT_5_PRO
359364
GPT_5_PRO_2025_10_06 -> Known.GPT_5_PRO_2025_10_06
365+
GPT_5_1_CODEX_MAX -> Known.GPT_5_1_CODEX_MAX
360366
else -> throw OpenAIInvalidDataException("Unknown ResponsesOnlyModel: $value")
361367
}
362368

0 commit comments

Comments
 (0)