Skip to content

Commit 9d90f9e

Browse files
release: 0.19.0 (#188)
* test: use o1 in examples (#187) * feat(client): helpers for discriminated classes with one required prop (#189) * docs: fix incorrect additional properties info (#190) * docs: update breaking change expectations * release: 0.19.0 --------- Co-authored-by: stainless-app[bot] <142633134+stainless-app[bot]@users.noreply.github.com> Co-authored-by: Tomer Aberbach <[email protected]>
1 parent 41309c1 commit 9d90f9e

File tree

11 files changed

+56
-42
lines changed

11 files changed

+56
-42
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-
".": "0.18.1"
2+
".": "0.19.0"
33
}

CHANGELOG.md

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

3+
## 0.19.0 (2025-01-30)
4+
5+
Full Changelog: [v0.18.1...v0.19.0](https://github.com/openai/openai-java/compare/v0.18.1...v0.19.0)
6+
7+
### Features
8+
9+
* **client:** helpers for discriminated classes with one required prop ([#189](https://github.com/openai/openai-java/issues/189)) ([adbf4b0](https://github.com/openai/openai-java/commit/adbf4b0dd8d978586842e97ba628f8cf4e3484de))
10+
11+
12+
### Documentation
13+
14+
* fix incorrect additional properties info ([#190](https://github.com/openai/openai-java/issues/190)) ([3d443f7](https://github.com/openai/openai-java/commit/3d443f7e545036484b571f1893aa058725ca57f6))
15+
* update breaking change expectations ([ee4ee2b](https://github.com/openai/openai-java/commit/ee4ee2b876ac5e956fbd35a4e10ed4f21668ae03))
16+
317
## 0.18.1 (2025-01-29)
418

519
Full Changelog: [v0.18.0...v0.18.1](https://github.com/openai/openai-java/compare/v0.18.0...v0.18.1)

README.md

Lines changed: 19 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,14 @@
33
> [!NOTE]
44
> The OpenAI Java API Library is currently in _beta_.
55
>
6-
> There may be frequent breaking changes.
6+
> There may be minor breaking changes.
77
>
88
> Have thoughts or feedback? [File an issue](https://github.com/openai/openai-java/issues/new) or comment on [this thread](https://community.openai.com/t/your-feedback-requested-java-sdk/1061029).
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.18.1)
13-
[![javadoc](https://javadoc.io/badge2/com.openai/openai-java/0.18.1/javadoc.svg)](https://javadoc.io/doc/com.openai/openai-java/0.18.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.19.0)
13+
[![javadoc](https://javadoc.io/badge2/com.openai/openai-java/0.19.0/javadoc.svg)](https://javadoc.io/doc/com.openai/openai-java/0.19.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.18.1")
28+
implementation("com.openai:openai-java:0.19.0")
2929
```
3030

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

@@ -147,19 +147,7 @@ See [Pagination](#pagination) below for more information on transparently workin
147147

148148
To make a request to the OpenAI API, you generally build an instance of the appropriate `Params` class.
149149

150-
In [Example: creating a resource](#example-creating-a-resource) above, we used the `ChatCompletionCreateParams.builder()` to pass to the `create` method of the `completions` service.
151-
152-
Sometimes, the API may support other properties that are not yet supported in the Java SDK types. In that case, you can attach them using the `putAdditionalProperty` method.
153-
154-
```java
155-
import com.openai.core.JsonValue;
156-
import com.openai.models.ChatCompletionCreateParams;
157-
158-
ChatCompletionCreateParams params = ChatCompletionCreateParams.builder()
159-
// ... normal properties
160-
.putAdditionalProperty("secret_param", JsonValue.from("4242"))
161-
.build();
162-
```
150+
See [Undocumented request params](#undocumented-request-params) for how to send arbitrary parameters.
163151

164152
## Responses
165153

@@ -356,18 +344,26 @@ This library is typed for convenient access to the documented API. If you need t
356344

357345
### Undocumented request params
358346

359-
To make requests using undocumented parameters, you can provide or override parameters on the params object while building it.
347+
In [Example: creating a resource](#example-creating-a-resource) above, we used the `ChatCompletionCreateParams.builder()` to pass to the `create` method of the `completions` service.
348+
349+
Sometimes, the API may support other properties that are not yet supported in the Java SDK types. In that case, you can attach them using raw setters:
360350

361351
```java
362-
FooCreateParams address = FooCreateParams.builder()
363-
.id("my_id")
364-
.putAdditionalProperty("secret_prop", JsonValue.from("hello"))
352+
import com.openai.core.JsonValue;
353+
import com.openai.models.ChatCompletionCreateParams;
354+
355+
ChatCompletionCreateParams params = ChatCompletionCreateParams.builder()
356+
.putAdditionalHeader("Secret-Header", "42")
357+
.putAdditionalQueryParam("secret_query_param", "42")
358+
.putAdditionalBodyProperty("secretProperty", JsonValue.from("42"))
365359
.build();
366360
```
367361

362+
You can also use the `putAdditionalProperty` method on nested headers, query params, or body objects.
363+
368364
### Undocumented response properties
369365

370-
To access undocumented response properties, you can use `res._additionalProperties()` on a response object to get a map of untyped fields of type `Map<String, JsonValue>`. You can then access fields like `._additionalProperties().get("secret_prop").asString()` or use other helpers defined on the `JsonValue` class to extract it to a desired type.
366+
To access undocumented response properties, you can use `res._additionalProperties()` on a response object to get a map of untyped fields of type `Map<String, JsonValue>`. You can then access fields like `res._additionalProperties().get("secret_prop").asString()` or use other helpers defined on the `JsonValue` class to extract it to a desired type.
371367

372368
## Logging
373369

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 = "0.18.1" // x-release-please-version
11+
version = "0.19.0" // x-release-please-version
1212
}
1313

1414
subprojects {

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -644,6 +644,10 @@ private constructor(
644644
}
645645
}
646646

647+
/** A list of integrations to enable for this fine-tuning job. */
648+
fun addWandbIntegration(wandb: FineTuningJobWandbIntegration) =
649+
addIntegration(FineTuningJobWandbIntegrationObject.builder().wandb(wandb).build())
650+
647651
/** The method used for fine-tuning. */
648652
fun method(method: Method) = method(JsonField.of(method))
649653

openai-java-core/src/test/kotlin/com/openai/models/BetaAssistantCreateParamsTest.kt

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ class BetaAssistantCreateParamsTest {
1111
@Test
1212
fun createBetaAssistantCreateParams() {
1313
BetaAssistantCreateParams.builder()
14-
.model(ChatModel.GPT_4O)
14+
.model(ChatModel.O1)
1515
.description("description")
1616
.instructions("instructions")
1717
.metadata(JsonValue.from(mapOf<String, Any>()))
@@ -51,7 +51,7 @@ class BetaAssistantCreateParamsTest {
5151
fun body() {
5252
val params =
5353
BetaAssistantCreateParams.builder()
54-
.model(ChatModel.GPT_4O)
54+
.model(ChatModel.O1)
5555
.description("description")
5656
.instructions("instructions")
5757
.metadata(JsonValue.from(mapOf<String, Any>()))
@@ -87,7 +87,7 @@ class BetaAssistantCreateParamsTest {
8787
.build()
8888
val body = params._body()
8989
assertThat(body).isNotNull
90-
assertThat(body.model()).isEqualTo(ChatModel.GPT_4O)
90+
assertThat(body.model()).isEqualTo(ChatModel.O1)
9191
assertThat(body.description()).contains("description")
9292
assertThat(body.instructions()).contains("instructions")
9393
assertThat(body._metadata()).isEqualTo(JsonValue.from(mapOf<String, Any>()))
@@ -128,9 +128,9 @@ class BetaAssistantCreateParamsTest {
128128

129129
@Test
130130
fun bodyWithoutOptionalFields() {
131-
val params = BetaAssistantCreateParams.builder().model(ChatModel.GPT_4O).build()
131+
val params = BetaAssistantCreateParams.builder().model(ChatModel.O1).build()
132132
val body = params._body()
133133
assertThat(body).isNotNull
134-
assertThat(body.model()).isEqualTo(ChatModel.GPT_4O)
134+
assertThat(body.model()).isEqualTo(ChatModel.O1)
135135
}
136136
}

openai-java-core/src/test/kotlin/com/openai/models/BetaThreadCreateAndRunParamsTest.kt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ class BetaThreadCreateAndRunParamsTest {
1616
.maxCompletionTokens(256L)
1717
.maxPromptTokens(256L)
1818
.metadata(JsonValue.from(mapOf<String, Any>()))
19-
.model(ChatModel.GPT_4O)
19+
.model(ChatModel.O1)
2020
.parallelToolCalls(true)
2121
.responseFormatAuto()
2222
.temperature(1.0)
@@ -100,7 +100,7 @@ class BetaThreadCreateAndRunParamsTest {
100100
.maxCompletionTokens(256L)
101101
.maxPromptTokens(256L)
102102
.metadata(JsonValue.from(mapOf<String, Any>()))
103-
.model(ChatModel.GPT_4O)
103+
.model(ChatModel.O1)
104104
.parallelToolCalls(true)
105105
.responseFormatAuto()
106106
.temperature(1.0)
@@ -182,7 +182,7 @@ class BetaThreadCreateAndRunParamsTest {
182182
assertThat(body.maxCompletionTokens()).contains(256L)
183183
assertThat(body.maxPromptTokens()).contains(256L)
184184
assertThat(body._metadata()).isEqualTo(JsonValue.from(mapOf<String, Any>()))
185-
assertThat(body.model()).contains(ChatModel.GPT_4O)
185+
assertThat(body.model()).contains(ChatModel.O1)
186186
assertThat(body.parallelToolCalls()).contains(true)
187187
assertThat(body.responseFormat()).contains(AssistantResponseFormatOption.ofAuto())
188188
assertThat(body.temperature()).contains(1.0)

openai-java-core/src/test/kotlin/com/openai/models/BetaThreadRunCreateParamsTest.kt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ class BetaThreadRunCreateParamsTest {
3333
.maxCompletionTokens(256L)
3434
.maxPromptTokens(256L)
3535
.metadata(JsonValue.from(mapOf<String, Any>()))
36-
.model(ChatModel.GPT_4O)
36+
.model(ChatModel.O1)
3737
.parallelToolCalls(true)
3838
.responseFormatAuto()
3939
.temperature(1.0)
@@ -74,7 +74,7 @@ class BetaThreadRunCreateParamsTest {
7474
.maxCompletionTokens(256L)
7575
.maxPromptTokens(256L)
7676
.metadata(JsonValue.from(mapOf<String, Any>()))
77-
.model(ChatModel.GPT_4O)
77+
.model(ChatModel.O1)
7878
.parallelToolCalls(true)
7979
.responseFormatAuto()
8080
.temperature(1.0)
@@ -132,7 +132,7 @@ class BetaThreadRunCreateParamsTest {
132132
.maxCompletionTokens(256L)
133133
.maxPromptTokens(256L)
134134
.metadata(JsonValue.from(mapOf<String, Any>()))
135-
.model(ChatModel.GPT_4O)
135+
.model(ChatModel.O1)
136136
.parallelToolCalls(true)
137137
.responseFormatAuto()
138138
.temperature(1.0)
@@ -170,7 +170,7 @@ class BetaThreadRunCreateParamsTest {
170170
assertThat(body.maxCompletionTokens()).contains(256L)
171171
assertThat(body.maxPromptTokens()).contains(256L)
172172
assertThat(body._metadata()).isEqualTo(JsonValue.from(mapOf<String, Any>()))
173-
assertThat(body.model()).contains(ChatModel.GPT_4O)
173+
assertThat(body.model()).contains(ChatModel.O1)
174174
assertThat(body.parallelToolCalls()).contains(true)
175175
assertThat(body.responseFormat()).contains(AssistantResponseFormatOption.ofAuto())
176176
assertThat(body.temperature()).contains(1.0)

openai-java-core/src/test/kotlin/com/openai/services/blocking/beta/AssistantServiceTest.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ class AssistantServiceTest {
3030
val assistant =
3131
assistantService.create(
3232
BetaAssistantCreateParams.builder()
33-
.model(ChatModel.GPT_4O)
33+
.model(ChatModel.O1)
3434
.description("description")
3535
.instructions("instructions")
3636
.metadata(JsonValue.from(mapOf<String, Any>()))

openai-java-core/src/test/kotlin/com/openai/services/blocking/beta/ThreadServiceTest.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@ class ThreadServiceTest {
152152
.maxCompletionTokens(256L)
153153
.maxPromptTokens(256L)
154154
.metadata(JsonValue.from(mapOf<String, Any>()))
155-
.model(ChatModel.GPT_4O)
155+
.model(ChatModel.O1)
156156
.parallelToolCalls(true)
157157
.responseFormatAuto()
158158
.temperature(1.0)
@@ -251,7 +251,7 @@ class ThreadServiceTest {
251251
.maxCompletionTokens(256L)
252252
.maxPromptTokens(256L)
253253
.metadata(JsonValue.from(mapOf<String, Any>()))
254-
.model(ChatModel.GPT_4O)
254+
.model(ChatModel.O1)
255255
.parallelToolCalls(true)
256256
.responseFormatAuto()
257257
.temperature(1.0)

openai-java-core/src/test/kotlin/com/openai/services/blocking/beta/threads/RunServiceTest.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ class RunServiceTest {
5353
.maxCompletionTokens(256L)
5454
.maxPromptTokens(256L)
5555
.metadata(JsonValue.from(mapOf<String, Any>()))
56-
.model(ChatModel.GPT_4O)
56+
.model(ChatModel.O1)
5757
.parallelToolCalls(true)
5858
.responseFormatAuto()
5959
.temperature(1.0)
@@ -105,7 +105,7 @@ class RunServiceTest {
105105
.maxCompletionTokens(256L)
106106
.maxPromptTokens(256L)
107107
.metadata(JsonValue.from(mapOf<String, Any>()))
108-
.model(ChatModel.GPT_4O)
108+
.model(ChatModel.O1)
109109
.parallelToolCalls(true)
110110
.responseFormatAuto()
111111
.temperature(1.0)

0 commit comments

Comments
 (0)