Skip to content

Commit 6f9c783

Browse files
release: 3.1.2 (#589)
* fix(client): ensure correct binary content type chore(client): rename parameter * chore(internal): fix multipart tests * release: 3.1.2 --------- Co-authored-by: stainless-app[bot] <142633134+stainless-app[bot]@users.noreply.github.com>
1 parent 2f6940a commit 6f9c783

File tree

13 files changed

+78
-59
lines changed

13 files changed

+78
-59
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-
".": "3.1.1"
2+
".": "3.1.2"
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+
## 3.1.2 (2025-08-20)
4+
5+
Full Changelog: [v3.1.1...v3.1.2](https://github.com/openai/openai-java/compare/v3.1.1...v3.1.2)
6+
7+
### Bug Fixes
8+
9+
* **client:** ensure correct binary content type ([86386c9](https://github.com/openai/openai-java/commit/86386c923fe1856c56ca501795857d1ab150f908))
10+
11+
12+
### Chores
13+
14+
* **client:** rename parameter ([86386c9](https://github.com/openai/openai-java/commit/86386c923fe1856c56ca501795857d1ab150f908))
15+
* **internal:** fix multipart tests ([ea67d5d](https://github.com/openai/openai-java/commit/ea67d5df786add1c3d6549bcc94e835b795d3fca))
16+
317
## 3.1.1 (2025-08-20)
418

519
Full Changelog: [v3.1.0...v3.1.1](https://github.com/openai/openai-java/compare/v3.1.0...v3.1.1)

README.md

Lines changed: 7 additions & 7 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/3.1.1)
6-
[![javadoc](https://javadoc.io/badge2/com.openai/openai-java/3.1.1/javadoc.svg)](https://javadoc.io/doc/com.openai/openai-java/3.1.1)
5+
[![Maven Central](https://img.shields.io/maven-central/v/com.openai/openai-java)](https://central.sonatype.com/artifact/com.openai/openai-java/3.1.2)
6+
[![javadoc](https://javadoc.io/badge2/com.openai/openai-java/3.1.2/javadoc.svg)](https://javadoc.io/doc/com.openai/openai-java/3.1.2)
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/3.1.1).
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/3.1.2).
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:3.1.1")
27+
implementation("com.openai:openai-java:3.1.2")
2828
```
2929

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

@@ -1330,7 +1330,7 @@ If you're using Spring Boot, then you can use the SDK's [Spring Boot starter](ht
13301330
#### Gradle
13311331

13321332
```kotlin
1333-
implementation("com.openai:openai-java-spring-boot-starter:3.1.1")
1333+
implementation("com.openai:openai-java-spring-boot-starter:3.1.2")
13341334
```
13351335

13361336
#### Maven
@@ -1339,7 +1339,7 @@ implementation("com.openai:openai-java-spring-boot-starter:3.1.1")
13391339
<dependency>
13401340
<groupId>com.openai</groupId>
13411341
<artifactId>openai-java-spring-boot-starter</artifactId>
1342-
<version>3.1.1</version>
1342+
<version>3.1.2</version>
13431343
</dependency>
13441344
```
13451345

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

1414
subprojects {

openai-java-core/src/main/kotlin/com/openai/models/audio/transcriptions/TranscriptionCreateParams.kt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -286,7 +286,7 @@ private constructor(
286286
* The audio file object (not file name) to transcribe, in one of these formats: flac, mp3,
287287
* mp4, mpeg, mpga, m4a, ogg, wav, or webm.
288288
*/
289-
fun file(file: Path) = apply { body.file(file) }
289+
fun file(path: Path) = apply { body.file(path) }
290290

291291
/**
292292
* ID of the model to use. The options are `gpt-4o-transcribe`, `gpt-4o-mini-transcribe`,
@@ -897,11 +897,11 @@ private constructor(
897897
* The audio file object (not file name) to transcribe, in one of these formats: flac,
898898
* mp3, mp4, mpeg, mpga, m4a, ogg, wav, or webm.
899899
*/
900-
fun file(file: Path) =
900+
fun file(path: Path) =
901901
file(
902902
MultipartField.builder<InputStream>()
903-
.value(file.inputStream())
904-
.filename(file.name)
903+
.value(path.inputStream())
904+
.filename(path.name)
905905
.build()
906906
)
907907

openai-java-core/src/main/kotlin/com/openai/models/audio/translations/TranslationCreateParams.kt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -196,7 +196,7 @@ private constructor(
196196
* The audio file object (not file name) translate, in one of these formats: flac, mp3, mp4,
197197
* mpeg, mpga, m4a, ogg, wav, or webm.
198198
*/
199-
fun file(file: Path) = apply { body.file(file) }
199+
fun file(path: Path) = apply { body.file(path) }
200200

201201
/**
202202
* ID of the model to use. Only `whisper-1` (which is powered by our open source Whisper V2
@@ -599,11 +599,11 @@ private constructor(
599599
* The audio file object (not file name) translate, in one of these formats: flac, mp3,
600600
* mp4, mpeg, mpga, m4a, ogg, wav, or webm.
601601
*/
602-
fun file(file: Path) =
602+
fun file(path: Path) =
603603
file(
604604
MultipartField.builder<InputStream>()
605-
.value(file.inputStream())
606-
.filename(file.name)
605+
.value(path.inputStream())
606+
.filename(path.name)
607607
.build()
608608
)
609609

openai-java-core/src/main/kotlin/com/openai/models/containers/files/FileCreateParams.kt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ private constructor(
133133
fun file(file: ByteArray) = apply { body.file(file) }
134134

135135
/** The File object (not file name) to be uploaded. */
136-
fun file(file: Path) = apply { body.file(file) }
136+
fun file(path: Path) = apply { body.file(path) }
137137

138138
/** Name of the file to create. */
139139
fun fileId(fileId: String) = apply { body.fileId(fileId) }
@@ -377,11 +377,11 @@ private constructor(
377377
fun file(file: ByteArray) = file(file.inputStream())
378378

379379
/** The File object (not file name) to be uploaded. */
380-
fun file(file: Path) =
380+
fun file(path: Path) =
381381
file(
382382
MultipartField.builder<InputStream>()
383-
.value(file.inputStream())
384-
.filename(file.name)
383+
.value(path.inputStream())
384+
.filename(path.name)
385385
.build()
386386
)
387387

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

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,7 @@ private constructor(
161161
fun file(file: ByteArray) = apply { body.file(file) }
162162

163163
/** The File object (not file name) to be uploaded. */
164-
fun file(file: Path) = apply { body.file(file) }
164+
fun file(path: Path) = apply { body.file(path) }
165165

166166
/**
167167
* The intended purpose of the uploaded file. One of: - `assistants`: Used in the Assistants
@@ -461,11 +461,11 @@ private constructor(
461461
fun file(file: ByteArray) = file(file.inputStream())
462462

463463
/** The File object (not file name) to be uploaded. */
464-
fun file(file: Path) =
464+
fun file(path: Path) =
465465
file(
466466
MultipartField.builder<InputStream>()
467-
.value(file.inputStream())
468-
.filename(file.name)
467+
.value(path.inputStream())
468+
.filename(path.name)
469469
.build()
470470
)
471471

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

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -205,7 +205,7 @@ private constructor(
205205
* The image to use as the basis for the variation(s). Must be a valid PNG file, less than
206206
* 4MB, and square.
207207
*/
208-
fun image(image: Path) = apply { body.image(image) }
208+
fun image(path: Path) = apply { body.image(path) }
209209

210210
/** The model to use for image generation. Only `dall-e-2` is supported at this time. */
211211
fun model(model: ImageModel?) = apply { body.model(model) }
@@ -638,11 +638,11 @@ private constructor(
638638
* The image to use as the basis for the variation(s). Must be a valid PNG file, less
639639
* than 4MB, and square.
640640
*/
641-
fun image(image: Path) =
641+
fun image(path: Path) =
642642
image(
643643
MultipartField.builder<InputStream>()
644-
.value(image.inputStream())
645-
.filename(image.name)
644+
.value(path.inputStream())
645+
.filename(path.name)
646646
.build()
647647
)
648648

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

Lines changed: 16 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -390,7 +390,7 @@ private constructor(
390390
* For `dall-e-2`, you can only provide one image, and it should be a square `png` file less
391391
* than 4MB.
392392
*/
393-
fun image(inputStream: Path) = apply { body.image(inputStream) }
393+
fun image(path: Path) = apply { body.image(path) }
394394

395395
/** Alias for calling [image] with `Image.ofInputStreams(inputStreams)`. */
396396
fun imageOfInputStreams(inputStreams: List<InputStream>) = apply {
@@ -491,7 +491,7 @@ private constructor(
491491
* applied on the first image. Must be a valid PNG file, less than 4MB, and have the same
492492
* dimensions as `image`.
493493
*/
494-
fun mask(mask: Path) = apply { body.mask(mask) }
494+
fun mask(path: Path) = apply { body.mask(path) }
495495

496496
/**
497497
* The model to use for image generation. Only `dall-e-2` and `gpt-image-1` are supported.
@@ -1215,7 +1215,13 @@ private constructor(
12151215
* For `dall-e-2`, you can only provide one image, and it should be a square `png` file
12161216
* less than 4MB.
12171217
*/
1218-
fun image(image: Image) = image(MultipartField.of(image))
1218+
fun image(image: Image) =
1219+
image(
1220+
MultipartField.builder<Image>()
1221+
.value(image)
1222+
.contentType("application/octet-stream")
1223+
.build()
1224+
)
12191225

12201226
/**
12211227
* Sets [Builder.image] to an arbitrary multipart value.
@@ -1249,11 +1255,12 @@ private constructor(
12491255
* For `dall-e-2`, you can only provide one image, and it should be a square `png` file
12501256
* less than 4MB.
12511257
*/
1252-
fun image(inputStream: Path) =
1258+
fun image(path: Path) =
12531259
image(
12541260
MultipartField.builder<Image>()
1255-
.value(Image.ofInputStream(inputStream.inputStream()))
1256-
.filename(inputStream.name)
1261+
.value(Image.ofInputStream(path.inputStream()))
1262+
.contentType("application/octet-stream")
1263+
.filename(path.name)
12571264
.build()
12581265
)
12591266

@@ -1355,11 +1362,11 @@ private constructor(
13551362
* be applied on the first image. Must be a valid PNG file, less than 4MB, and have the
13561363
* same dimensions as `image`.
13571364
*/
1358-
fun mask(mask: Path) =
1365+
fun mask(path: Path) =
13591366
mask(
13601367
MultipartField.builder<InputStream>()
1361-
.value(mask.inputStream())
1362-
.filename(mask.name)
1368+
.value(path.inputStream())
1369+
.filename(path.name)
13631370
.build()
13641371
)
13651372

0 commit comments

Comments
 (0)