Skip to content

Commit 3c78e3a

Browse files
stainless-app[bot]nuclear-beanTomerAberbach
authored
release: 1.5.1 (#450)
* chore(ci): run on more branches and use depot runners * chore(ci): only use depot for staging repos * docs: add responses input file example (#446) * ResponseInputFileExample.java * add example PDF file and fix lint * refactor: rename example file * refactor: slight example chnages --------- Co-authored-by: Tomer Aberbach <[email protected]> * fix(client): add missing convenience methods chore(internal): use `byteInputStream()` in tests * chore: run formatter * chore(internal): java 17 -> 21 on ci * release: 1.5.1 --------- Co-authored-by: stainless-app[bot] <142633134+stainless-app[bot]@users.noreply.github.com> Co-authored-by: nuclear bean <[email protected]> Co-authored-by: Tomer Aberbach <[email protected]>
1 parent f8cd21e commit 3c78e3a

24 files changed

+179
-65
lines changed

.github/workflows/ci.yml

+13-12
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,19 @@
11
name: CI
22
on:
33
push:
4-
branches:
5-
- main
6-
pull_request:
7-
branches:
8-
- main
9-
- next
4+
branches-ignore:
5+
- 'generated'
6+
- 'codegen/**'
7+
- 'integrated/**'
8+
- 'stl-preview-head/**'
9+
- 'stl-preview-base/**'
1010

1111
jobs:
1212
lint:
1313
timeout-minutes: 10
1414
name: lint
15-
runs-on: ubuntu-latest
15+
runs-on: ${{ github.repository == 'stainless-sdks/openai-java' && 'depot-ubuntu-24.04' || 'ubuntu-latest' }}
16+
1617
steps:
1718
- uses: actions/checkout@v4
1819

@@ -22,7 +23,7 @@ jobs:
2223
distribution: temurin
2324
java-version: |
2425
8
25-
17
26+
21
2627
cache: gradle
2728

2829
- name: Set up Gradle
@@ -33,7 +34,7 @@ jobs:
3334
test:
3435
timeout-minutes: 10
3536
name: test
36-
runs-on: ubuntu-latest
37+
runs-on: ${{ github.repository == 'stainless-sdks/openai-java' && 'depot-ubuntu-24.04' || 'ubuntu-latest' }}
3738
steps:
3839
- uses: actions/checkout@v4
3940

@@ -43,7 +44,7 @@ jobs:
4344
distribution: temurin
4445
java-version: |
4546
8
46-
17
47+
21
4748
cache: gradle
4849

4950
- name: Set up Gradle
@@ -54,7 +55,7 @@ jobs:
5455
examples:
5556
timeout-minutes: 10
5657
name: examples
57-
runs-on: ubuntu-latest
58+
runs-on: ${{ github.repository == 'stainless-sdks/openai-java' && 'depot-ubuntu-24.04' || 'ubuntu-latest' }}
5859
if: github.repository == 'openai/openai-java'
5960

6061
steps:
@@ -66,7 +67,7 @@ jobs:
6667
distribution: temurin
6768
java-version: |
6869
8
69-
17
70+
21
7071
cache: gradle
7172
- name: Set up Gradle
7273
uses: gradle/gradle-build-action@v2

.release-please-manifest.json

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

CHANGELOG.md

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

3+
## 1.5.1 (2025-04-27)
4+
5+
Full Changelog: [v1.5.0...v1.5.1](https://github.com/openai/openai-java/compare/v1.5.0...v1.5.1)
6+
7+
### Bug Fixes
8+
9+
* **client:** add missing convenience methods ([616d69a](https://github.com/openai/openai-java/commit/616d69a27a914e30d6cb2c4fa96613bf64488742))
10+
11+
12+
### Chores
13+
14+
* **ci:** only use depot for staging repos ([7835140](https://github.com/openai/openai-java/commit/78351404be50f6e535028a98d14d64257eeb2002))
15+
* **ci:** run on more branches and use depot runners ([8b7a805](https://github.com/openai/openai-java/commit/8b7a805083123a222ebc623e4c405d2f1ccf228b))
16+
* **internal:** java 17 -&gt; 21 on ci ([9f690e4](https://github.com/openai/openai-java/commit/9f690e42c91642bcda690bd398803ba401958397))
17+
* **internal:** use `byteInputStream()` in tests ([616d69a](https://github.com/openai/openai-java/commit/616d69a27a914e30d6cb2c4fa96613bf64488742))
18+
* run formatter ([5e78fa5](https://github.com/openai/openai-java/commit/5e78fa544ddc7942795bf5055c2010f9b42b198e))
19+
20+
21+
### Documentation
22+
23+
* add responses input file example ([#446](https://github.com/openai/openai-java/issues/446)) ([b94d404](https://github.com/openai/openai-java/commit/b94d4044ba764de789af3d19ac406ad8667c029d))
24+
325
## 1.5.0 (2025-04-23)
426

527
Full Changelog: [v1.4.1...v1.5.0](https://github.com/openai/openai-java/compare/v1.4.1...v1.5.0)

README.md

+5-5
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/1.5.0)
6-
[![javadoc](https://javadoc.io/badge2/com.openai/openai-java/1.5.0/javadoc.svg)](https://javadoc.io/doc/com.openai/openai-java/1.5.0)
5+
[![Maven Central](https://img.shields.io/maven-central/v/com.openai/openai-java)](https://central.sonatype.com/artifact/com.openai/openai-java/1.5.1)
6+
[![javadoc](https://javadoc.io/badge2/com.openai/openai-java/1.5.1/javadoc.svg)](https://javadoc.io/doc/com.openai/openai-java/1.5.1)
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/1.5.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/1.5.1).
1515

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

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

2424
```kotlin
25-
implementation("com.openai:openai-java:1.5.0")
25+
implementation("com.openai:openai-java:1.5.1")
2626
```
2727

2828
### Maven
@@ -31,7 +31,7 @@ implementation("com.openai:openai-java:1.5.0")
3131
<dependency>
3232
<groupId>com.openai</groupId>
3333
<artifactId>openai-java</artifactId>
34-
<version>1.5.0</version>
34+
<version>1.5.1</version>
3535
</dependency>
3636
```
3737

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

1414
subprojects {

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

+38
Original file line numberDiff line numberDiff line change
@@ -263,6 +263,22 @@ private constructor(
263263
/** Alias for calling [image] with `Image.ofInputStream(inputStream)`. */
264264
fun image(inputStream: InputStream) = apply { body.image(inputStream) }
265265

266+
/**
267+
* The image(s) to edit. Must be a supported image file or an array of images. For
268+
* `gpt-image-1`, each image should be a `png`, `webp`, or `jpg` file less than 25MB. For
269+
* `dall-e-2`, you can only provide one image, and it should be a square `png` file less
270+
* than 4MB.
271+
*/
272+
fun image(inputStream: ByteArray) = apply { body.image(inputStream) }
273+
274+
/**
275+
* The image(s) to edit. Must be a supported image file or an array of images. For
276+
* `gpt-image-1`, each image should be a `png`, `webp`, or `jpg` file less than 25MB. For
277+
* `dall-e-2`, you can only provide one image, and it should be a square `png` file less
278+
* than 4MB.
279+
*/
280+
fun image(inputStream: Path) = apply { body.image(inputStream) }
281+
266282
/** Alias for calling [image] with `Image.ofInputStreams(inputStreams)`. */
267283
fun imageOfInputStreams(inputStreams: List<InputStream>) = apply {
268284
body.imageOfInputStreams(inputStreams)
@@ -803,6 +819,28 @@ private constructor(
803819
/** Alias for calling [image] with `Image.ofInputStream(inputStream)`. */
804820
fun image(inputStream: InputStream) = image(Image.ofInputStream(inputStream))
805821

822+
/**
823+
* The image(s) to edit. Must be a supported image file or an array of images. For
824+
* `gpt-image-1`, each image should be a `png`, `webp`, or `jpg` file less than 25MB.
825+
* For `dall-e-2`, you can only provide one image, and it should be a square `png` file
826+
* less than 4MB.
827+
*/
828+
fun image(inputStream: ByteArray) = image(inputStream.inputStream())
829+
830+
/**
831+
* The image(s) to edit. Must be a supported image file or an array of images. For
832+
* `gpt-image-1`, each image should be a `png`, `webp`, or `jpg` file less than 25MB.
833+
* For `dall-e-2`, you can only provide one image, and it should be a square `png` file
834+
* less than 4MB.
835+
*/
836+
fun image(inputStream: Path) =
837+
image(
838+
MultipartField.builder<Image>()
839+
.value(Image.ofInputStream(inputStream.inputStream()))
840+
.filename(inputStream.name)
841+
.build()
842+
)
843+
806844
/** Alias for calling [image] with `Image.ofInputStreams(inputStreams)`. */
807845
fun imageOfInputStreams(inputStreams: List<InputStream>) =
808846
image(Image.ofInputStreams(inputStreams))

openai-java-core/src/test/kotlin/com/openai/models/audio/transcriptions/TranscriptionCreateParamsTest.kt

+5-5
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ internal class TranscriptionCreateParamsTest {
1414
@Test
1515
fun create() {
1616
TranscriptionCreateParams.builder()
17-
.file("some content".toByteArray())
17+
.file("some content".byteInputStream())
1818
.model(AudioModel.WHISPER_1)
1919
.addInclude(TranscriptionInclude.LOGPROBS)
2020
.language("language")
@@ -29,7 +29,7 @@ internal class TranscriptionCreateParamsTest {
2929
fun body() {
3030
val params =
3131
TranscriptionCreateParams.builder()
32-
.file("some content".toByteArray())
32+
.file("some content".byteInputStream())
3333
.model(AudioModel.WHISPER_1)
3434
.addInclude(TranscriptionInclude.LOGPROBS)
3535
.language("language")
@@ -51,7 +51,7 @@ internal class TranscriptionCreateParamsTest {
5151
)
5252
.isEqualTo(
5353
mapOf(
54-
"file" to MultipartField.of("some content".toByteArray()),
54+
"file" to MultipartField.of("some content".byteInputStream()),
5555
"model" to MultipartField.of(AudioModel.WHISPER_1),
5656
"include" to MultipartField.of(listOf(TranscriptionInclude.LOGPROBS)),
5757
"language" to MultipartField.of("language"),
@@ -73,7 +73,7 @@ internal class TranscriptionCreateParamsTest {
7373
fun bodyWithoutOptionalFields() {
7474
val params =
7575
TranscriptionCreateParams.builder()
76-
.file("some content".toByteArray())
76+
.file("some content".byteInputStream())
7777
.model(AudioModel.WHISPER_1)
7878
.build()
7979

@@ -89,7 +89,7 @@ internal class TranscriptionCreateParamsTest {
8989
)
9090
.isEqualTo(
9191
mapOf(
92-
"file" to MultipartField.of("some content".toByteArray()),
92+
"file" to MultipartField.of("some content".byteInputStream()),
9393
"model" to MultipartField.of(AudioModel.WHISPER_1),
9494
)
9595
.mapValues { (_, field) ->

openai-java-core/src/test/kotlin/com/openai/models/audio/translations/TranslationCreateParamsTest.kt

+5-5
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ internal class TranslationCreateParamsTest {
1313
@Test
1414
fun create() {
1515
TranslationCreateParams.builder()
16-
.file("some content".toByteArray())
16+
.file("some content".byteInputStream())
1717
.model(AudioModel.WHISPER_1)
1818
.prompt("prompt")
1919
.responseFormat(TranslationCreateParams.ResponseFormat.JSON)
@@ -25,7 +25,7 @@ internal class TranslationCreateParamsTest {
2525
fun body() {
2626
val params =
2727
TranslationCreateParams.builder()
28-
.file("some content".toByteArray())
28+
.file("some content".byteInputStream())
2929
.model(AudioModel.WHISPER_1)
3030
.prompt("prompt")
3131
.responseFormat(TranslationCreateParams.ResponseFormat.JSON)
@@ -44,7 +44,7 @@ internal class TranslationCreateParamsTest {
4444
)
4545
.isEqualTo(
4646
mapOf(
47-
"file" to MultipartField.of("some content".toByteArray()),
47+
"file" to MultipartField.of("some content".byteInputStream()),
4848
"model" to MultipartField.of(AudioModel.WHISPER_1),
4949
"prompt" to MultipartField.of("prompt"),
5050
"response_format" to
@@ -61,7 +61,7 @@ internal class TranslationCreateParamsTest {
6161
fun bodyWithoutOptionalFields() {
6262
val params =
6363
TranslationCreateParams.builder()
64-
.file("some content".toByteArray())
64+
.file("some content".byteInputStream())
6565
.model(AudioModel.WHISPER_1)
6666
.build()
6767

@@ -77,7 +77,7 @@ internal class TranslationCreateParamsTest {
7777
)
7878
.isEqualTo(
7979
mapOf(
80-
"file" to MultipartField.of("some content".toByteArray()),
80+
"file" to MultipartField.of("some content".byteInputStream()),
8181
"model" to MultipartField.of(AudioModel.WHISPER_1),
8282
)
8383
.mapValues { (_, field) ->

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

+3-3
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ internal class FileCreateParamsTest {
1212
@Test
1313
fun create() {
1414
FileCreateParams.builder()
15-
.file("some content".toByteArray())
15+
.file("some content".byteInputStream())
1616
.purpose(FilePurpose.ASSISTANTS)
1717
.build()
1818
}
@@ -21,7 +21,7 @@ internal class FileCreateParamsTest {
2121
fun body() {
2222
val params =
2323
FileCreateParams.builder()
24-
.file("some content".toByteArray())
24+
.file("some content".byteInputStream())
2525
.purpose(FilePurpose.ASSISTANTS)
2626
.build()
2727

@@ -37,7 +37,7 @@ internal class FileCreateParamsTest {
3737
)
3838
.isEqualTo(
3939
mapOf(
40-
"file" to MultipartField.of("some content".toByteArray()),
40+
"file" to MultipartField.of("some content".byteInputStream()),
4141
"purpose" to MultipartField.of(FilePurpose.ASSISTANTS),
4242
)
4343
.mapValues { (_, field) ->

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

+5-5
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ internal class ImageCreateVariationParamsTest {
1212
@Test
1313
fun create() {
1414
ImageCreateVariationParams.builder()
15-
.image("some content".toByteArray())
15+
.image("some content".byteInputStream())
1616
.model(ImageModel.DALL_E_2)
1717
.n(1L)
1818
.responseFormat(ImageCreateVariationParams.ResponseFormat.URL)
@@ -25,7 +25,7 @@ internal class ImageCreateVariationParamsTest {
2525
fun body() {
2626
val params =
2727
ImageCreateVariationParams.builder()
28-
.image("some content".toByteArray())
28+
.image("some content".byteInputStream())
2929
.model(ImageModel.DALL_E_2)
3030
.n(1L)
3131
.responseFormat(ImageCreateVariationParams.ResponseFormat.URL)
@@ -45,7 +45,7 @@ internal class ImageCreateVariationParamsTest {
4545
)
4646
.isEqualTo(
4747
mapOf(
48-
"image" to MultipartField.of("some content".toByteArray()),
48+
"image" to MultipartField.of("some content".byteInputStream()),
4949
"model" to MultipartField.of(ImageModel.DALL_E_2),
5050
"n" to MultipartField.of(1L),
5151
"response_format" to
@@ -62,7 +62,7 @@ internal class ImageCreateVariationParamsTest {
6262
@Test
6363
fun bodyWithoutOptionalFields() {
6464
val params =
65-
ImageCreateVariationParams.builder().image("some content".toByteArray()).build()
65+
ImageCreateVariationParams.builder().image("some content".byteInputStream()).build()
6666

6767
val body = params._body()
6868

@@ -75,7 +75,7 @@ internal class ImageCreateVariationParamsTest {
7575
InputStream::class.java,
7676
)
7777
.isEqualTo(
78-
mapOf("image" to MultipartField.of("some content".toByteArray())).mapValues {
78+
mapOf("image" to MultipartField.of("some content".byteInputStream())).mapValues {
7979
(_, field) ->
8080
field.map { (it as? ByteArray)?.inputStream() ?: it }
8181
}

0 commit comments

Comments
 (0)