Skip to content

release: 1.5.1 #450

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 7 commits into from
Apr 28, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 13 additions & 12 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,18 +1,19 @@
name: CI
on:
push:
branches:
- main
pull_request:
branches:
- main
- next
branches-ignore:
- 'generated'
- 'codegen/**'
- 'integrated/**'
- 'stl-preview-head/**'
- 'stl-preview-base/**'

jobs:
lint:
timeout-minutes: 10
name: lint
runs-on: ubuntu-latest
runs-on: ${{ github.repository == 'stainless-sdks/openai-java' && 'depot-ubuntu-24.04' || 'ubuntu-latest' }}

steps:
- uses: actions/checkout@v4

Expand All @@ -22,7 +23,7 @@ jobs:
distribution: temurin
java-version: |
8
17
21
cache: gradle

- name: Set up Gradle
Expand All @@ -33,7 +34,7 @@ jobs:
test:
timeout-minutes: 10
name: test
runs-on: ubuntu-latest
runs-on: ${{ github.repository == 'stainless-sdks/openai-java' && 'depot-ubuntu-24.04' || 'ubuntu-latest' }}
steps:
- uses: actions/checkout@v4

Expand All @@ -43,7 +44,7 @@ jobs:
distribution: temurin
java-version: |
8
17
21
cache: gradle

- name: Set up Gradle
Expand All @@ -54,7 +55,7 @@ jobs:
examples:
timeout-minutes: 10
name: examples
runs-on: ubuntu-latest
runs-on: ${{ github.repository == 'stainless-sdks/openai-java' && 'depot-ubuntu-24.04' || 'ubuntu-latest' }}
if: github.repository == 'openai/openai-java'

steps:
Expand All @@ -66,7 +67,7 @@ jobs:
distribution: temurin
java-version: |
8
17
21
cache: gradle
- name: Set up Gradle
uses: gradle/gradle-build-action@v2
Expand Down
2 changes: 1 addition & 1 deletion .release-please-manifest.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
".": "1.5.0"
".": "1.5.1"
}
22 changes: 22 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,27 @@
# Changelog

## 1.5.1 (2025-04-27)

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

### Bug Fixes

* **client:** add missing convenience methods ([616d69a](https://github.com/openai/openai-java/commit/616d69a27a914e30d6cb2c4fa96613bf64488742))


### Chores

* **ci:** only use depot for staging repos ([7835140](https://github.com/openai/openai-java/commit/78351404be50f6e535028a98d14d64257eeb2002))
* **ci:** run on more branches and use depot runners ([8b7a805](https://github.com/openai/openai-java/commit/8b7a805083123a222ebc623e4c405d2f1ccf228b))
* **internal:** java 17 -> 21 on ci ([9f690e4](https://github.com/openai/openai-java/commit/9f690e42c91642bcda690bd398803ba401958397))
* **internal:** use `byteInputStream()` in tests ([616d69a](https://github.com/openai/openai-java/commit/616d69a27a914e30d6cb2c4fa96613bf64488742))
* run formatter ([5e78fa5](https://github.com/openai/openai-java/commit/5e78fa544ddc7942795bf5055c2010f9b42b198e))


### Documentation

* add responses input file example ([#446](https://github.com/openai/openai-java/issues/446)) ([b94d404](https://github.com/openai/openai-java/commit/b94d4044ba764de789af3d19ac406ad8667c029d))

## 1.5.0 (2025-04-23)

Full Changelog: [v1.4.1...v1.5.0](https://github.com/openai/openai-java/compare/v1.4.1...v1.5.0)
Expand Down
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,16 @@

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

[![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)
[![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)
[![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)
[![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)

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

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

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

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).
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).

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

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

```kotlin
implementation("com.openai:openai-java:1.5.0")
implementation("com.openai:openai-java:1.5.1")
```

### Maven
Expand All @@ -31,7 +31,7 @@ implementation("com.openai:openai-java:1.5.0")
<dependency>
<groupId>com.openai</groupId>
<artifactId>openai-java</artifactId>
<version>1.5.0</version>
<version>1.5.1</version>
</dependency>
```

Expand Down
2 changes: 1 addition & 1 deletion build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ repositories {

allprojects {
group = "com.openai"
version = "1.5.0" // x-release-please-version
version = "1.5.1" // x-release-please-version
}

subprojects {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -263,6 +263,22 @@ private constructor(
/** Alias for calling [image] with `Image.ofInputStream(inputStream)`. */
fun image(inputStream: InputStream) = apply { body.image(inputStream) }

/**
* The image(s) to edit. Must be a supported image file or an array of images. For
* `gpt-image-1`, each image should be a `png`, `webp`, or `jpg` file less than 25MB. For
* `dall-e-2`, you can only provide one image, and it should be a square `png` file less
* than 4MB.
*/
fun image(inputStream: ByteArray) = apply { body.image(inputStream) }

/**
* The image(s) to edit. Must be a supported image file or an array of images. For
* `gpt-image-1`, each image should be a `png`, `webp`, or `jpg` file less than 25MB. For
* `dall-e-2`, you can only provide one image, and it should be a square `png` file less
* than 4MB.
*/
fun image(inputStream: Path) = apply { body.image(inputStream) }

/** Alias for calling [image] with `Image.ofInputStreams(inputStreams)`. */
fun imageOfInputStreams(inputStreams: List<InputStream>) = apply {
body.imageOfInputStreams(inputStreams)
Expand Down Expand Up @@ -803,6 +819,28 @@ private constructor(
/** Alias for calling [image] with `Image.ofInputStream(inputStream)`. */
fun image(inputStream: InputStream) = image(Image.ofInputStream(inputStream))

/**
* The image(s) to edit. Must be a supported image file or an array of images. For
* `gpt-image-1`, each image should be a `png`, `webp`, or `jpg` file less than 25MB.
* For `dall-e-2`, you can only provide one image, and it should be a square `png` file
* less than 4MB.
*/
fun image(inputStream: ByteArray) = image(inputStream.inputStream())

/**
* The image(s) to edit. Must be a supported image file or an array of images. For
* `gpt-image-1`, each image should be a `png`, `webp`, or `jpg` file less than 25MB.
* For `dall-e-2`, you can only provide one image, and it should be a square `png` file
* less than 4MB.
*/
fun image(inputStream: Path) =
image(
MultipartField.builder<Image>()
.value(Image.ofInputStream(inputStream.inputStream()))
.filename(inputStream.name)
.build()
)

/** Alias for calling [image] with `Image.ofInputStreams(inputStreams)`. */
fun imageOfInputStreams(inputStreams: List<InputStream>) =
image(Image.ofInputStreams(inputStreams))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ internal class TranscriptionCreateParamsTest {
@Test
fun create() {
TranscriptionCreateParams.builder()
.file("some content".toByteArray())
.file("some content".byteInputStream())
.model(AudioModel.WHISPER_1)
.addInclude(TranscriptionInclude.LOGPROBS)
.language("language")
Expand All @@ -29,7 +29,7 @@ internal class TranscriptionCreateParamsTest {
fun body() {
val params =
TranscriptionCreateParams.builder()
.file("some content".toByteArray())
.file("some content".byteInputStream())
.model(AudioModel.WHISPER_1)
.addInclude(TranscriptionInclude.LOGPROBS)
.language("language")
Expand All @@ -51,7 +51,7 @@ internal class TranscriptionCreateParamsTest {
)
.isEqualTo(
mapOf(
"file" to MultipartField.of("some content".toByteArray()),
"file" to MultipartField.of("some content".byteInputStream()),
"model" to MultipartField.of(AudioModel.WHISPER_1),
"include" to MultipartField.of(listOf(TranscriptionInclude.LOGPROBS)),
"language" to MultipartField.of("language"),
Expand All @@ -73,7 +73,7 @@ internal class TranscriptionCreateParamsTest {
fun bodyWithoutOptionalFields() {
val params =
TranscriptionCreateParams.builder()
.file("some content".toByteArray())
.file("some content".byteInputStream())
.model(AudioModel.WHISPER_1)
.build()

Expand All @@ -89,7 +89,7 @@ internal class TranscriptionCreateParamsTest {
)
.isEqualTo(
mapOf(
"file" to MultipartField.of("some content".toByteArray()),
"file" to MultipartField.of("some content".byteInputStream()),
"model" to MultipartField.of(AudioModel.WHISPER_1),
)
.mapValues { (_, field) ->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ internal class TranslationCreateParamsTest {
@Test
fun create() {
TranslationCreateParams.builder()
.file("some content".toByteArray())
.file("some content".byteInputStream())
.model(AudioModel.WHISPER_1)
.prompt("prompt")
.responseFormat(TranslationCreateParams.ResponseFormat.JSON)
Expand All @@ -25,7 +25,7 @@ internal class TranslationCreateParamsTest {
fun body() {
val params =
TranslationCreateParams.builder()
.file("some content".toByteArray())
.file("some content".byteInputStream())
.model(AudioModel.WHISPER_1)
.prompt("prompt")
.responseFormat(TranslationCreateParams.ResponseFormat.JSON)
Expand All @@ -44,7 +44,7 @@ internal class TranslationCreateParamsTest {
)
.isEqualTo(
mapOf(
"file" to MultipartField.of("some content".toByteArray()),
"file" to MultipartField.of("some content".byteInputStream()),
"model" to MultipartField.of(AudioModel.WHISPER_1),
"prompt" to MultipartField.of("prompt"),
"response_format" to
Expand All @@ -61,7 +61,7 @@ internal class TranslationCreateParamsTest {
fun bodyWithoutOptionalFields() {
val params =
TranslationCreateParams.builder()
.file("some content".toByteArray())
.file("some content".byteInputStream())
.model(AudioModel.WHISPER_1)
.build()

Expand All @@ -77,7 +77,7 @@ internal class TranslationCreateParamsTest {
)
.isEqualTo(
mapOf(
"file" to MultipartField.of("some content".toByteArray()),
"file" to MultipartField.of("some content".byteInputStream()),
"model" to MultipartField.of(AudioModel.WHISPER_1),
)
.mapValues { (_, field) ->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ internal class FileCreateParamsTest {
@Test
fun create() {
FileCreateParams.builder()
.file("some content".toByteArray())
.file("some content".byteInputStream())
.purpose(FilePurpose.ASSISTANTS)
.build()
}
Expand All @@ -21,7 +21,7 @@ internal class FileCreateParamsTest {
fun body() {
val params =
FileCreateParams.builder()
.file("some content".toByteArray())
.file("some content".byteInputStream())
.purpose(FilePurpose.ASSISTANTS)
.build()

Expand All @@ -37,7 +37,7 @@ internal class FileCreateParamsTest {
)
.isEqualTo(
mapOf(
"file" to MultipartField.of("some content".toByteArray()),
"file" to MultipartField.of("some content".byteInputStream()),
"purpose" to MultipartField.of(FilePurpose.ASSISTANTS),
)
.mapValues { (_, field) ->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ internal class ImageCreateVariationParamsTest {
@Test
fun create() {
ImageCreateVariationParams.builder()
.image("some content".toByteArray())
.image("some content".byteInputStream())
.model(ImageModel.DALL_E_2)
.n(1L)
.responseFormat(ImageCreateVariationParams.ResponseFormat.URL)
Expand All @@ -25,7 +25,7 @@ internal class ImageCreateVariationParamsTest {
fun body() {
val params =
ImageCreateVariationParams.builder()
.image("some content".toByteArray())
.image("some content".byteInputStream())
.model(ImageModel.DALL_E_2)
.n(1L)
.responseFormat(ImageCreateVariationParams.ResponseFormat.URL)
Expand All @@ -45,7 +45,7 @@ internal class ImageCreateVariationParamsTest {
)
.isEqualTo(
mapOf(
"image" to MultipartField.of("some content".toByteArray()),
"image" to MultipartField.of("some content".byteInputStream()),
"model" to MultipartField.of(ImageModel.DALL_E_2),
"n" to MultipartField.of(1L),
"response_format" to
Expand All @@ -62,7 +62,7 @@ internal class ImageCreateVariationParamsTest {
@Test
fun bodyWithoutOptionalFields() {
val params =
ImageCreateVariationParams.builder().image("some content".toByteArray()).build()
ImageCreateVariationParams.builder().image("some content".byteInputStream()).build()

val body = params._body()

Expand All @@ -75,7 +75,7 @@ internal class ImageCreateVariationParamsTest {
InputStream::class.java,
)
.isEqualTo(
mapOf("image" to MultipartField.of("some content".toByteArray())).mapValues {
mapOf("image" to MultipartField.of("some content".byteInputStream())).mapValues {
(_, field) ->
field.map { (it as? ByteArray)?.inputStream() ?: it }
}
Expand Down
Loading