diff --git a/.release-please-manifest.json b/.release-please-manifest.json index 1f73031b..a9e40ee0 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "3.2.0" + ".": "3.2.1" } \ No newline at end of file diff --git a/.stats.yml b/.stats.yml index ebe81d14..41379b00 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 118 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/openai%2Fopenai-356b4364203ff36d7724074cd04f6e684253bfcc3c9d969122d730aa7bc51b46.yml -openapi_spec_hash: 4ab8e96f52699bc3d2b0c4432aa92af8 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/openai%2Fopenai-f312a661d9dd6b5d6d676e449c357f6414afd1fdaaf4d982d44ad86cba5c5f6e.yml +openapi_spec_hash: b62fd3d3fb98e37b1da0a2e22af51d40 config_hash: b854932c0ea24b400bdd64e4376936bd diff --git a/CHANGELOG.md b/CHANGELOG.md index 74de4e9b..8dd6c075 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,13 @@ # Changelog +## 3.2.1 (2025-09-02) + +Full Changelog: [v3.2.0...v3.2.1](https://github.com/openai/openai-java/compare/v3.2.0...v3.2.1) + +### Chores + +* **api:** manual updates for ResponseInputAudio ([d070eb7](https://github.com/openai/openai-java/commit/d070eb72346cfc57d3bf952ddb1f89c9a7b2d5c8)) + ## 3.2.0 (2025-09-02) Full Changelog: [v3.1.2...v3.2.0](https://github.com/openai/openai-java/compare/v3.1.2...v3.2.0) diff --git a/README.md b/README.md index 3c2ea9a3..feebec7e 100644 --- a/README.md +++ b/README.md @@ -2,8 +2,8 @@ -[![Maven Central](https://img.shields.io/maven-central/v/com.openai/openai-java)](https://central.sonatype.com/artifact/com.openai/openai-java/3.2.0) -[![javadoc](https://javadoc.io/badge2/com.openai/openai-java/3.2.0/javadoc.svg)](https://javadoc.io/doc/com.openai/openai-java/3.2.0) +[![Maven Central](https://img.shields.io/maven-central/v/com.openai/openai-java)](https://central.sonatype.com/artifact/com.openai/openai-java/3.2.1) +[![javadoc](https://javadoc.io/badge2/com.openai/openai-java/3.2.1/javadoc.svg)](https://javadoc.io/doc/com.openai/openai-java/3.2.1) @@ -11,7 +11,7 @@ The OpenAI Java SDK provides convenient access to the [OpenAI REST API](https:// -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.2.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/3.2.1). @@ -24,7 +24,7 @@ The REST API documentation can be found on [platform.openai.com](https://platfor ### Gradle ```kotlin -implementation("com.openai:openai-java:3.2.0") +implementation("com.openai:openai-java:3.2.1") ``` ### Maven @@ -33,7 +33,7 @@ implementation("com.openai:openai-java:3.2.0") com.openai openai-java - 3.2.0 + 3.2.1 ``` @@ -1330,7 +1330,7 @@ If you're using Spring Boot, then you can use the SDK's [Spring Boot starter](ht #### Gradle ```kotlin -implementation("com.openai:openai-java-spring-boot-starter:3.2.0") +implementation("com.openai:openai-java-spring-boot-starter:3.2.1") ``` #### Maven @@ -1339,7 +1339,7 @@ implementation("com.openai:openai-java-spring-boot-starter:3.2.0") com.openai openai-java-spring-boot-starter - 3.2.0 + 3.2.1 ``` diff --git a/build.gradle.kts b/build.gradle.kts index 43536027..81688f78 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -8,7 +8,7 @@ repositories { allprojects { group = "com.openai" - version = "3.2.0" // x-release-please-version + version = "3.2.1" // x-release-please-version } subprojects { diff --git a/openai-java-core/src/main/kotlin/com/openai/models/evals/EvalCreateParams.kt b/openai-java-core/src/main/kotlin/com/openai/models/evals/EvalCreateParams.kt index ca9a4921..00dfbeaf 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/evals/EvalCreateParams.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/evals/EvalCreateParams.kt @@ -33,6 +33,7 @@ import com.openai.models.graders.gradermodels.PythonGrader import com.openai.models.graders.gradermodels.ScoreModelGrader import com.openai.models.graders.gradermodels.StringCheckGrader import com.openai.models.graders.gradermodels.TextSimilarityGrader +import com.openai.models.responses.ResponseInputAudio import com.openai.models.responses.ResponseInputText import java.util.Collections import java.util.Objects @@ -3358,14 +3359,21 @@ private constructor( /** * Alias for calling [content] with - * `Content.ofAnArrayOfInputTextAndInputImage(anArrayOfInputTextAndInputImage)`. + * `Content.ofResponseInputAudio(responseInputAudio)`. */ - fun contentOfAnArrayOfInputTextAndInputImage( - anArrayOfInputTextAndInputImage: List + fun content(responseInputAudio: ResponseInputAudio) = + content(Content.ofResponseInputAudio(responseInputAudio)) + + /** + * Alias for calling [content] with + * `Content.ofAnArrayOfInputTextInputImageAndInputAudio(anArrayOfInputTextInputImageAndInputAudio)`. + */ + fun contentOfAnArrayOfInputTextInputImageAndInputAudio( + anArrayOfInputTextInputImageAndInputAudio: List ) = content( - Content.ofAnArrayOfInputTextAndInputImage( - anArrayOfInputTextAndInputImage + Content.ofAnArrayOfInputTextInputImageAndInputAudio( + anArrayOfInputTextInputImageAndInputAudio ) ) @@ -3482,7 +3490,9 @@ private constructor( private val responseInputText: ResponseInputText? = null, private val outputText: OutputText? = null, private val inputImage: InputImage? = null, - private val anArrayOfInputTextAndInputImage: List? = null, + private val responseInputAudio: ResponseInputAudio? = null, + private val anArrayOfInputTextInputImageAndInputAudio: List? = + null, private val _json: JsonValue? = null, ) { @@ -3499,12 +3509,16 @@ private constructor( /** An image input to the model. */ fun inputImage(): Optional = Optional.ofNullable(inputImage) + /** An audio input to the model. */ + fun responseInputAudio(): Optional = + Optional.ofNullable(responseInputAudio) + /** - * A list of inputs, each of which may be either an input text or input - * image object. + * A list of inputs, each of which may be either an input text, input image, + * or input audio object. */ - fun anArrayOfInputTextAndInputImage(): Optional> = - Optional.ofNullable(anArrayOfInputTextAndInputImage) + fun anArrayOfInputTextInputImageAndInputAudio(): Optional> = + Optional.ofNullable(anArrayOfInputTextInputImageAndInputAudio) fun isTextInput(): Boolean = textInput != null @@ -3514,8 +3528,10 @@ private constructor( fun isInputImage(): Boolean = inputImage != null - fun isAnArrayOfInputTextAndInputImage(): Boolean = - anArrayOfInputTextAndInputImage != null + fun isResponseInputAudio(): Boolean = responseInputAudio != null + + fun isAnArrayOfInputTextInputImageAndInputAudio(): Boolean = + anArrayOfInputTextInputImageAndInputAudio != null /** A text input to the model. */ fun asTextInput(): String = textInput.getOrThrow("textInput") @@ -3530,13 +3546,17 @@ private constructor( /** An image input to the model. */ fun asInputImage(): InputImage = inputImage.getOrThrow("inputImage") + /** An audio input to the model. */ + fun asResponseInputAudio(): ResponseInputAudio = + responseInputAudio.getOrThrow("responseInputAudio") + /** - * A list of inputs, each of which may be either an input text or input - * image object. + * A list of inputs, each of which may be either an input text, input image, + * or input audio object. */ - fun asAnArrayOfInputTextAndInputImage(): List = - anArrayOfInputTextAndInputImage.getOrThrow( - "anArrayOfInputTextAndInputImage" + fun asAnArrayOfInputTextInputImageAndInputAudio(): List = + anArrayOfInputTextInputImageAndInputAudio.getOrThrow( + "anArrayOfInputTextInputImageAndInputAudio" ) fun _json(): Optional = Optional.ofNullable(_json) @@ -3548,9 +3568,11 @@ private constructor( visitor.visitResponseInputText(responseInputText) outputText != null -> visitor.visitOutputText(outputText) inputImage != null -> visitor.visitInputImage(inputImage) - anArrayOfInputTextAndInputImage != null -> - visitor.visitAnArrayOfInputTextAndInputImage( - anArrayOfInputTextAndInputImage + responseInputAudio != null -> + visitor.visitResponseInputAudio(responseInputAudio) + anArrayOfInputTextInputImageAndInputAudio != null -> + visitor.visitAnArrayOfInputTextInputImageAndInputAudio( + anArrayOfInputTextInputImageAndInputAudio ) else -> visitor.unknown(_json) } @@ -3580,8 +3602,14 @@ private constructor( inputImage.validate() } - override fun visitAnArrayOfInputTextAndInputImage( - anArrayOfInputTextAndInputImage: List + override fun visitResponseInputAudio( + responseInputAudio: ResponseInputAudio + ) { + responseInputAudio.validate() + } + + override fun visitAnArrayOfInputTextInputImageAndInputAudio( + anArrayOfInputTextInputImageAndInputAudio: List ) {} } ) @@ -3618,9 +3646,13 @@ private constructor( override fun visitInputImage(inputImage: InputImage) = inputImage.validity() - override fun visitAnArrayOfInputTextAndInputImage( - anArrayOfInputTextAndInputImage: List - ) = anArrayOfInputTextAndInputImage.size + override fun visitResponseInputAudio( + responseInputAudio: ResponseInputAudio + ) = responseInputAudio.validity() + + override fun visitAnArrayOfInputTextInputImageAndInputAudio( + anArrayOfInputTextInputImageAndInputAudio: List + ) = anArrayOfInputTextInputImageAndInputAudio.size override fun unknown(json: JsonValue?) = 0 } @@ -3636,8 +3668,9 @@ private constructor( responseInputText == other.responseInputText && outputText == other.outputText && inputImage == other.inputImage && - anArrayOfInputTextAndInputImage == - other.anArrayOfInputTextAndInputImage + responseInputAudio == other.responseInputAudio && + anArrayOfInputTextInputImageAndInputAudio == + other.anArrayOfInputTextInputImageAndInputAudio } override fun hashCode(): Int = @@ -3646,7 +3679,8 @@ private constructor( responseInputText, outputText, inputImage, - anArrayOfInputTextAndInputImage, + responseInputAudio, + anArrayOfInputTextInputImageAndInputAudio, ) override fun toString(): String = @@ -3656,8 +3690,10 @@ private constructor( "Content{responseInputText=$responseInputText}" outputText != null -> "Content{outputText=$outputText}" inputImage != null -> "Content{inputImage=$inputImage}" - anArrayOfInputTextAndInputImage != null -> - "Content{anArrayOfInputTextAndInputImage=$anArrayOfInputTextAndInputImage}" + responseInputAudio != null -> + "Content{responseInputAudio=$responseInputAudio}" + anArrayOfInputTextInputImageAndInputAudio != null -> + "Content{anArrayOfInputTextInputImageAndInputAudio=$anArrayOfInputTextInputImageAndInputAudio}" _json != null -> "Content{_unknown=$_json}" else -> throw IllegalStateException("Invalid Content") } @@ -3683,17 +3719,22 @@ private constructor( fun ofInputImage(inputImage: InputImage) = Content(inputImage = inputImage) + /** An audio input to the model. */ + @JvmStatic + fun ofResponseInputAudio(responseInputAudio: ResponseInputAudio) = + Content(responseInputAudio = responseInputAudio) + /** - * A list of inputs, each of which may be either an input text or input - * image object. + * A list of inputs, each of which may be either an input text, input + * image, or input audio object. */ @JvmStatic - fun ofAnArrayOfInputTextAndInputImage( - anArrayOfInputTextAndInputImage: List + fun ofAnArrayOfInputTextInputImageAndInputAudio( + anArrayOfInputTextInputImageAndInputAudio: List ) = Content( - anArrayOfInputTextAndInputImage = - anArrayOfInputTextAndInputImage.toImmutable() + anArrayOfInputTextInputImageAndInputAudio = + anArrayOfInputTextInputImageAndInputAudio.toImmutable() ) } @@ -3715,12 +3756,15 @@ private constructor( /** An image input to the model. */ fun visitInputImage(inputImage: InputImage): T + /** An audio input to the model. */ + fun visitResponseInputAudio(responseInputAudio: ResponseInputAudio): T + /** - * A list of inputs, each of which may be either an input text or input - * image object. + * A list of inputs, each of which may be either an input text, input + * image, or input audio object. */ - fun visitAnArrayOfInputTextAndInputImage( - anArrayOfInputTextAndInputImage: List + fun visitAnArrayOfInputTextInputImageAndInputAudio( + anArrayOfInputTextInputImageAndInputAudio: List ): T /** @@ -3756,13 +3800,21 @@ private constructor( ?.let { Content(outputText = it, _json = json) }, tryDeserialize(node, jacksonTypeRef()) ?.let { Content(inputImage = it, _json = json) }, + tryDeserialize( + node, + jacksonTypeRef(), + ) + ?.let { + Content(responseInputAudio = it, _json = json) + }, tryDeserialize(node, jacksonTypeRef())?.let { Content(textInput = it, _json = json) }, tryDeserialize(node, jacksonTypeRef>()) ?.let { Content( - anArrayOfInputTextAndInputImage = it, + anArrayOfInputTextInputImageAndInputAudio = + it, _json = json, ) }, @@ -3801,8 +3853,12 @@ private constructor( generator.writeObject(value.outputText) value.inputImage != null -> generator.writeObject(value.inputImage) - value.anArrayOfInputTextAndInputImage != null -> - generator.writeObject(value.anArrayOfInputTextAndInputImage) + value.responseInputAudio != null -> + generator.writeObject(value.responseInputAudio) + value.anArrayOfInputTextInputImageAndInputAudio != null -> + generator.writeObject( + value.anArrayOfInputTextInputImageAndInputAudio + ) value._json != null -> generator.writeObject(value._json) else -> throw IllegalStateException("Invalid Content") } diff --git a/openai-java-core/src/main/kotlin/com/openai/models/evals/runs/CreateEvalCompletionsRunDataSource.kt b/openai-java-core/src/main/kotlin/com/openai/models/evals/runs/CreateEvalCompletionsRunDataSource.kt index facc6cc3..476c724b 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/evals/runs/CreateEvalCompletionsRunDataSource.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/evals/runs/CreateEvalCompletionsRunDataSource.kt @@ -31,6 +31,7 @@ import com.openai.models.ResponseFormatJsonSchema import com.openai.models.ResponseFormatText import com.openai.models.chat.completions.ChatCompletionFunctionTool import com.openai.models.responses.EasyInputMessage +import com.openai.models.responses.ResponseInputAudio import com.openai.models.responses.ResponseInputText import java.util.Collections import java.util.Objects @@ -2872,14 +2873,21 @@ private constructor( /** * Alias for calling [content] with - * `Content.ofAnArrayOfInputTextAndInputImage(anArrayOfInputTextAndInputImage)`. + * `Content.ofResponseInputAudio(responseInputAudio)`. */ - fun contentOfAnArrayOfInputTextAndInputImage( - anArrayOfInputTextAndInputImage: List + fun content(responseInputAudio: ResponseInputAudio) = + content(Content.ofResponseInputAudio(responseInputAudio)) + + /** + * Alias for calling [content] with + * `Content.ofAnArrayOfInputTextInputImageAndInputAudio(anArrayOfInputTextInputImageAndInputAudio)`. + */ + fun contentOfAnArrayOfInputTextInputImageAndInputAudio( + anArrayOfInputTextInputImageAndInputAudio: List ) = content( - Content.ofAnArrayOfInputTextAndInputImage( - anArrayOfInputTextAndInputImage + Content.ofAnArrayOfInputTextInputImageAndInputAudio( + anArrayOfInputTextInputImageAndInputAudio ) ) @@ -2996,7 +3004,9 @@ private constructor( private val responseInputText: ResponseInputText? = null, private val outputText: OutputText? = null, private val inputImage: InputImage? = null, - private val anArrayOfInputTextAndInputImage: List? = null, + private val responseInputAudio: ResponseInputAudio? = null, + private val anArrayOfInputTextInputImageAndInputAudio: List? = + null, private val _json: JsonValue? = null, ) { @@ -3013,12 +3023,16 @@ private constructor( /** An image input to the model. */ fun inputImage(): Optional = Optional.ofNullable(inputImage) + /** An audio input to the model. */ + fun responseInputAudio(): Optional = + Optional.ofNullable(responseInputAudio) + /** - * A list of inputs, each of which may be either an input text or input - * image object. + * A list of inputs, each of which may be either an input text, input image, + * or input audio object. */ - fun anArrayOfInputTextAndInputImage(): Optional> = - Optional.ofNullable(anArrayOfInputTextAndInputImage) + fun anArrayOfInputTextInputImageAndInputAudio(): Optional> = + Optional.ofNullable(anArrayOfInputTextInputImageAndInputAudio) fun isTextInput(): Boolean = textInput != null @@ -3028,8 +3042,10 @@ private constructor( fun isInputImage(): Boolean = inputImage != null - fun isAnArrayOfInputTextAndInputImage(): Boolean = - anArrayOfInputTextAndInputImage != null + fun isResponseInputAudio(): Boolean = responseInputAudio != null + + fun isAnArrayOfInputTextInputImageAndInputAudio(): Boolean = + anArrayOfInputTextInputImageAndInputAudio != null /** A text input to the model. */ fun asTextInput(): String = textInput.getOrThrow("textInput") @@ -3044,13 +3060,17 @@ private constructor( /** An image input to the model. */ fun asInputImage(): InputImage = inputImage.getOrThrow("inputImage") + /** An audio input to the model. */ + fun asResponseInputAudio(): ResponseInputAudio = + responseInputAudio.getOrThrow("responseInputAudio") + /** - * A list of inputs, each of which may be either an input text or input - * image object. + * A list of inputs, each of which may be either an input text, input image, + * or input audio object. */ - fun asAnArrayOfInputTextAndInputImage(): List = - anArrayOfInputTextAndInputImage.getOrThrow( - "anArrayOfInputTextAndInputImage" + fun asAnArrayOfInputTextInputImageAndInputAudio(): List = + anArrayOfInputTextInputImageAndInputAudio.getOrThrow( + "anArrayOfInputTextInputImageAndInputAudio" ) fun _json(): Optional = Optional.ofNullable(_json) @@ -3062,9 +3082,11 @@ private constructor( visitor.visitResponseInputText(responseInputText) outputText != null -> visitor.visitOutputText(outputText) inputImage != null -> visitor.visitInputImage(inputImage) - anArrayOfInputTextAndInputImage != null -> - visitor.visitAnArrayOfInputTextAndInputImage( - anArrayOfInputTextAndInputImage + responseInputAudio != null -> + visitor.visitResponseInputAudio(responseInputAudio) + anArrayOfInputTextInputImageAndInputAudio != null -> + visitor.visitAnArrayOfInputTextInputImageAndInputAudio( + anArrayOfInputTextInputImageAndInputAudio ) else -> visitor.unknown(_json) } @@ -3094,8 +3116,14 @@ private constructor( inputImage.validate() } - override fun visitAnArrayOfInputTextAndInputImage( - anArrayOfInputTextAndInputImage: List + override fun visitResponseInputAudio( + responseInputAudio: ResponseInputAudio + ) { + responseInputAudio.validate() + } + + override fun visitAnArrayOfInputTextInputImageAndInputAudio( + anArrayOfInputTextInputImageAndInputAudio: List ) {} } ) @@ -3132,9 +3160,13 @@ private constructor( override fun visitInputImage(inputImage: InputImage) = inputImage.validity() - override fun visitAnArrayOfInputTextAndInputImage( - anArrayOfInputTextAndInputImage: List - ) = anArrayOfInputTextAndInputImage.size + override fun visitResponseInputAudio( + responseInputAudio: ResponseInputAudio + ) = responseInputAudio.validity() + + override fun visitAnArrayOfInputTextInputImageAndInputAudio( + anArrayOfInputTextInputImageAndInputAudio: List + ) = anArrayOfInputTextInputImageAndInputAudio.size override fun unknown(json: JsonValue?) = 0 } @@ -3150,8 +3182,9 @@ private constructor( responseInputText == other.responseInputText && outputText == other.outputText && inputImage == other.inputImage && - anArrayOfInputTextAndInputImage == - other.anArrayOfInputTextAndInputImage + responseInputAudio == other.responseInputAudio && + anArrayOfInputTextInputImageAndInputAudio == + other.anArrayOfInputTextInputImageAndInputAudio } override fun hashCode(): Int = @@ -3160,7 +3193,8 @@ private constructor( responseInputText, outputText, inputImage, - anArrayOfInputTextAndInputImage, + responseInputAudio, + anArrayOfInputTextInputImageAndInputAudio, ) override fun toString(): String = @@ -3170,8 +3204,10 @@ private constructor( "Content{responseInputText=$responseInputText}" outputText != null -> "Content{outputText=$outputText}" inputImage != null -> "Content{inputImage=$inputImage}" - anArrayOfInputTextAndInputImage != null -> - "Content{anArrayOfInputTextAndInputImage=$anArrayOfInputTextAndInputImage}" + responseInputAudio != null -> + "Content{responseInputAudio=$responseInputAudio}" + anArrayOfInputTextInputImageAndInputAudio != null -> + "Content{anArrayOfInputTextInputImageAndInputAudio=$anArrayOfInputTextInputImageAndInputAudio}" _json != null -> "Content{_unknown=$_json}" else -> throw IllegalStateException("Invalid Content") } @@ -3197,17 +3233,22 @@ private constructor( fun ofInputImage(inputImage: InputImage) = Content(inputImage = inputImage) + /** An audio input to the model. */ + @JvmStatic + fun ofResponseInputAudio(responseInputAudio: ResponseInputAudio) = + Content(responseInputAudio = responseInputAudio) + /** - * A list of inputs, each of which may be either an input text or input - * image object. + * A list of inputs, each of which may be either an input text, input + * image, or input audio object. */ @JvmStatic - fun ofAnArrayOfInputTextAndInputImage( - anArrayOfInputTextAndInputImage: List + fun ofAnArrayOfInputTextInputImageAndInputAudio( + anArrayOfInputTextInputImageAndInputAudio: List ) = Content( - anArrayOfInputTextAndInputImage = - anArrayOfInputTextAndInputImage.toImmutable() + anArrayOfInputTextInputImageAndInputAudio = + anArrayOfInputTextInputImageAndInputAudio.toImmutable() ) } @@ -3229,12 +3270,15 @@ private constructor( /** An image input to the model. */ fun visitInputImage(inputImage: InputImage): T + /** An audio input to the model. */ + fun visitResponseInputAudio(responseInputAudio: ResponseInputAudio): T + /** - * A list of inputs, each of which may be either an input text or input - * image object. + * A list of inputs, each of which may be either an input text, input + * image, or input audio object. */ - fun visitAnArrayOfInputTextAndInputImage( - anArrayOfInputTextAndInputImage: List + fun visitAnArrayOfInputTextInputImageAndInputAudio( + anArrayOfInputTextInputImageAndInputAudio: List ): T /** @@ -3270,13 +3314,21 @@ private constructor( ?.let { Content(outputText = it, _json = json) }, tryDeserialize(node, jacksonTypeRef()) ?.let { Content(inputImage = it, _json = json) }, + tryDeserialize( + node, + jacksonTypeRef(), + ) + ?.let { + Content(responseInputAudio = it, _json = json) + }, tryDeserialize(node, jacksonTypeRef())?.let { Content(textInput = it, _json = json) }, tryDeserialize(node, jacksonTypeRef>()) ?.let { Content( - anArrayOfInputTextAndInputImage = it, + anArrayOfInputTextInputImageAndInputAudio = + it, _json = json, ) }, @@ -3315,8 +3367,12 @@ private constructor( generator.writeObject(value.outputText) value.inputImage != null -> generator.writeObject(value.inputImage) - value.anArrayOfInputTextAndInputImage != null -> - generator.writeObject(value.anArrayOfInputTextAndInputImage) + value.responseInputAudio != null -> + generator.writeObject(value.responseInputAudio) + value.anArrayOfInputTextInputImageAndInputAudio != null -> + generator.writeObject( + value.anArrayOfInputTextInputImageAndInputAudio + ) value._json != null -> generator.writeObject(value._json) else -> throw IllegalStateException("Invalid Content") } diff --git a/openai-java-core/src/main/kotlin/com/openai/models/evals/runs/RunCancelResponse.kt b/openai-java-core/src/main/kotlin/com/openai/models/evals/runs/RunCancelResponse.kt index d0abe032..541cfa9a 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/evals/runs/RunCancelResponse.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/evals/runs/RunCancelResponse.kt @@ -35,6 +35,7 @@ import com.openai.models.responses.FileSearchTool import com.openai.models.responses.FunctionTool import com.openai.models.responses.ResponseFormatTextConfig import com.openai.models.responses.ResponseFormatTextJsonSchemaConfig +import com.openai.models.responses.ResponseInputAudio import com.openai.models.responses.ResponseInputText import com.openai.models.responses.Tool import com.openai.models.responses.WebSearchPreviewTool @@ -4341,14 +4342,21 @@ private constructor( /** * Alias for calling [content] with - * `Content.ofAnArrayOfInputTextAndInputImage(anArrayOfInputTextAndInputImage)`. + * `Content.ofResponseInputAudio(responseInputAudio)`. */ - fun contentOfAnArrayOfInputTextAndInputImage( - anArrayOfInputTextAndInputImage: List + fun content(responseInputAudio: ResponseInputAudio) = + content(Content.ofResponseInputAudio(responseInputAudio)) + + /** + * Alias for calling [content] with + * `Content.ofAnArrayOfInputTextInputImageAndInputAudio(anArrayOfInputTextInputImageAndInputAudio)`. + */ + fun contentOfAnArrayOfInputTextInputImageAndInputAudio( + anArrayOfInputTextInputImageAndInputAudio: List ) = content( - Content.ofAnArrayOfInputTextAndInputImage( - anArrayOfInputTextAndInputImage + Content.ofAnArrayOfInputTextInputImageAndInputAudio( + anArrayOfInputTextInputImageAndInputAudio ) ) @@ -4467,7 +4475,9 @@ private constructor( private val responseInputText: ResponseInputText? = null, private val outputText: OutputText? = null, private val inputImage: InputImage? = null, - private val anArrayOfInputTextAndInputImage: List? = + private val responseInputAudio: ResponseInputAudio? = null, + private val anArrayOfInputTextInputImageAndInputAudio: + List? = null, private val _json: JsonValue? = null, ) { @@ -4487,12 +4497,17 @@ private constructor( fun inputImage(): Optional = Optional.ofNullable(inputImage) + /** An audio input to the model. */ + fun responseInputAudio(): Optional = + Optional.ofNullable(responseInputAudio) + /** - * A list of inputs, each of which may be either an input text or - * input image object. + * A list of inputs, each of which may be either an input text, + * input image, or input audio object. */ - fun anArrayOfInputTextAndInputImage(): Optional> = - Optional.ofNullable(anArrayOfInputTextAndInputImage) + fun anArrayOfInputTextInputImageAndInputAudio(): + Optional> = + Optional.ofNullable(anArrayOfInputTextInputImageAndInputAudio) fun isTextInput(): Boolean = textInput != null @@ -4502,8 +4517,10 @@ private constructor( fun isInputImage(): Boolean = inputImage != null - fun isAnArrayOfInputTextAndInputImage(): Boolean = - anArrayOfInputTextAndInputImage != null + fun isResponseInputAudio(): Boolean = responseInputAudio != null + + fun isAnArrayOfInputTextInputImageAndInputAudio(): Boolean = + anArrayOfInputTextInputImageAndInputAudio != null /** A text input to the model. */ fun asTextInput(): String = textInput.getOrThrow("textInput") @@ -4518,13 +4535,17 @@ private constructor( /** An image input to the model. */ fun asInputImage(): InputImage = inputImage.getOrThrow("inputImage") + /** An audio input to the model. */ + fun asResponseInputAudio(): ResponseInputAudio = + responseInputAudio.getOrThrow("responseInputAudio") + /** - * A list of inputs, each of which may be either an input text or - * input image object. + * A list of inputs, each of which may be either an input text, + * input image, or input audio object. */ - fun asAnArrayOfInputTextAndInputImage(): List = - anArrayOfInputTextAndInputImage.getOrThrow( - "anArrayOfInputTextAndInputImage" + fun asAnArrayOfInputTextInputImageAndInputAudio(): List = + anArrayOfInputTextInputImageAndInputAudio.getOrThrow( + "anArrayOfInputTextInputImageAndInputAudio" ) fun _json(): Optional = Optional.ofNullable(_json) @@ -4536,9 +4557,11 @@ private constructor( visitor.visitResponseInputText(responseInputText) outputText != null -> visitor.visitOutputText(outputText) inputImage != null -> visitor.visitInputImage(inputImage) - anArrayOfInputTextAndInputImage != null -> - visitor.visitAnArrayOfInputTextAndInputImage( - anArrayOfInputTextAndInputImage + responseInputAudio != null -> + visitor.visitResponseInputAudio(responseInputAudio) + anArrayOfInputTextInputImageAndInputAudio != null -> + visitor.visitAnArrayOfInputTextInputImageAndInputAudio( + anArrayOfInputTextInputImageAndInputAudio ) else -> visitor.unknown(_json) } @@ -4568,8 +4591,15 @@ private constructor( inputImage.validate() } - override fun visitAnArrayOfInputTextAndInputImage( - anArrayOfInputTextAndInputImage: List + override fun visitResponseInputAudio( + responseInputAudio: ResponseInputAudio + ) { + responseInputAudio.validate() + } + + override fun visitAnArrayOfInputTextInputImageAndInputAudio( + anArrayOfInputTextInputImageAndInputAudio: + List ) {} } ) @@ -4606,9 +4636,14 @@ private constructor( override fun visitInputImage(inputImage: InputImage) = inputImage.validity() - override fun visitAnArrayOfInputTextAndInputImage( - anArrayOfInputTextAndInputImage: List - ) = anArrayOfInputTextAndInputImage.size + override fun visitResponseInputAudio( + responseInputAudio: ResponseInputAudio + ) = responseInputAudio.validity() + + override fun visitAnArrayOfInputTextInputImageAndInputAudio( + anArrayOfInputTextInputImageAndInputAudio: + List + ) = anArrayOfInputTextInputImageAndInputAudio.size override fun unknown(json: JsonValue?) = 0 } @@ -4624,8 +4659,9 @@ private constructor( responseInputText == other.responseInputText && outputText == other.outputText && inputImage == other.inputImage && - anArrayOfInputTextAndInputImage == - other.anArrayOfInputTextAndInputImage + responseInputAudio == other.responseInputAudio && + anArrayOfInputTextInputImageAndInputAudio == + other.anArrayOfInputTextInputImageAndInputAudio } override fun hashCode(): Int = @@ -4634,7 +4670,8 @@ private constructor( responseInputText, outputText, inputImage, - anArrayOfInputTextAndInputImage, + responseInputAudio, + anArrayOfInputTextInputImageAndInputAudio, ) override fun toString(): String = @@ -4644,8 +4681,10 @@ private constructor( "Content{responseInputText=$responseInputText}" outputText != null -> "Content{outputText=$outputText}" inputImage != null -> "Content{inputImage=$inputImage}" - anArrayOfInputTextAndInputImage != null -> - "Content{anArrayOfInputTextAndInputImage=$anArrayOfInputTextAndInputImage}" + responseInputAudio != null -> + "Content{responseInputAudio=$responseInputAudio}" + anArrayOfInputTextInputImageAndInputAudio != null -> + "Content{anArrayOfInputTextInputImageAndInputAudio=$anArrayOfInputTextInputImageAndInputAudio}" _json != null -> "Content{_unknown=$_json}" else -> throw IllegalStateException("Invalid Content") } @@ -4672,17 +4711,24 @@ private constructor( fun ofInputImage(inputImage: InputImage) = Content(inputImage = inputImage) + /** An audio input to the model. */ + @JvmStatic + fun ofResponseInputAudio( + responseInputAudio: ResponseInputAudio + ) = Content(responseInputAudio = responseInputAudio) + /** - * A list of inputs, each of which may be either an input text - * or input image object. + * A list of inputs, each of which may be either an input text, + * input image, or input audio object. */ @JvmStatic - fun ofAnArrayOfInputTextAndInputImage( - anArrayOfInputTextAndInputImage: List + fun ofAnArrayOfInputTextInputImageAndInputAudio( + anArrayOfInputTextInputImageAndInputAudio: List ) = Content( - anArrayOfInputTextAndInputImage = - anArrayOfInputTextAndInputImage.toImmutable() + anArrayOfInputTextInputImageAndInputAudio = + anArrayOfInputTextInputImageAndInputAudio + .toImmutable() ) } @@ -4706,12 +4752,17 @@ private constructor( /** An image input to the model. */ fun visitInputImage(inputImage: InputImage): T + /** An audio input to the model. */ + fun visitResponseInputAudio( + responseInputAudio: ResponseInputAudio + ): T + /** - * A list of inputs, each of which may be either an input text - * or input image object. + * A list of inputs, each of which may be either an input text, + * input image, or input audio object. */ - fun visitAnArrayOfInputTextAndInputImage( - anArrayOfInputTextAndInputImage: List + fun visitAnArrayOfInputTextInputImageAndInputAudio( + anArrayOfInputTextInputImageAndInputAudio: List ): T /** @@ -4763,6 +4814,16 @@ private constructor( ?.let { Content(inputImage = it, _json = json) }, + tryDeserialize( + node, + jacksonTypeRef(), + ) + ?.let { + Content( + responseInputAudio = it, + _json = json, + ) + }, tryDeserialize(node, jacksonTypeRef()) ?.let { Content(textInput = it, _json = json) @@ -4773,7 +4834,7 @@ private constructor( ) ?.let { Content( - anArrayOfInputTextAndInputImage = + anArrayOfInputTextInputImageAndInputAudio = it, _json = json, ) @@ -4816,9 +4877,12 @@ private constructor( generator.writeObject(value.outputText) value.inputImage != null -> generator.writeObject(value.inputImage) - value.anArrayOfInputTextAndInputImage != null -> + value.responseInputAudio != null -> + generator.writeObject(value.responseInputAudio) + value.anArrayOfInputTextInputImageAndInputAudio != + null -> generator.writeObject( - value.anArrayOfInputTextAndInputImage + value.anArrayOfInputTextInputImageAndInputAudio ) value._json != null -> generator.writeObject(value._json) diff --git a/openai-java-core/src/main/kotlin/com/openai/models/evals/runs/RunCreateParams.kt b/openai-java-core/src/main/kotlin/com/openai/models/evals/runs/RunCreateParams.kt index e0962dc1..1fc99787 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/evals/runs/RunCreateParams.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/evals/runs/RunCreateParams.kt @@ -38,6 +38,7 @@ import com.openai.models.responses.FileSearchTool import com.openai.models.responses.FunctionTool import com.openai.models.responses.ResponseFormatTextConfig import com.openai.models.responses.ResponseFormatTextJsonSchemaConfig +import com.openai.models.responses.ResponseInputAudio import com.openai.models.responses.ResponseInputText import com.openai.models.responses.Tool import com.openai.models.responses.WebSearchPreviewTool @@ -4226,14 +4227,21 @@ private constructor( /** * Alias for calling [content] with - * `Content.ofAnArrayOfInputTextAndInputImage(anArrayOfInputTextAndInputImage)`. + * `Content.ofResponseInputAudio(responseInputAudio)`. */ - fun contentOfAnArrayOfInputTextAndInputImage( - anArrayOfInputTextAndInputImage: List + fun content(responseInputAudio: ResponseInputAudio) = + content(Content.ofResponseInputAudio(responseInputAudio)) + + /** + * Alias for calling [content] with + * `Content.ofAnArrayOfInputTextInputImageAndInputAudio(anArrayOfInputTextInputImageAndInputAudio)`. + */ + fun contentOfAnArrayOfInputTextInputImageAndInputAudio( + anArrayOfInputTextInputImageAndInputAudio: List ) = content( - Content.ofAnArrayOfInputTextAndInputImage( - anArrayOfInputTextAndInputImage + Content.ofAnArrayOfInputTextInputImageAndInputAudio( + anArrayOfInputTextInputImageAndInputAudio ) ) @@ -4352,7 +4360,9 @@ private constructor( private val responseInputText: ResponseInputText? = null, private val outputText: OutputText? = null, private val inputImage: InputImage? = null, - private val anArrayOfInputTextAndInputImage: List? = + private val responseInputAudio: ResponseInputAudio? = null, + private val anArrayOfInputTextInputImageAndInputAudio: + List? = null, private val _json: JsonValue? = null, ) { @@ -4372,12 +4382,17 @@ private constructor( fun inputImage(): Optional = Optional.ofNullable(inputImage) + /** An audio input to the model. */ + fun responseInputAudio(): Optional = + Optional.ofNullable(responseInputAudio) + /** - * A list of inputs, each of which may be either an input text or - * input image object. + * A list of inputs, each of which may be either an input text, + * input image, or input audio object. */ - fun anArrayOfInputTextAndInputImage(): Optional> = - Optional.ofNullable(anArrayOfInputTextAndInputImage) + fun anArrayOfInputTextInputImageAndInputAudio(): + Optional> = + Optional.ofNullable(anArrayOfInputTextInputImageAndInputAudio) fun isTextInput(): Boolean = textInput != null @@ -4387,8 +4402,10 @@ private constructor( fun isInputImage(): Boolean = inputImage != null - fun isAnArrayOfInputTextAndInputImage(): Boolean = - anArrayOfInputTextAndInputImage != null + fun isResponseInputAudio(): Boolean = responseInputAudio != null + + fun isAnArrayOfInputTextInputImageAndInputAudio(): Boolean = + anArrayOfInputTextInputImageAndInputAudio != null /** A text input to the model. */ fun asTextInput(): String = textInput.getOrThrow("textInput") @@ -4403,13 +4420,17 @@ private constructor( /** An image input to the model. */ fun asInputImage(): InputImage = inputImage.getOrThrow("inputImage") + /** An audio input to the model. */ + fun asResponseInputAudio(): ResponseInputAudio = + responseInputAudio.getOrThrow("responseInputAudio") + /** - * A list of inputs, each of which may be either an input text or - * input image object. + * A list of inputs, each of which may be either an input text, + * input image, or input audio object. */ - fun asAnArrayOfInputTextAndInputImage(): List = - anArrayOfInputTextAndInputImage.getOrThrow( - "anArrayOfInputTextAndInputImage" + fun asAnArrayOfInputTextInputImageAndInputAudio(): List = + anArrayOfInputTextInputImageAndInputAudio.getOrThrow( + "anArrayOfInputTextInputImageAndInputAudio" ) fun _json(): Optional = Optional.ofNullable(_json) @@ -4421,9 +4442,11 @@ private constructor( visitor.visitResponseInputText(responseInputText) outputText != null -> visitor.visitOutputText(outputText) inputImage != null -> visitor.visitInputImage(inputImage) - anArrayOfInputTextAndInputImage != null -> - visitor.visitAnArrayOfInputTextAndInputImage( - anArrayOfInputTextAndInputImage + responseInputAudio != null -> + visitor.visitResponseInputAudio(responseInputAudio) + anArrayOfInputTextInputImageAndInputAudio != null -> + visitor.visitAnArrayOfInputTextInputImageAndInputAudio( + anArrayOfInputTextInputImageAndInputAudio ) else -> visitor.unknown(_json) } @@ -4453,8 +4476,15 @@ private constructor( inputImage.validate() } - override fun visitAnArrayOfInputTextAndInputImage( - anArrayOfInputTextAndInputImage: List + override fun visitResponseInputAudio( + responseInputAudio: ResponseInputAudio + ) { + responseInputAudio.validate() + } + + override fun visitAnArrayOfInputTextInputImageAndInputAudio( + anArrayOfInputTextInputImageAndInputAudio: + List ) {} } ) @@ -4491,9 +4521,14 @@ private constructor( override fun visitInputImage(inputImage: InputImage) = inputImage.validity() - override fun visitAnArrayOfInputTextAndInputImage( - anArrayOfInputTextAndInputImage: List - ) = anArrayOfInputTextAndInputImage.size + override fun visitResponseInputAudio( + responseInputAudio: ResponseInputAudio + ) = responseInputAudio.validity() + + override fun visitAnArrayOfInputTextInputImageAndInputAudio( + anArrayOfInputTextInputImageAndInputAudio: + List + ) = anArrayOfInputTextInputImageAndInputAudio.size override fun unknown(json: JsonValue?) = 0 } @@ -4509,8 +4544,9 @@ private constructor( responseInputText == other.responseInputText && outputText == other.outputText && inputImage == other.inputImage && - anArrayOfInputTextAndInputImage == - other.anArrayOfInputTextAndInputImage + responseInputAudio == other.responseInputAudio && + anArrayOfInputTextInputImageAndInputAudio == + other.anArrayOfInputTextInputImageAndInputAudio } override fun hashCode(): Int = @@ -4519,7 +4555,8 @@ private constructor( responseInputText, outputText, inputImage, - anArrayOfInputTextAndInputImage, + responseInputAudio, + anArrayOfInputTextInputImageAndInputAudio, ) override fun toString(): String = @@ -4529,8 +4566,10 @@ private constructor( "Content{responseInputText=$responseInputText}" outputText != null -> "Content{outputText=$outputText}" inputImage != null -> "Content{inputImage=$inputImage}" - anArrayOfInputTextAndInputImage != null -> - "Content{anArrayOfInputTextAndInputImage=$anArrayOfInputTextAndInputImage}" + responseInputAudio != null -> + "Content{responseInputAudio=$responseInputAudio}" + anArrayOfInputTextInputImageAndInputAudio != null -> + "Content{anArrayOfInputTextInputImageAndInputAudio=$anArrayOfInputTextInputImageAndInputAudio}" _json != null -> "Content{_unknown=$_json}" else -> throw IllegalStateException("Invalid Content") } @@ -4557,17 +4596,24 @@ private constructor( fun ofInputImage(inputImage: InputImage) = Content(inputImage = inputImage) + /** An audio input to the model. */ + @JvmStatic + fun ofResponseInputAudio( + responseInputAudio: ResponseInputAudio + ) = Content(responseInputAudio = responseInputAudio) + /** - * A list of inputs, each of which may be either an input text - * or input image object. + * A list of inputs, each of which may be either an input text, + * input image, or input audio object. */ @JvmStatic - fun ofAnArrayOfInputTextAndInputImage( - anArrayOfInputTextAndInputImage: List + fun ofAnArrayOfInputTextInputImageAndInputAudio( + anArrayOfInputTextInputImageAndInputAudio: List ) = Content( - anArrayOfInputTextAndInputImage = - anArrayOfInputTextAndInputImage.toImmutable() + anArrayOfInputTextInputImageAndInputAudio = + anArrayOfInputTextInputImageAndInputAudio + .toImmutable() ) } @@ -4591,12 +4637,17 @@ private constructor( /** An image input to the model. */ fun visitInputImage(inputImage: InputImage): T + /** An audio input to the model. */ + fun visitResponseInputAudio( + responseInputAudio: ResponseInputAudio + ): T + /** - * A list of inputs, each of which may be either an input text - * or input image object. + * A list of inputs, each of which may be either an input text, + * input image, or input audio object. */ - fun visitAnArrayOfInputTextAndInputImage( - anArrayOfInputTextAndInputImage: List + fun visitAnArrayOfInputTextInputImageAndInputAudio( + anArrayOfInputTextInputImageAndInputAudio: List ): T /** @@ -4648,6 +4699,16 @@ private constructor( ?.let { Content(inputImage = it, _json = json) }, + tryDeserialize( + node, + jacksonTypeRef(), + ) + ?.let { + Content( + responseInputAudio = it, + _json = json, + ) + }, tryDeserialize(node, jacksonTypeRef()) ?.let { Content(textInput = it, _json = json) @@ -4658,7 +4719,7 @@ private constructor( ) ?.let { Content( - anArrayOfInputTextAndInputImage = + anArrayOfInputTextInputImageAndInputAudio = it, _json = json, ) @@ -4701,9 +4762,12 @@ private constructor( generator.writeObject(value.outputText) value.inputImage != null -> generator.writeObject(value.inputImage) - value.anArrayOfInputTextAndInputImage != null -> + value.responseInputAudio != null -> + generator.writeObject(value.responseInputAudio) + value.anArrayOfInputTextInputImageAndInputAudio != + null -> generator.writeObject( - value.anArrayOfInputTextAndInputImage + value.anArrayOfInputTextInputImageAndInputAudio ) value._json != null -> generator.writeObject(value._json) diff --git a/openai-java-core/src/main/kotlin/com/openai/models/evals/runs/RunCreateResponse.kt b/openai-java-core/src/main/kotlin/com/openai/models/evals/runs/RunCreateResponse.kt index 801dbd87..a3a64a02 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/evals/runs/RunCreateResponse.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/evals/runs/RunCreateResponse.kt @@ -35,6 +35,7 @@ import com.openai.models.responses.FileSearchTool import com.openai.models.responses.FunctionTool import com.openai.models.responses.ResponseFormatTextConfig import com.openai.models.responses.ResponseFormatTextJsonSchemaConfig +import com.openai.models.responses.ResponseInputAudio import com.openai.models.responses.ResponseInputText import com.openai.models.responses.Tool import com.openai.models.responses.WebSearchPreviewTool @@ -4341,14 +4342,21 @@ private constructor( /** * Alias for calling [content] with - * `Content.ofAnArrayOfInputTextAndInputImage(anArrayOfInputTextAndInputImage)`. + * `Content.ofResponseInputAudio(responseInputAudio)`. */ - fun contentOfAnArrayOfInputTextAndInputImage( - anArrayOfInputTextAndInputImage: List + fun content(responseInputAudio: ResponseInputAudio) = + content(Content.ofResponseInputAudio(responseInputAudio)) + + /** + * Alias for calling [content] with + * `Content.ofAnArrayOfInputTextInputImageAndInputAudio(anArrayOfInputTextInputImageAndInputAudio)`. + */ + fun contentOfAnArrayOfInputTextInputImageAndInputAudio( + anArrayOfInputTextInputImageAndInputAudio: List ) = content( - Content.ofAnArrayOfInputTextAndInputImage( - anArrayOfInputTextAndInputImage + Content.ofAnArrayOfInputTextInputImageAndInputAudio( + anArrayOfInputTextInputImageAndInputAudio ) ) @@ -4467,7 +4475,9 @@ private constructor( private val responseInputText: ResponseInputText? = null, private val outputText: OutputText? = null, private val inputImage: InputImage? = null, - private val anArrayOfInputTextAndInputImage: List? = + private val responseInputAudio: ResponseInputAudio? = null, + private val anArrayOfInputTextInputImageAndInputAudio: + List? = null, private val _json: JsonValue? = null, ) { @@ -4487,12 +4497,17 @@ private constructor( fun inputImage(): Optional = Optional.ofNullable(inputImage) + /** An audio input to the model. */ + fun responseInputAudio(): Optional = + Optional.ofNullable(responseInputAudio) + /** - * A list of inputs, each of which may be either an input text or - * input image object. + * A list of inputs, each of which may be either an input text, + * input image, or input audio object. */ - fun anArrayOfInputTextAndInputImage(): Optional> = - Optional.ofNullable(anArrayOfInputTextAndInputImage) + fun anArrayOfInputTextInputImageAndInputAudio(): + Optional> = + Optional.ofNullable(anArrayOfInputTextInputImageAndInputAudio) fun isTextInput(): Boolean = textInput != null @@ -4502,8 +4517,10 @@ private constructor( fun isInputImage(): Boolean = inputImage != null - fun isAnArrayOfInputTextAndInputImage(): Boolean = - anArrayOfInputTextAndInputImage != null + fun isResponseInputAudio(): Boolean = responseInputAudio != null + + fun isAnArrayOfInputTextInputImageAndInputAudio(): Boolean = + anArrayOfInputTextInputImageAndInputAudio != null /** A text input to the model. */ fun asTextInput(): String = textInput.getOrThrow("textInput") @@ -4518,13 +4535,17 @@ private constructor( /** An image input to the model. */ fun asInputImage(): InputImage = inputImage.getOrThrow("inputImage") + /** An audio input to the model. */ + fun asResponseInputAudio(): ResponseInputAudio = + responseInputAudio.getOrThrow("responseInputAudio") + /** - * A list of inputs, each of which may be either an input text or - * input image object. + * A list of inputs, each of which may be either an input text, + * input image, or input audio object. */ - fun asAnArrayOfInputTextAndInputImage(): List = - anArrayOfInputTextAndInputImage.getOrThrow( - "anArrayOfInputTextAndInputImage" + fun asAnArrayOfInputTextInputImageAndInputAudio(): List = + anArrayOfInputTextInputImageAndInputAudio.getOrThrow( + "anArrayOfInputTextInputImageAndInputAudio" ) fun _json(): Optional = Optional.ofNullable(_json) @@ -4536,9 +4557,11 @@ private constructor( visitor.visitResponseInputText(responseInputText) outputText != null -> visitor.visitOutputText(outputText) inputImage != null -> visitor.visitInputImage(inputImage) - anArrayOfInputTextAndInputImage != null -> - visitor.visitAnArrayOfInputTextAndInputImage( - anArrayOfInputTextAndInputImage + responseInputAudio != null -> + visitor.visitResponseInputAudio(responseInputAudio) + anArrayOfInputTextInputImageAndInputAudio != null -> + visitor.visitAnArrayOfInputTextInputImageAndInputAudio( + anArrayOfInputTextInputImageAndInputAudio ) else -> visitor.unknown(_json) } @@ -4568,8 +4591,15 @@ private constructor( inputImage.validate() } - override fun visitAnArrayOfInputTextAndInputImage( - anArrayOfInputTextAndInputImage: List + override fun visitResponseInputAudio( + responseInputAudio: ResponseInputAudio + ) { + responseInputAudio.validate() + } + + override fun visitAnArrayOfInputTextInputImageAndInputAudio( + anArrayOfInputTextInputImageAndInputAudio: + List ) {} } ) @@ -4606,9 +4636,14 @@ private constructor( override fun visitInputImage(inputImage: InputImage) = inputImage.validity() - override fun visitAnArrayOfInputTextAndInputImage( - anArrayOfInputTextAndInputImage: List - ) = anArrayOfInputTextAndInputImage.size + override fun visitResponseInputAudio( + responseInputAudio: ResponseInputAudio + ) = responseInputAudio.validity() + + override fun visitAnArrayOfInputTextInputImageAndInputAudio( + anArrayOfInputTextInputImageAndInputAudio: + List + ) = anArrayOfInputTextInputImageAndInputAudio.size override fun unknown(json: JsonValue?) = 0 } @@ -4624,8 +4659,9 @@ private constructor( responseInputText == other.responseInputText && outputText == other.outputText && inputImage == other.inputImage && - anArrayOfInputTextAndInputImage == - other.anArrayOfInputTextAndInputImage + responseInputAudio == other.responseInputAudio && + anArrayOfInputTextInputImageAndInputAudio == + other.anArrayOfInputTextInputImageAndInputAudio } override fun hashCode(): Int = @@ -4634,7 +4670,8 @@ private constructor( responseInputText, outputText, inputImage, - anArrayOfInputTextAndInputImage, + responseInputAudio, + anArrayOfInputTextInputImageAndInputAudio, ) override fun toString(): String = @@ -4644,8 +4681,10 @@ private constructor( "Content{responseInputText=$responseInputText}" outputText != null -> "Content{outputText=$outputText}" inputImage != null -> "Content{inputImage=$inputImage}" - anArrayOfInputTextAndInputImage != null -> - "Content{anArrayOfInputTextAndInputImage=$anArrayOfInputTextAndInputImage}" + responseInputAudio != null -> + "Content{responseInputAudio=$responseInputAudio}" + anArrayOfInputTextInputImageAndInputAudio != null -> + "Content{anArrayOfInputTextInputImageAndInputAudio=$anArrayOfInputTextInputImageAndInputAudio}" _json != null -> "Content{_unknown=$_json}" else -> throw IllegalStateException("Invalid Content") } @@ -4672,17 +4711,24 @@ private constructor( fun ofInputImage(inputImage: InputImage) = Content(inputImage = inputImage) + /** An audio input to the model. */ + @JvmStatic + fun ofResponseInputAudio( + responseInputAudio: ResponseInputAudio + ) = Content(responseInputAudio = responseInputAudio) + /** - * A list of inputs, each of which may be either an input text - * or input image object. + * A list of inputs, each of which may be either an input text, + * input image, or input audio object. */ @JvmStatic - fun ofAnArrayOfInputTextAndInputImage( - anArrayOfInputTextAndInputImage: List + fun ofAnArrayOfInputTextInputImageAndInputAudio( + anArrayOfInputTextInputImageAndInputAudio: List ) = Content( - anArrayOfInputTextAndInputImage = - anArrayOfInputTextAndInputImage.toImmutable() + anArrayOfInputTextInputImageAndInputAudio = + anArrayOfInputTextInputImageAndInputAudio + .toImmutable() ) } @@ -4706,12 +4752,17 @@ private constructor( /** An image input to the model. */ fun visitInputImage(inputImage: InputImage): T + /** An audio input to the model. */ + fun visitResponseInputAudio( + responseInputAudio: ResponseInputAudio + ): T + /** - * A list of inputs, each of which may be either an input text - * or input image object. + * A list of inputs, each of which may be either an input text, + * input image, or input audio object. */ - fun visitAnArrayOfInputTextAndInputImage( - anArrayOfInputTextAndInputImage: List + fun visitAnArrayOfInputTextInputImageAndInputAudio( + anArrayOfInputTextInputImageAndInputAudio: List ): T /** @@ -4763,6 +4814,16 @@ private constructor( ?.let { Content(inputImage = it, _json = json) }, + tryDeserialize( + node, + jacksonTypeRef(), + ) + ?.let { + Content( + responseInputAudio = it, + _json = json, + ) + }, tryDeserialize(node, jacksonTypeRef()) ?.let { Content(textInput = it, _json = json) @@ -4773,7 +4834,7 @@ private constructor( ) ?.let { Content( - anArrayOfInputTextAndInputImage = + anArrayOfInputTextInputImageAndInputAudio = it, _json = json, ) @@ -4816,9 +4877,12 @@ private constructor( generator.writeObject(value.outputText) value.inputImage != null -> generator.writeObject(value.inputImage) - value.anArrayOfInputTextAndInputImage != null -> + value.responseInputAudio != null -> + generator.writeObject(value.responseInputAudio) + value.anArrayOfInputTextInputImageAndInputAudio != + null -> generator.writeObject( - value.anArrayOfInputTextAndInputImage + value.anArrayOfInputTextInputImageAndInputAudio ) value._json != null -> generator.writeObject(value._json) diff --git a/openai-java-core/src/main/kotlin/com/openai/models/evals/runs/RunListResponse.kt b/openai-java-core/src/main/kotlin/com/openai/models/evals/runs/RunListResponse.kt index 334bce07..061de359 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/evals/runs/RunListResponse.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/evals/runs/RunListResponse.kt @@ -35,6 +35,7 @@ import com.openai.models.responses.FileSearchTool import com.openai.models.responses.FunctionTool import com.openai.models.responses.ResponseFormatTextConfig import com.openai.models.responses.ResponseFormatTextJsonSchemaConfig +import com.openai.models.responses.ResponseInputAudio import com.openai.models.responses.ResponseInputText import com.openai.models.responses.Tool import com.openai.models.responses.WebSearchPreviewTool @@ -4341,14 +4342,21 @@ private constructor( /** * Alias for calling [content] with - * `Content.ofAnArrayOfInputTextAndInputImage(anArrayOfInputTextAndInputImage)`. + * `Content.ofResponseInputAudio(responseInputAudio)`. */ - fun contentOfAnArrayOfInputTextAndInputImage( - anArrayOfInputTextAndInputImage: List + fun content(responseInputAudio: ResponseInputAudio) = + content(Content.ofResponseInputAudio(responseInputAudio)) + + /** + * Alias for calling [content] with + * `Content.ofAnArrayOfInputTextInputImageAndInputAudio(anArrayOfInputTextInputImageAndInputAudio)`. + */ + fun contentOfAnArrayOfInputTextInputImageAndInputAudio( + anArrayOfInputTextInputImageAndInputAudio: List ) = content( - Content.ofAnArrayOfInputTextAndInputImage( - anArrayOfInputTextAndInputImage + Content.ofAnArrayOfInputTextInputImageAndInputAudio( + anArrayOfInputTextInputImageAndInputAudio ) ) @@ -4467,7 +4475,9 @@ private constructor( private val responseInputText: ResponseInputText? = null, private val outputText: OutputText? = null, private val inputImage: InputImage? = null, - private val anArrayOfInputTextAndInputImage: List? = + private val responseInputAudio: ResponseInputAudio? = null, + private val anArrayOfInputTextInputImageAndInputAudio: + List? = null, private val _json: JsonValue? = null, ) { @@ -4487,12 +4497,17 @@ private constructor( fun inputImage(): Optional = Optional.ofNullable(inputImage) + /** An audio input to the model. */ + fun responseInputAudio(): Optional = + Optional.ofNullable(responseInputAudio) + /** - * A list of inputs, each of which may be either an input text or - * input image object. + * A list of inputs, each of which may be either an input text, + * input image, or input audio object. */ - fun anArrayOfInputTextAndInputImage(): Optional> = - Optional.ofNullable(anArrayOfInputTextAndInputImage) + fun anArrayOfInputTextInputImageAndInputAudio(): + Optional> = + Optional.ofNullable(anArrayOfInputTextInputImageAndInputAudio) fun isTextInput(): Boolean = textInput != null @@ -4502,8 +4517,10 @@ private constructor( fun isInputImage(): Boolean = inputImage != null - fun isAnArrayOfInputTextAndInputImage(): Boolean = - anArrayOfInputTextAndInputImage != null + fun isResponseInputAudio(): Boolean = responseInputAudio != null + + fun isAnArrayOfInputTextInputImageAndInputAudio(): Boolean = + anArrayOfInputTextInputImageAndInputAudio != null /** A text input to the model. */ fun asTextInput(): String = textInput.getOrThrow("textInput") @@ -4518,13 +4535,17 @@ private constructor( /** An image input to the model. */ fun asInputImage(): InputImage = inputImage.getOrThrow("inputImage") + /** An audio input to the model. */ + fun asResponseInputAudio(): ResponseInputAudio = + responseInputAudio.getOrThrow("responseInputAudio") + /** - * A list of inputs, each of which may be either an input text or - * input image object. + * A list of inputs, each of which may be either an input text, + * input image, or input audio object. */ - fun asAnArrayOfInputTextAndInputImage(): List = - anArrayOfInputTextAndInputImage.getOrThrow( - "anArrayOfInputTextAndInputImage" + fun asAnArrayOfInputTextInputImageAndInputAudio(): List = + anArrayOfInputTextInputImageAndInputAudio.getOrThrow( + "anArrayOfInputTextInputImageAndInputAudio" ) fun _json(): Optional = Optional.ofNullable(_json) @@ -4536,9 +4557,11 @@ private constructor( visitor.visitResponseInputText(responseInputText) outputText != null -> visitor.visitOutputText(outputText) inputImage != null -> visitor.visitInputImage(inputImage) - anArrayOfInputTextAndInputImage != null -> - visitor.visitAnArrayOfInputTextAndInputImage( - anArrayOfInputTextAndInputImage + responseInputAudio != null -> + visitor.visitResponseInputAudio(responseInputAudio) + anArrayOfInputTextInputImageAndInputAudio != null -> + visitor.visitAnArrayOfInputTextInputImageAndInputAudio( + anArrayOfInputTextInputImageAndInputAudio ) else -> visitor.unknown(_json) } @@ -4568,8 +4591,15 @@ private constructor( inputImage.validate() } - override fun visitAnArrayOfInputTextAndInputImage( - anArrayOfInputTextAndInputImage: List + override fun visitResponseInputAudio( + responseInputAudio: ResponseInputAudio + ) { + responseInputAudio.validate() + } + + override fun visitAnArrayOfInputTextInputImageAndInputAudio( + anArrayOfInputTextInputImageAndInputAudio: + List ) {} } ) @@ -4606,9 +4636,14 @@ private constructor( override fun visitInputImage(inputImage: InputImage) = inputImage.validity() - override fun visitAnArrayOfInputTextAndInputImage( - anArrayOfInputTextAndInputImage: List - ) = anArrayOfInputTextAndInputImage.size + override fun visitResponseInputAudio( + responseInputAudio: ResponseInputAudio + ) = responseInputAudio.validity() + + override fun visitAnArrayOfInputTextInputImageAndInputAudio( + anArrayOfInputTextInputImageAndInputAudio: + List + ) = anArrayOfInputTextInputImageAndInputAudio.size override fun unknown(json: JsonValue?) = 0 } @@ -4624,8 +4659,9 @@ private constructor( responseInputText == other.responseInputText && outputText == other.outputText && inputImage == other.inputImage && - anArrayOfInputTextAndInputImage == - other.anArrayOfInputTextAndInputImage + responseInputAudio == other.responseInputAudio && + anArrayOfInputTextInputImageAndInputAudio == + other.anArrayOfInputTextInputImageAndInputAudio } override fun hashCode(): Int = @@ -4634,7 +4670,8 @@ private constructor( responseInputText, outputText, inputImage, - anArrayOfInputTextAndInputImage, + responseInputAudio, + anArrayOfInputTextInputImageAndInputAudio, ) override fun toString(): String = @@ -4644,8 +4681,10 @@ private constructor( "Content{responseInputText=$responseInputText}" outputText != null -> "Content{outputText=$outputText}" inputImage != null -> "Content{inputImage=$inputImage}" - anArrayOfInputTextAndInputImage != null -> - "Content{anArrayOfInputTextAndInputImage=$anArrayOfInputTextAndInputImage}" + responseInputAudio != null -> + "Content{responseInputAudio=$responseInputAudio}" + anArrayOfInputTextInputImageAndInputAudio != null -> + "Content{anArrayOfInputTextInputImageAndInputAudio=$anArrayOfInputTextInputImageAndInputAudio}" _json != null -> "Content{_unknown=$_json}" else -> throw IllegalStateException("Invalid Content") } @@ -4672,17 +4711,24 @@ private constructor( fun ofInputImage(inputImage: InputImage) = Content(inputImage = inputImage) + /** An audio input to the model. */ + @JvmStatic + fun ofResponseInputAudio( + responseInputAudio: ResponseInputAudio + ) = Content(responseInputAudio = responseInputAudio) + /** - * A list of inputs, each of which may be either an input text - * or input image object. + * A list of inputs, each of which may be either an input text, + * input image, or input audio object. */ @JvmStatic - fun ofAnArrayOfInputTextAndInputImage( - anArrayOfInputTextAndInputImage: List + fun ofAnArrayOfInputTextInputImageAndInputAudio( + anArrayOfInputTextInputImageAndInputAudio: List ) = Content( - anArrayOfInputTextAndInputImage = - anArrayOfInputTextAndInputImage.toImmutable() + anArrayOfInputTextInputImageAndInputAudio = + anArrayOfInputTextInputImageAndInputAudio + .toImmutable() ) } @@ -4706,12 +4752,17 @@ private constructor( /** An image input to the model. */ fun visitInputImage(inputImage: InputImage): T + /** An audio input to the model. */ + fun visitResponseInputAudio( + responseInputAudio: ResponseInputAudio + ): T + /** - * A list of inputs, each of which may be either an input text - * or input image object. + * A list of inputs, each of which may be either an input text, + * input image, or input audio object. */ - fun visitAnArrayOfInputTextAndInputImage( - anArrayOfInputTextAndInputImage: List + fun visitAnArrayOfInputTextInputImageAndInputAudio( + anArrayOfInputTextInputImageAndInputAudio: List ): T /** @@ -4763,6 +4814,16 @@ private constructor( ?.let { Content(inputImage = it, _json = json) }, + tryDeserialize( + node, + jacksonTypeRef(), + ) + ?.let { + Content( + responseInputAudio = it, + _json = json, + ) + }, tryDeserialize(node, jacksonTypeRef()) ?.let { Content(textInput = it, _json = json) @@ -4773,7 +4834,7 @@ private constructor( ) ?.let { Content( - anArrayOfInputTextAndInputImage = + anArrayOfInputTextInputImageAndInputAudio = it, _json = json, ) @@ -4816,9 +4877,12 @@ private constructor( generator.writeObject(value.outputText) value.inputImage != null -> generator.writeObject(value.inputImage) - value.anArrayOfInputTextAndInputImage != null -> + value.responseInputAudio != null -> + generator.writeObject(value.responseInputAudio) + value.anArrayOfInputTextInputImageAndInputAudio != + null -> generator.writeObject( - value.anArrayOfInputTextAndInputImage + value.anArrayOfInputTextInputImageAndInputAudio ) value._json != null -> generator.writeObject(value._json) diff --git a/openai-java-core/src/main/kotlin/com/openai/models/evals/runs/RunRetrieveResponse.kt b/openai-java-core/src/main/kotlin/com/openai/models/evals/runs/RunRetrieveResponse.kt index 4905e681..839c3545 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/evals/runs/RunRetrieveResponse.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/evals/runs/RunRetrieveResponse.kt @@ -35,6 +35,7 @@ import com.openai.models.responses.FileSearchTool import com.openai.models.responses.FunctionTool import com.openai.models.responses.ResponseFormatTextConfig import com.openai.models.responses.ResponseFormatTextJsonSchemaConfig +import com.openai.models.responses.ResponseInputAudio import com.openai.models.responses.ResponseInputText import com.openai.models.responses.Tool import com.openai.models.responses.WebSearchPreviewTool @@ -4341,14 +4342,21 @@ private constructor( /** * Alias for calling [content] with - * `Content.ofAnArrayOfInputTextAndInputImage(anArrayOfInputTextAndInputImage)`. + * `Content.ofResponseInputAudio(responseInputAudio)`. */ - fun contentOfAnArrayOfInputTextAndInputImage( - anArrayOfInputTextAndInputImage: List + fun content(responseInputAudio: ResponseInputAudio) = + content(Content.ofResponseInputAudio(responseInputAudio)) + + /** + * Alias for calling [content] with + * `Content.ofAnArrayOfInputTextInputImageAndInputAudio(anArrayOfInputTextInputImageAndInputAudio)`. + */ + fun contentOfAnArrayOfInputTextInputImageAndInputAudio( + anArrayOfInputTextInputImageAndInputAudio: List ) = content( - Content.ofAnArrayOfInputTextAndInputImage( - anArrayOfInputTextAndInputImage + Content.ofAnArrayOfInputTextInputImageAndInputAudio( + anArrayOfInputTextInputImageAndInputAudio ) ) @@ -4467,7 +4475,9 @@ private constructor( private val responseInputText: ResponseInputText? = null, private val outputText: OutputText? = null, private val inputImage: InputImage? = null, - private val anArrayOfInputTextAndInputImage: List? = + private val responseInputAudio: ResponseInputAudio? = null, + private val anArrayOfInputTextInputImageAndInputAudio: + List? = null, private val _json: JsonValue? = null, ) { @@ -4487,12 +4497,17 @@ private constructor( fun inputImage(): Optional = Optional.ofNullable(inputImage) + /** An audio input to the model. */ + fun responseInputAudio(): Optional = + Optional.ofNullable(responseInputAudio) + /** - * A list of inputs, each of which may be either an input text or - * input image object. + * A list of inputs, each of which may be either an input text, + * input image, or input audio object. */ - fun anArrayOfInputTextAndInputImage(): Optional> = - Optional.ofNullable(anArrayOfInputTextAndInputImage) + fun anArrayOfInputTextInputImageAndInputAudio(): + Optional> = + Optional.ofNullable(anArrayOfInputTextInputImageAndInputAudio) fun isTextInput(): Boolean = textInput != null @@ -4502,8 +4517,10 @@ private constructor( fun isInputImage(): Boolean = inputImage != null - fun isAnArrayOfInputTextAndInputImage(): Boolean = - anArrayOfInputTextAndInputImage != null + fun isResponseInputAudio(): Boolean = responseInputAudio != null + + fun isAnArrayOfInputTextInputImageAndInputAudio(): Boolean = + anArrayOfInputTextInputImageAndInputAudio != null /** A text input to the model. */ fun asTextInput(): String = textInput.getOrThrow("textInput") @@ -4518,13 +4535,17 @@ private constructor( /** An image input to the model. */ fun asInputImage(): InputImage = inputImage.getOrThrow("inputImage") + /** An audio input to the model. */ + fun asResponseInputAudio(): ResponseInputAudio = + responseInputAudio.getOrThrow("responseInputAudio") + /** - * A list of inputs, each of which may be either an input text or - * input image object. + * A list of inputs, each of which may be either an input text, + * input image, or input audio object. */ - fun asAnArrayOfInputTextAndInputImage(): List = - anArrayOfInputTextAndInputImage.getOrThrow( - "anArrayOfInputTextAndInputImage" + fun asAnArrayOfInputTextInputImageAndInputAudio(): List = + anArrayOfInputTextInputImageAndInputAudio.getOrThrow( + "anArrayOfInputTextInputImageAndInputAudio" ) fun _json(): Optional = Optional.ofNullable(_json) @@ -4536,9 +4557,11 @@ private constructor( visitor.visitResponseInputText(responseInputText) outputText != null -> visitor.visitOutputText(outputText) inputImage != null -> visitor.visitInputImage(inputImage) - anArrayOfInputTextAndInputImage != null -> - visitor.visitAnArrayOfInputTextAndInputImage( - anArrayOfInputTextAndInputImage + responseInputAudio != null -> + visitor.visitResponseInputAudio(responseInputAudio) + anArrayOfInputTextInputImageAndInputAudio != null -> + visitor.visitAnArrayOfInputTextInputImageAndInputAudio( + anArrayOfInputTextInputImageAndInputAudio ) else -> visitor.unknown(_json) } @@ -4568,8 +4591,15 @@ private constructor( inputImage.validate() } - override fun visitAnArrayOfInputTextAndInputImage( - anArrayOfInputTextAndInputImage: List + override fun visitResponseInputAudio( + responseInputAudio: ResponseInputAudio + ) { + responseInputAudio.validate() + } + + override fun visitAnArrayOfInputTextInputImageAndInputAudio( + anArrayOfInputTextInputImageAndInputAudio: + List ) {} } ) @@ -4606,9 +4636,14 @@ private constructor( override fun visitInputImage(inputImage: InputImage) = inputImage.validity() - override fun visitAnArrayOfInputTextAndInputImage( - anArrayOfInputTextAndInputImage: List - ) = anArrayOfInputTextAndInputImage.size + override fun visitResponseInputAudio( + responseInputAudio: ResponseInputAudio + ) = responseInputAudio.validity() + + override fun visitAnArrayOfInputTextInputImageAndInputAudio( + anArrayOfInputTextInputImageAndInputAudio: + List + ) = anArrayOfInputTextInputImageAndInputAudio.size override fun unknown(json: JsonValue?) = 0 } @@ -4624,8 +4659,9 @@ private constructor( responseInputText == other.responseInputText && outputText == other.outputText && inputImage == other.inputImage && - anArrayOfInputTextAndInputImage == - other.anArrayOfInputTextAndInputImage + responseInputAudio == other.responseInputAudio && + anArrayOfInputTextInputImageAndInputAudio == + other.anArrayOfInputTextInputImageAndInputAudio } override fun hashCode(): Int = @@ -4634,7 +4670,8 @@ private constructor( responseInputText, outputText, inputImage, - anArrayOfInputTextAndInputImage, + responseInputAudio, + anArrayOfInputTextInputImageAndInputAudio, ) override fun toString(): String = @@ -4644,8 +4681,10 @@ private constructor( "Content{responseInputText=$responseInputText}" outputText != null -> "Content{outputText=$outputText}" inputImage != null -> "Content{inputImage=$inputImage}" - anArrayOfInputTextAndInputImage != null -> - "Content{anArrayOfInputTextAndInputImage=$anArrayOfInputTextAndInputImage}" + responseInputAudio != null -> + "Content{responseInputAudio=$responseInputAudio}" + anArrayOfInputTextInputImageAndInputAudio != null -> + "Content{anArrayOfInputTextInputImageAndInputAudio=$anArrayOfInputTextInputImageAndInputAudio}" _json != null -> "Content{_unknown=$_json}" else -> throw IllegalStateException("Invalid Content") } @@ -4672,17 +4711,24 @@ private constructor( fun ofInputImage(inputImage: InputImage) = Content(inputImage = inputImage) + /** An audio input to the model. */ + @JvmStatic + fun ofResponseInputAudio( + responseInputAudio: ResponseInputAudio + ) = Content(responseInputAudio = responseInputAudio) + /** - * A list of inputs, each of which may be either an input text - * or input image object. + * A list of inputs, each of which may be either an input text, + * input image, or input audio object. */ @JvmStatic - fun ofAnArrayOfInputTextAndInputImage( - anArrayOfInputTextAndInputImage: List + fun ofAnArrayOfInputTextInputImageAndInputAudio( + anArrayOfInputTextInputImageAndInputAudio: List ) = Content( - anArrayOfInputTextAndInputImage = - anArrayOfInputTextAndInputImage.toImmutable() + anArrayOfInputTextInputImageAndInputAudio = + anArrayOfInputTextInputImageAndInputAudio + .toImmutable() ) } @@ -4706,12 +4752,17 @@ private constructor( /** An image input to the model. */ fun visitInputImage(inputImage: InputImage): T + /** An audio input to the model. */ + fun visitResponseInputAudio( + responseInputAudio: ResponseInputAudio + ): T + /** - * A list of inputs, each of which may be either an input text - * or input image object. + * A list of inputs, each of which may be either an input text, + * input image, or input audio object. */ - fun visitAnArrayOfInputTextAndInputImage( - anArrayOfInputTextAndInputImage: List + fun visitAnArrayOfInputTextInputImageAndInputAudio( + anArrayOfInputTextInputImageAndInputAudio: List ): T /** @@ -4763,6 +4814,16 @@ private constructor( ?.let { Content(inputImage = it, _json = json) }, + tryDeserialize( + node, + jacksonTypeRef(), + ) + ?.let { + Content( + responseInputAudio = it, + _json = json, + ) + }, tryDeserialize(node, jacksonTypeRef()) ?.let { Content(textInput = it, _json = json) @@ -4773,7 +4834,7 @@ private constructor( ) ?.let { Content( - anArrayOfInputTextAndInputImage = + anArrayOfInputTextInputImageAndInputAudio = it, _json = json, ) @@ -4816,9 +4877,12 @@ private constructor( generator.writeObject(value.outputText) value.inputImage != null -> generator.writeObject(value.inputImage) - value.anArrayOfInputTextAndInputImage != null -> + value.responseInputAudio != null -> + generator.writeObject(value.responseInputAudio) + value.anArrayOfInputTextInputImageAndInputAudio != + null -> generator.writeObject( - value.anArrayOfInputTextAndInputImage + value.anArrayOfInputTextInputImageAndInputAudio ) value._json != null -> generator.writeObject(value._json) diff --git a/openai-java-core/src/main/kotlin/com/openai/models/graders/gradermodels/LabelModelGrader.kt b/openai-java-core/src/main/kotlin/com/openai/models/graders/gradermodels/LabelModelGrader.kt index 860d1e77..41d00a30 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/graders/gradermodels/LabelModelGrader.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/graders/gradermodels/LabelModelGrader.kt @@ -26,6 +26,7 @@ import com.openai.core.checkRequired import com.openai.core.getOrThrow import com.openai.core.toImmutable import com.openai.errors.OpenAIInvalidDataException +import com.openai.models.responses.ResponseInputAudio import com.openai.models.responses.ResponseInputText import java.util.Collections import java.util.Objects @@ -532,13 +533,24 @@ private constructor( /** Alias for calling [content] with `Content.ofInputImage(inputImage)`. */ fun content(inputImage: Content.InputImage) = content(Content.ofInputImage(inputImage)) + /** + * Alias for calling [content] with `Content.ofResponseInputAudio(responseInputAudio)`. + */ + fun content(responseInputAudio: ResponseInputAudio) = + content(Content.ofResponseInputAudio(responseInputAudio)) + /** * Alias for calling [content] with - * `Content.ofAnArrayOfInputTextAndInputImage(anArrayOfInputTextAndInputImage)`. + * `Content.ofAnArrayOfInputTextInputImageAndInputAudio(anArrayOfInputTextInputImageAndInputAudio)`. */ - fun contentOfAnArrayOfInputTextAndInputImage( - anArrayOfInputTextAndInputImage: List - ) = content(Content.ofAnArrayOfInputTextAndInputImage(anArrayOfInputTextAndInputImage)) + fun contentOfAnArrayOfInputTextInputImageAndInputAudio( + anArrayOfInputTextInputImageAndInputAudio: List + ) = + content( + Content.ofAnArrayOfInputTextInputImageAndInputAudio( + anArrayOfInputTextInputImageAndInputAudio + ) + ) /** * The role of the message input. One of `user`, `assistant`, `system`, or `developer`. @@ -649,7 +661,8 @@ private constructor( private val responseInputText: ResponseInputText? = null, private val outputText: OutputText? = null, private val inputImage: InputImage? = null, - private val anArrayOfInputTextAndInputImage: List? = null, + private val responseInputAudio: ResponseInputAudio? = null, + private val anArrayOfInputTextInputImageAndInputAudio: List? = null, private val _json: JsonValue? = null, ) { @@ -666,11 +679,16 @@ private constructor( /** An image input to the model. */ fun inputImage(): Optional = Optional.ofNullable(inputImage) + /** An audio input to the model. */ + fun responseInputAudio(): Optional = + Optional.ofNullable(responseInputAudio) + /** - * A list of inputs, each of which may be either an input text or input image object. + * A list of inputs, each of which may be either an input text, input image, or input + * audio object. */ - fun anArrayOfInputTextAndInputImage(): Optional> = - Optional.ofNullable(anArrayOfInputTextAndInputImage) + fun anArrayOfInputTextInputImageAndInputAudio(): Optional> = + Optional.ofNullable(anArrayOfInputTextInputImageAndInputAudio) fun isTextInput(): Boolean = textInput != null @@ -680,8 +698,10 @@ private constructor( fun isInputImage(): Boolean = inputImage != null - fun isAnArrayOfInputTextAndInputImage(): Boolean = - anArrayOfInputTextAndInputImage != null + fun isResponseInputAudio(): Boolean = responseInputAudio != null + + fun isAnArrayOfInputTextInputImageAndInputAudio(): Boolean = + anArrayOfInputTextInputImageAndInputAudio != null /** A text input to the model. */ fun asTextInput(): String = textInput.getOrThrow("textInput") @@ -696,11 +716,18 @@ private constructor( /** An image input to the model. */ fun asInputImage(): InputImage = inputImage.getOrThrow("inputImage") + /** An audio input to the model. */ + fun asResponseInputAudio(): ResponseInputAudio = + responseInputAudio.getOrThrow("responseInputAudio") + /** - * A list of inputs, each of which may be either an input text or input image object. + * A list of inputs, each of which may be either an input text, input image, or input + * audio object. */ - fun asAnArrayOfInputTextAndInputImage(): List = - anArrayOfInputTextAndInputImage.getOrThrow("anArrayOfInputTextAndInputImage") + fun asAnArrayOfInputTextInputImageAndInputAudio(): List = + anArrayOfInputTextInputImageAndInputAudio.getOrThrow( + "anArrayOfInputTextInputImageAndInputAudio" + ) fun _json(): Optional = Optional.ofNullable(_json) @@ -710,9 +737,11 @@ private constructor( responseInputText != null -> visitor.visitResponseInputText(responseInputText) outputText != null -> visitor.visitOutputText(outputText) inputImage != null -> visitor.visitInputImage(inputImage) - anArrayOfInputTextAndInputImage != null -> - visitor.visitAnArrayOfInputTextAndInputImage( - anArrayOfInputTextAndInputImage + responseInputAudio != null -> + visitor.visitResponseInputAudio(responseInputAudio) + anArrayOfInputTextInputImageAndInputAudio != null -> + visitor.visitAnArrayOfInputTextInputImageAndInputAudio( + anArrayOfInputTextInputImageAndInputAudio ) else -> visitor.unknown(_json) } @@ -740,8 +769,14 @@ private constructor( inputImage.validate() } - override fun visitAnArrayOfInputTextAndInputImage( - anArrayOfInputTextAndInputImage: List + override fun visitResponseInputAudio( + responseInputAudio: ResponseInputAudio + ) { + responseInputAudio.validate() + } + + override fun visitAnArrayOfInputTextInputImageAndInputAudio( + anArrayOfInputTextInputImageAndInputAudio: List ) {} } ) @@ -775,9 +810,13 @@ private constructor( override fun visitInputImage(inputImage: InputImage) = inputImage.validity() - override fun visitAnArrayOfInputTextAndInputImage( - anArrayOfInputTextAndInputImage: List - ) = anArrayOfInputTextAndInputImage.size + override fun visitResponseInputAudio( + responseInputAudio: ResponseInputAudio + ) = responseInputAudio.validity() + + override fun visitAnArrayOfInputTextInputImageAndInputAudio( + anArrayOfInputTextInputImageAndInputAudio: List + ) = anArrayOfInputTextInputImageAndInputAudio.size override fun unknown(json: JsonValue?) = 0 } @@ -793,7 +832,9 @@ private constructor( responseInputText == other.responseInputText && outputText == other.outputText && inputImage == other.inputImage && - anArrayOfInputTextAndInputImage == other.anArrayOfInputTextAndInputImage + responseInputAudio == other.responseInputAudio && + anArrayOfInputTextInputImageAndInputAudio == + other.anArrayOfInputTextInputImageAndInputAudio } override fun hashCode(): Int = @@ -802,7 +843,8 @@ private constructor( responseInputText, outputText, inputImage, - anArrayOfInputTextAndInputImage, + responseInputAudio, + anArrayOfInputTextInputImageAndInputAudio, ) override fun toString(): String = @@ -811,8 +853,9 @@ private constructor( responseInputText != null -> "Content{responseInputText=$responseInputText}" outputText != null -> "Content{outputText=$outputText}" inputImage != null -> "Content{inputImage=$inputImage}" - anArrayOfInputTextAndInputImage != null -> - "Content{anArrayOfInputTextAndInputImage=$anArrayOfInputTextAndInputImage}" + responseInputAudio != null -> "Content{responseInputAudio=$responseInputAudio}" + anArrayOfInputTextInputImageAndInputAudio != null -> + "Content{anArrayOfInputTextInputImageAndInputAudio=$anArrayOfInputTextInputImageAndInputAudio}" _json != null -> "Content{_unknown=$_json}" else -> throw IllegalStateException("Invalid Content") } @@ -835,17 +878,22 @@ private constructor( @JvmStatic fun ofInputImage(inputImage: InputImage) = Content(inputImage = inputImage) + /** An audio input to the model. */ + @JvmStatic + fun ofResponseInputAudio(responseInputAudio: ResponseInputAudio) = + Content(responseInputAudio = responseInputAudio) + /** - * A list of inputs, each of which may be either an input text or input image - * object. + * A list of inputs, each of which may be either an input text, input image, or + * input audio object. */ @JvmStatic - fun ofAnArrayOfInputTextAndInputImage( - anArrayOfInputTextAndInputImage: List + fun ofAnArrayOfInputTextInputImageAndInputAudio( + anArrayOfInputTextInputImageAndInputAudio: List ) = Content( - anArrayOfInputTextAndInputImage = - anArrayOfInputTextAndInputImage.toImmutable() + anArrayOfInputTextInputImageAndInputAudio = + anArrayOfInputTextInputImageAndInputAudio.toImmutable() ) } @@ -867,12 +915,15 @@ private constructor( /** An image input to the model. */ fun visitInputImage(inputImage: InputImage): T + /** An audio input to the model. */ + fun visitResponseInputAudio(responseInputAudio: ResponseInputAudio): T + /** - * A list of inputs, each of which may be either an input text or input image - * object. + * A list of inputs, each of which may be either an input text, input image, or + * input audio object. */ - fun visitAnArrayOfInputTextAndInputImage( - anArrayOfInputTextAndInputImage: List + fun visitAnArrayOfInputTextInputImageAndInputAudio( + anArrayOfInputTextInputImageAndInputAudio: List ): T /** @@ -906,11 +957,17 @@ private constructor( tryDeserialize(node, jacksonTypeRef())?.let { Content(inputImage = it, _json = json) }, + tryDeserialize(node, jacksonTypeRef())?.let { + Content(responseInputAudio = it, _json = json) + }, tryDeserialize(node, jacksonTypeRef())?.let { Content(textInput = it, _json = json) }, tryDeserialize(node, jacksonTypeRef>())?.let { - Content(anArrayOfInputTextAndInputImage = it, _json = json) + Content( + anArrayOfInputTextInputImageAndInputAudio = it, + _json = json, + ) }, ) .filterNotNull() @@ -942,8 +999,10 @@ private constructor( generator.writeObject(value.responseInputText) value.outputText != null -> generator.writeObject(value.outputText) value.inputImage != null -> generator.writeObject(value.inputImage) - value.anArrayOfInputTextAndInputImage != null -> - generator.writeObject(value.anArrayOfInputTextAndInputImage) + value.responseInputAudio != null -> + generator.writeObject(value.responseInputAudio) + value.anArrayOfInputTextInputImageAndInputAudio != null -> + generator.writeObject(value.anArrayOfInputTextInputImageAndInputAudio) value._json != null -> generator.writeObject(value._json) else -> throw IllegalStateException("Invalid Content") } diff --git a/openai-java-core/src/main/kotlin/com/openai/models/graders/gradermodels/ScoreModelGrader.kt b/openai-java-core/src/main/kotlin/com/openai/models/graders/gradermodels/ScoreModelGrader.kt index a193b7fa..74e5b016 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/graders/gradermodels/ScoreModelGrader.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/graders/gradermodels/ScoreModelGrader.kt @@ -26,6 +26,7 @@ import com.openai.core.checkRequired import com.openai.core.getOrThrow import com.openai.core.toImmutable import com.openai.errors.OpenAIInvalidDataException +import com.openai.models.responses.ResponseInputAudio import com.openai.models.responses.ResponseInputText import java.util.Collections import java.util.Objects @@ -496,13 +497,24 @@ private constructor( /** Alias for calling [content] with `Content.ofInputImage(inputImage)`. */ fun content(inputImage: Content.InputImage) = content(Content.ofInputImage(inputImage)) + /** + * Alias for calling [content] with `Content.ofResponseInputAudio(responseInputAudio)`. + */ + fun content(responseInputAudio: ResponseInputAudio) = + content(Content.ofResponseInputAudio(responseInputAudio)) + /** * Alias for calling [content] with - * `Content.ofAnArrayOfInputTextAndInputImage(anArrayOfInputTextAndInputImage)`. + * `Content.ofAnArrayOfInputTextInputImageAndInputAudio(anArrayOfInputTextInputImageAndInputAudio)`. */ - fun contentOfAnArrayOfInputTextAndInputImage( - anArrayOfInputTextAndInputImage: List - ) = content(Content.ofAnArrayOfInputTextAndInputImage(anArrayOfInputTextAndInputImage)) + fun contentOfAnArrayOfInputTextInputImageAndInputAudio( + anArrayOfInputTextInputImageAndInputAudio: List + ) = + content( + Content.ofAnArrayOfInputTextInputImageAndInputAudio( + anArrayOfInputTextInputImageAndInputAudio + ) + ) /** * The role of the message input. One of `user`, `assistant`, `system`, or `developer`. @@ -613,7 +625,8 @@ private constructor( private val responseInputText: ResponseInputText? = null, private val outputText: OutputText? = null, private val inputImage: InputImage? = null, - private val anArrayOfInputTextAndInputImage: List? = null, + private val responseInputAudio: ResponseInputAudio? = null, + private val anArrayOfInputTextInputImageAndInputAudio: List? = null, private val _json: JsonValue? = null, ) { @@ -630,11 +643,16 @@ private constructor( /** An image input to the model. */ fun inputImage(): Optional = Optional.ofNullable(inputImage) + /** An audio input to the model. */ + fun responseInputAudio(): Optional = + Optional.ofNullable(responseInputAudio) + /** - * A list of inputs, each of which may be either an input text or input image object. + * A list of inputs, each of which may be either an input text, input image, or input + * audio object. */ - fun anArrayOfInputTextAndInputImage(): Optional> = - Optional.ofNullable(anArrayOfInputTextAndInputImage) + fun anArrayOfInputTextInputImageAndInputAudio(): Optional> = + Optional.ofNullable(anArrayOfInputTextInputImageAndInputAudio) fun isTextInput(): Boolean = textInput != null @@ -644,8 +662,10 @@ private constructor( fun isInputImage(): Boolean = inputImage != null - fun isAnArrayOfInputTextAndInputImage(): Boolean = - anArrayOfInputTextAndInputImage != null + fun isResponseInputAudio(): Boolean = responseInputAudio != null + + fun isAnArrayOfInputTextInputImageAndInputAudio(): Boolean = + anArrayOfInputTextInputImageAndInputAudio != null /** A text input to the model. */ fun asTextInput(): String = textInput.getOrThrow("textInput") @@ -660,11 +680,18 @@ private constructor( /** An image input to the model. */ fun asInputImage(): InputImage = inputImage.getOrThrow("inputImage") + /** An audio input to the model. */ + fun asResponseInputAudio(): ResponseInputAudio = + responseInputAudio.getOrThrow("responseInputAudio") + /** - * A list of inputs, each of which may be either an input text or input image object. + * A list of inputs, each of which may be either an input text, input image, or input + * audio object. */ - fun asAnArrayOfInputTextAndInputImage(): List = - anArrayOfInputTextAndInputImage.getOrThrow("anArrayOfInputTextAndInputImage") + fun asAnArrayOfInputTextInputImageAndInputAudio(): List = + anArrayOfInputTextInputImageAndInputAudio.getOrThrow( + "anArrayOfInputTextInputImageAndInputAudio" + ) fun _json(): Optional = Optional.ofNullable(_json) @@ -674,9 +701,11 @@ private constructor( responseInputText != null -> visitor.visitResponseInputText(responseInputText) outputText != null -> visitor.visitOutputText(outputText) inputImage != null -> visitor.visitInputImage(inputImage) - anArrayOfInputTextAndInputImage != null -> - visitor.visitAnArrayOfInputTextAndInputImage( - anArrayOfInputTextAndInputImage + responseInputAudio != null -> + visitor.visitResponseInputAudio(responseInputAudio) + anArrayOfInputTextInputImageAndInputAudio != null -> + visitor.visitAnArrayOfInputTextInputImageAndInputAudio( + anArrayOfInputTextInputImageAndInputAudio ) else -> visitor.unknown(_json) } @@ -704,8 +733,14 @@ private constructor( inputImage.validate() } - override fun visitAnArrayOfInputTextAndInputImage( - anArrayOfInputTextAndInputImage: List + override fun visitResponseInputAudio( + responseInputAudio: ResponseInputAudio + ) { + responseInputAudio.validate() + } + + override fun visitAnArrayOfInputTextInputImageAndInputAudio( + anArrayOfInputTextInputImageAndInputAudio: List ) {} } ) @@ -739,9 +774,13 @@ private constructor( override fun visitInputImage(inputImage: InputImage) = inputImage.validity() - override fun visitAnArrayOfInputTextAndInputImage( - anArrayOfInputTextAndInputImage: List - ) = anArrayOfInputTextAndInputImage.size + override fun visitResponseInputAudio( + responseInputAudio: ResponseInputAudio + ) = responseInputAudio.validity() + + override fun visitAnArrayOfInputTextInputImageAndInputAudio( + anArrayOfInputTextInputImageAndInputAudio: List + ) = anArrayOfInputTextInputImageAndInputAudio.size override fun unknown(json: JsonValue?) = 0 } @@ -757,7 +796,9 @@ private constructor( responseInputText == other.responseInputText && outputText == other.outputText && inputImage == other.inputImage && - anArrayOfInputTextAndInputImage == other.anArrayOfInputTextAndInputImage + responseInputAudio == other.responseInputAudio && + anArrayOfInputTextInputImageAndInputAudio == + other.anArrayOfInputTextInputImageAndInputAudio } override fun hashCode(): Int = @@ -766,7 +807,8 @@ private constructor( responseInputText, outputText, inputImage, - anArrayOfInputTextAndInputImage, + responseInputAudio, + anArrayOfInputTextInputImageAndInputAudio, ) override fun toString(): String = @@ -775,8 +817,9 @@ private constructor( responseInputText != null -> "Content{responseInputText=$responseInputText}" outputText != null -> "Content{outputText=$outputText}" inputImage != null -> "Content{inputImage=$inputImage}" - anArrayOfInputTextAndInputImage != null -> - "Content{anArrayOfInputTextAndInputImage=$anArrayOfInputTextAndInputImage}" + responseInputAudio != null -> "Content{responseInputAudio=$responseInputAudio}" + anArrayOfInputTextInputImageAndInputAudio != null -> + "Content{anArrayOfInputTextInputImageAndInputAudio=$anArrayOfInputTextInputImageAndInputAudio}" _json != null -> "Content{_unknown=$_json}" else -> throw IllegalStateException("Invalid Content") } @@ -799,17 +842,22 @@ private constructor( @JvmStatic fun ofInputImage(inputImage: InputImage) = Content(inputImage = inputImage) + /** An audio input to the model. */ + @JvmStatic + fun ofResponseInputAudio(responseInputAudio: ResponseInputAudio) = + Content(responseInputAudio = responseInputAudio) + /** - * A list of inputs, each of which may be either an input text or input image - * object. + * A list of inputs, each of which may be either an input text, input image, or + * input audio object. */ @JvmStatic - fun ofAnArrayOfInputTextAndInputImage( - anArrayOfInputTextAndInputImage: List + fun ofAnArrayOfInputTextInputImageAndInputAudio( + anArrayOfInputTextInputImageAndInputAudio: List ) = Content( - anArrayOfInputTextAndInputImage = - anArrayOfInputTextAndInputImage.toImmutable() + anArrayOfInputTextInputImageAndInputAudio = + anArrayOfInputTextInputImageAndInputAudio.toImmutable() ) } @@ -831,12 +879,15 @@ private constructor( /** An image input to the model. */ fun visitInputImage(inputImage: InputImage): T + /** An audio input to the model. */ + fun visitResponseInputAudio(responseInputAudio: ResponseInputAudio): T + /** - * A list of inputs, each of which may be either an input text or input image - * object. + * A list of inputs, each of which may be either an input text, input image, or + * input audio object. */ - fun visitAnArrayOfInputTextAndInputImage( - anArrayOfInputTextAndInputImage: List + fun visitAnArrayOfInputTextInputImageAndInputAudio( + anArrayOfInputTextInputImageAndInputAudio: List ): T /** @@ -870,11 +921,17 @@ private constructor( tryDeserialize(node, jacksonTypeRef())?.let { Content(inputImage = it, _json = json) }, + tryDeserialize(node, jacksonTypeRef())?.let { + Content(responseInputAudio = it, _json = json) + }, tryDeserialize(node, jacksonTypeRef())?.let { Content(textInput = it, _json = json) }, tryDeserialize(node, jacksonTypeRef>())?.let { - Content(anArrayOfInputTextAndInputImage = it, _json = json) + Content( + anArrayOfInputTextInputImageAndInputAudio = it, + _json = json, + ) }, ) .filterNotNull() @@ -906,8 +963,10 @@ private constructor( generator.writeObject(value.responseInputText) value.outputText != null -> generator.writeObject(value.outputText) value.inputImage != null -> generator.writeObject(value.inputImage) - value.anArrayOfInputTextAndInputImage != null -> - generator.writeObject(value.anArrayOfInputTextAndInputImage) + value.responseInputAudio != null -> + generator.writeObject(value.responseInputAudio) + value.anArrayOfInputTextInputImageAndInputAudio != null -> + generator.writeObject(value.anArrayOfInputTextInputImageAndInputAudio) value._json != null -> generator.writeObject(value._json) else -> throw IllegalStateException("Invalid Content") } diff --git a/openai-java-core/src/main/kotlin/com/openai/models/responses/Response.kt b/openai-java-core/src/main/kotlin/com/openai/models/responses/Response.kt index 37595bcb..a7c5cc75 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/responses/Response.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/responses/Response.kt @@ -306,7 +306,7 @@ private constructor( * [file search](https://platform.openai.com/docs/guides/tools-file-search). Learn more about * [built-in tools](https://platform.openai.com/docs/guides/tools). * - **MCP Tools**: Integrations with third-party systems via custom MCP servers or predefined - * connectors such as Google Drive and Notion. Learn more about + * connectors such as Google Drive and SharePoint. Learn more about * [MCP Tools](https://platform.openai.com/docs/guides/tools-connectors-mcp). * - **Function calls (custom tools)**: Functions that are defined by you, enabling the model to * call your own code with strongly typed arguments and outputs. Learn more about @@ -1186,7 +1186,7 @@ private constructor( * [file search](https://platform.openai.com/docs/guides/tools-file-search). Learn more * about [built-in tools](https://platform.openai.com/docs/guides/tools). * - **MCP Tools**: Integrations with third-party systems via custom MCP servers or - * predefined connectors such as Google Drive and Notion. Learn more about + * predefined connectors such as Google Drive and SharePoint. Learn more about * [MCP Tools](https://platform.openai.com/docs/guides/tools-connectors-mcp). * - **Function calls (custom tools)**: Functions that are defined by you, enabling the * model to call your own code with strongly typed arguments and outputs. Learn more about diff --git a/openai-java-core/src/main/kotlin/com/openai/models/responses/ResponseContent.kt b/openai-java-core/src/main/kotlin/com/openai/models/responses/ResponseContent.kt index b0a0afee..377e39e2 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/responses/ResponseContent.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/responses/ResponseContent.kt @@ -26,6 +26,7 @@ private constructor( private val inputText: ResponseInputText? = null, private val inputImage: ResponseInputImage? = null, private val inputFile: ResponseInputFile? = null, + private val inputAudio: ResponseInputAudio? = null, private val outputText: ResponseOutputText? = null, private val outputRefusal: ResponseOutputRefusal? = null, private val _json: JsonValue? = null, @@ -43,6 +44,9 @@ private constructor( /** A file input to the model. */ fun inputFile(): Optional = Optional.ofNullable(inputFile) + /** An audio input to the model. */ + fun inputAudio(): Optional = Optional.ofNullable(inputAudio) + /** A text output from the model. */ fun outputText(): Optional = Optional.ofNullable(outputText) @@ -55,6 +59,8 @@ private constructor( fun isInputFile(): Boolean = inputFile != null + fun isInputAudio(): Boolean = inputAudio != null + fun isOutputText(): Boolean = outputText != null fun isOutputRefusal(): Boolean = outputRefusal != null @@ -71,6 +77,9 @@ private constructor( /** A file input to the model. */ fun asInputFile(): ResponseInputFile = inputFile.getOrThrow("inputFile") + /** An audio input to the model. */ + fun asInputAudio(): ResponseInputAudio = inputAudio.getOrThrow("inputAudio") + /** A text output from the model. */ fun asOutputText(): ResponseOutputText = outputText.getOrThrow("outputText") @@ -84,6 +93,7 @@ private constructor( inputText != null -> visitor.visitInputText(inputText) inputImage != null -> visitor.visitInputImage(inputImage) inputFile != null -> visitor.visitInputFile(inputFile) + inputAudio != null -> visitor.visitInputAudio(inputAudio) outputText != null -> visitor.visitOutputText(outputText) outputRefusal != null -> visitor.visitOutputRefusal(outputRefusal) else -> visitor.unknown(_json) @@ -110,6 +120,10 @@ private constructor( inputFile.validate() } + override fun visitInputAudio(inputAudio: ResponseInputAudio) { + inputAudio.validate() + } + override fun visitOutputText(outputText: ResponseOutputText) { outputText.validate() } @@ -145,6 +159,8 @@ private constructor( override fun visitInputFile(inputFile: ResponseInputFile) = inputFile.validity() + override fun visitInputAudio(inputAudio: ResponseInputAudio) = inputAudio.validity() + override fun visitOutputText(outputText: ResponseOutputText) = outputText.validity() override fun visitOutputRefusal(outputRefusal: ResponseOutputRefusal) = @@ -163,18 +179,20 @@ private constructor( inputText == other.inputText && inputImage == other.inputImage && inputFile == other.inputFile && + inputAudio == other.inputAudio && outputText == other.outputText && outputRefusal == other.outputRefusal } override fun hashCode(): Int = - Objects.hash(inputText, inputImage, inputFile, outputText, outputRefusal) + Objects.hash(inputText, inputImage, inputFile, inputAudio, outputText, outputRefusal) override fun toString(): String = when { inputText != null -> "ResponseContent{inputText=$inputText}" inputImage != null -> "ResponseContent{inputImage=$inputImage}" inputFile != null -> "ResponseContent{inputFile=$inputFile}" + inputAudio != null -> "ResponseContent{inputAudio=$inputAudio}" outputText != null -> "ResponseContent{outputText=$outputText}" outputRefusal != null -> "ResponseContent{outputRefusal=$outputRefusal}" _json != null -> "ResponseContent{_unknown=$_json}" @@ -198,6 +216,10 @@ private constructor( @JvmStatic fun ofInputFile(inputFile: ResponseInputFile) = ResponseContent(inputFile = inputFile) + /** An audio input to the model. */ + @JvmStatic + fun ofInputAudio(inputAudio: ResponseInputAudio) = ResponseContent(inputAudio = inputAudio) + /** A text output from the model. */ @JvmStatic fun ofOutputText(outputText: ResponseOutputText) = ResponseContent(outputText = outputText) @@ -226,6 +248,9 @@ private constructor( /** A file input to the model. */ fun visitInputFile(inputFile: ResponseInputFile): T + /** An audio input to the model. */ + fun visitInputAudio(inputAudio: ResponseInputAudio): T + /** A text output from the model. */ fun visitOutputText(outputText: ResponseOutputText): T @@ -263,6 +288,9 @@ private constructor( tryDeserialize(node, jacksonTypeRef())?.let { ResponseContent(inputFile = it, _json = json) }, + tryDeserialize(node, jacksonTypeRef())?.let { + ResponseContent(inputAudio = it, _json = json) + }, tryDeserialize(node, jacksonTypeRef())?.let { ResponseContent(outputText = it, _json = json) }, @@ -296,6 +324,7 @@ private constructor( value.inputText != null -> generator.writeObject(value.inputText) value.inputImage != null -> generator.writeObject(value.inputImage) value.inputFile != null -> generator.writeObject(value.inputFile) + value.inputAudio != null -> generator.writeObject(value.inputAudio) value.outputText != null -> generator.writeObject(value.outputText) value.outputRefusal != null -> generator.writeObject(value.outputRefusal) value._json != null -> generator.writeObject(value._json) diff --git a/openai-java-core/src/main/kotlin/com/openai/models/responses/ResponseCreateParams.kt b/openai-java-core/src/main/kotlin/com/openai/models/responses/ResponseCreateParams.kt index de7abac7..212b9af9 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/responses/ResponseCreateParams.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/responses/ResponseCreateParams.kt @@ -303,7 +303,7 @@ private constructor( * [file search](https://platform.openai.com/docs/guides/tools-file-search). Learn more about * [built-in tools](https://platform.openai.com/docs/guides/tools). * - **MCP Tools**: Integrations with third-party systems via custom MCP servers or predefined - * connectors such as Google Drive and Notion. Learn more about + * connectors such as Google Drive and SharePoint. Learn more about * [MCP Tools](https://platform.openai.com/docs/guides/tools-connectors-mcp). * - **Function calls (custom tools)**: Functions that are defined by you, enabling the model to * call your own code with strongly typed arguments and outputs. Learn more about @@ -1158,7 +1158,7 @@ private constructor( * [file search](https://platform.openai.com/docs/guides/tools-file-search). Learn more * about [built-in tools](https://platform.openai.com/docs/guides/tools). * - **MCP Tools**: Integrations with third-party systems via custom MCP servers or - * predefined connectors such as Google Drive and Notion. Learn more about + * predefined connectors such as Google Drive and SharePoint. Learn more about * [MCP Tools](https://platform.openai.com/docs/guides/tools-connectors-mcp). * - **Function calls (custom tools)**: Functions that are defined by you, enabling the * model to call your own code with strongly typed arguments and outputs. Learn more about @@ -1900,7 +1900,7 @@ private constructor( * [file search](https://platform.openai.com/docs/guides/tools-file-search). Learn more * about [built-in tools](https://platform.openai.com/docs/guides/tools). * - **MCP Tools**: Integrations with third-party systems via custom MCP servers or - * predefined connectors such as Google Drive and Notion. Learn more about + * predefined connectors such as Google Drive and SharePoint. Learn more about * [MCP Tools](https://platform.openai.com/docs/guides/tools-connectors-mcp). * - **Function calls (custom tools)**: Functions that are defined by you, enabling the * model to call your own code with strongly typed arguments and outputs. Learn more about @@ -2831,7 +2831,7 @@ private constructor( * [file search](https://platform.openai.com/docs/guides/tools-file-search). Learn * more about [built-in tools](https://platform.openai.com/docs/guides/tools). * - **MCP Tools**: Integrations with third-party systems via custom MCP servers or - * predefined connectors such as Google Drive and Notion. Learn more about + * predefined connectors such as Google Drive and SharePoint. Learn more about * [MCP Tools](https://platform.openai.com/docs/guides/tools-connectors-mcp). * - **Function calls (custom tools)**: Functions that are defined by you, enabling the * model to call your own code with strongly typed arguments and outputs. Learn more diff --git a/openai-java-core/src/main/kotlin/com/openai/models/responses/ResponseInputAudio.kt b/openai-java-core/src/main/kotlin/com/openai/models/responses/ResponseInputAudio.kt index a61f1781..d3e3f472 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/responses/ResponseInputAudio.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/responses/ResponseInputAudio.kt @@ -20,34 +20,24 @@ import kotlin.jvm.optionals.getOrNull /** An audio input to the model. */ class ResponseInputAudio private constructor( - private val data: JsonField, - private val format: JsonField, + private val inputAudio: JsonField, private val type: JsonValue, private val additionalProperties: MutableMap, ) { @JsonCreator private constructor( - @JsonProperty("data") @ExcludeMissing data: JsonField = JsonMissing.of(), - @JsonProperty("format") @ExcludeMissing format: JsonField = JsonMissing.of(), + @JsonProperty("input_audio") + @ExcludeMissing + inputAudio: JsonField = JsonMissing.of(), @JsonProperty("type") @ExcludeMissing type: JsonValue = JsonMissing.of(), - ) : this(data, format, type, mutableMapOf()) + ) : this(inputAudio, type, mutableMapOf()) /** - * Base64-encoded audio data. - * - * @throws OpenAIInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected value). - */ - fun data(): String = data.getRequired("data") - - /** - * The format of the audio data. Currently supported formats are `mp3` and `wav`. - * * @throws OpenAIInvalidDataException if the JSON field has an unexpected type or is * unexpectedly missing or null (e.g. if the server responded with an unexpected value). */ - fun format(): Format = format.getRequired("format") + fun inputAudio(): InputAudio = inputAudio.getRequired("input_audio") /** * The type of the input item. Always `input_audio`. @@ -63,18 +53,13 @@ private constructor( @JsonProperty("type") @ExcludeMissing fun _type(): JsonValue = type /** - * Returns the raw JSON value of [data]. - * - * Unlike [data], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("data") @ExcludeMissing fun _data(): JsonField = data - - /** - * Returns the raw JSON value of [format]. + * Returns the raw JSON value of [inputAudio]. * - * Unlike [format], this method doesn't throw if the JSON field has an unexpected type. + * Unlike [inputAudio], this method doesn't throw if the JSON field has an unexpected type. */ - @JsonProperty("format") @ExcludeMissing fun _format(): JsonField = format + @JsonProperty("input_audio") + @ExcludeMissing + fun _inputAudio(): JsonField = inputAudio @JsonAnySetter private fun putAdditionalProperty(key: String, value: JsonValue) { @@ -95,8 +80,7 @@ private constructor( * * The following fields are required: * ```java - * .data() - * .format() + * .inputAudio() * ``` */ @JvmStatic fun builder() = Builder() @@ -105,40 +89,27 @@ private constructor( /** A builder for [ResponseInputAudio]. */ class Builder internal constructor() { - private var data: JsonField? = null - private var format: JsonField? = null + private var inputAudio: JsonField? = null private var type: JsonValue = JsonValue.from("input_audio") private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(responseInputAudio: ResponseInputAudio) = apply { - data = responseInputAudio.data - format = responseInputAudio.format + inputAudio = responseInputAudio.inputAudio type = responseInputAudio.type additionalProperties = responseInputAudio.additionalProperties.toMutableMap() } - /** Base64-encoded audio data. */ - fun data(data: String) = data(JsonField.of(data)) - - /** - * Sets [Builder.data] to an arbitrary JSON value. - * - * You should usually call [Builder.data] with a well-typed [String] value instead. This - * method is primarily for setting the field to an undocumented or not yet supported value. - */ - fun data(data: JsonField) = apply { this.data = data } - - /** The format of the audio data. Currently supported formats are `mp3` and `wav`. */ - fun format(format: Format) = format(JsonField.of(format)) + fun inputAudio(inputAudio: InputAudio) = inputAudio(JsonField.of(inputAudio)) /** - * Sets [Builder.format] to an arbitrary JSON value. + * Sets [Builder.inputAudio] to an arbitrary JSON value. * - * You should usually call [Builder.format] with a well-typed [Format] value instead. This - * method is primarily for setting the field to an undocumented or not yet supported value. + * You should usually call [Builder.inputAudio] with a well-typed [InputAudio] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. */ - fun format(format: JsonField) = apply { this.format = format } + fun inputAudio(inputAudio: JsonField) = apply { this.inputAudio = inputAudio } /** * Sets the field to an arbitrary JSON value. @@ -180,16 +151,14 @@ private constructor( * * The following fields are required: * ```java - * .data() - * .format() + * .inputAudio() * ``` * * @throws IllegalStateException if any required field is unset. */ fun build(): ResponseInputAudio = ResponseInputAudio( - checkRequired("data", data), - checkRequired("format", format), + checkRequired("inputAudio", inputAudio), type, additionalProperties.toMutableMap(), ) @@ -202,8 +171,7 @@ private constructor( return@apply } - data() - format().validate() + inputAudio().validate() _type().let { if (it != JsonValue.from("input_audio")) { throw OpenAIInvalidDataException("'type' is invalid, received $it") @@ -227,104 +195,165 @@ private constructor( */ @JvmSynthetic internal fun validity(): Int = - (if (data.asKnown().isPresent) 1 else 0) + - (format.asKnown().getOrNull()?.validity() ?: 0) + + (inputAudio.asKnown().getOrNull()?.validity() ?: 0) + type.let { if (it == JsonValue.from("input_audio")) 1 else 0 } - /** The format of the audio data. Currently supported formats are `mp3` and `wav`. */ - class Format @JsonCreator private constructor(private val value: JsonField) : Enum { + class InputAudio + private constructor( + private val data: JsonField, + private val format: JsonField, + private val additionalProperties: MutableMap, + ) { + + @JsonCreator + private constructor( + @JsonProperty("data") @ExcludeMissing data: JsonField = JsonMissing.of(), + @JsonProperty("format") @ExcludeMissing format: JsonField = JsonMissing.of(), + ) : this(data, format, mutableMapOf()) /** - * Returns this class instance's raw value. + * Base64-encoded audio data. * - * This is usually only useful if this instance was deserialized from data that doesn't - * match any known member, and you want to know that value. For example, if the SDK is on an - * older version than the API, then the API may respond with new members that the SDK is - * unaware of. + * @throws OpenAIInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). */ - @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value - - companion object { - - @JvmField val MP3 = of("mp3") - - @JvmField val WAV = of("wav") - - @JvmStatic fun of(value: String) = Format(JsonField.of(value)) - } - - /** An enum containing [Format]'s known values. */ - enum class Known { - MP3, - WAV, - } + fun data(): String = data.getRequired("data") /** - * An enum containing [Format]'s known values, as well as an [_UNKNOWN] member. + * The format of the audio data. Currently supported formats are `mp3` and `wav`. * - * An instance of [Format] can contain an unknown value in a couple of cases: - * - It was deserialized from data that doesn't match any known member. For example, if the - * SDK is on an older version than the API, then the API may respond with new members that - * the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. + * @throws OpenAIInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). */ - enum class Value { - MP3, - WAV, - /** An enum member indicating that [Format] was instantiated with an unknown value. */ - _UNKNOWN, - } + fun format(): Format = format.getRequired("format") /** - * Returns an enum member corresponding to this class instance's value, or [Value._UNKNOWN] - * if the class was instantiated with an unknown value. + * Returns the raw JSON value of [data]. * - * Use the [known] method instead if you're certain the value is always known or if you want - * to throw for the unknown case. + * Unlike [data], this method doesn't throw if the JSON field has an unexpected type. */ - fun value(): Value = - when (this) { - MP3 -> Value.MP3 - WAV -> Value.WAV - else -> Value._UNKNOWN - } + @JsonProperty("data") @ExcludeMissing fun _data(): JsonField = data /** - * Returns an enum member corresponding to this class instance's value. + * Returns the raw JSON value of [format]. * - * Use the [value] method instead if you're uncertain the value is always known and don't - * want to throw for the unknown case. - * - * @throws OpenAIInvalidDataException if this class instance's value is a not a known - * member. + * Unlike [format], this method doesn't throw if the JSON field has an unexpected type. */ - fun known(): Known = - when (this) { - MP3 -> Known.MP3 - WAV -> Known.WAV - else -> throw OpenAIInvalidDataException("Unknown Format: $value") + @JsonProperty("format") @ExcludeMissing fun _format(): JsonField = format + + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) + + fun toBuilder() = Builder().from(this) + + companion object { + + /** + * Returns a mutable builder for constructing an instance of [InputAudio]. + * + * The following fields are required: + * ```java + * .data() + * .format() + * ``` + */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [InputAudio]. */ + class Builder internal constructor() { + + private var data: JsonField? = null + private var format: JsonField? = null + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(inputAudio: InputAudio) = apply { + data = inputAudio.data + format = inputAudio.format + additionalProperties = inputAudio.additionalProperties.toMutableMap() } - /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily for debugging - * and generally doesn't throw. - * - * @throws OpenAIInvalidDataException if this class instance's value does not have the - * expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { OpenAIInvalidDataException("Value is not a String") } + /** Base64-encoded audio data. */ + fun data(data: String) = data(JsonField.of(data)) + + /** + * Sets [Builder.data] to an arbitrary JSON value. + * + * You should usually call [Builder.data] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported + * value. + */ + fun data(data: JsonField) = apply { this.data = data } + + /** The format of the audio data. Currently supported formats are `mp3` and `wav`. */ + fun format(format: Format) = format(JsonField.of(format)) + + /** + * Sets [Builder.format] to an arbitrary JSON value. + * + * You should usually call [Builder.format] with a well-typed [Format] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun format(format: JsonField) = apply { this.format = format } + + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } + + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } + + fun putAllAdditionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.putAll(additionalProperties) + } + + fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + + /** + * Returns an immutable instance of [InputAudio]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .data() + * .format() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ + fun build(): InputAudio = + InputAudio( + checkRequired("data", data), + checkRequired("format", format), + additionalProperties.toMutableMap(), + ) + } private var validated: Boolean = false - fun validate(): Format = apply { + fun validate(): InputAudio = apply { if (validated) { return@apply } - known() + data() + format().validate() validated = true } @@ -342,19 +371,158 @@ private constructor( * * Used for best match union deserialization. */ - @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 + @JvmSynthetic + internal fun validity(): Int = + (if (data.asKnown().isPresent) 1 else 0) + + (format.asKnown().getOrNull()?.validity() ?: 0) + + /** The format of the audio data. Currently supported formats are `mp3` and `wav`. */ + class Format @JsonCreator private constructor(private val value: JsonField) : Enum { + + /** + * Returns this class instance's raw value. + * + * This is usually only useful if this instance was deserialized from data that doesn't + * match any known member, and you want to know that value. For example, if the SDK is + * on an older version than the API, then the API may respond with new members that the + * SDK is unaware of. + */ + @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value + + companion object { + + @JvmField val MP3 = of("mp3") + + @JvmField val WAV = of("wav") + + @JvmStatic fun of(value: String) = Format(JsonField.of(value)) + } + + /** An enum containing [Format]'s known values. */ + enum class Known { + MP3, + WAV, + } + + /** + * An enum containing [Format]'s known values, as well as an [_UNKNOWN] member. + * + * An instance of [Format] can contain an unknown value in a couple of cases: + * - It was deserialized from data that doesn't match any known member. For example, if + * the SDK is on an older version than the API, then the API may respond with new + * members that the SDK is unaware of. + * - It was constructed with an arbitrary value using the [of] method. + */ + enum class Value { + MP3, + WAV, + /** + * An enum member indicating that [Format] was instantiated with an unknown value. + */ + _UNKNOWN, + } + + /** + * Returns an enum member corresponding to this class instance's value, or + * [Value._UNKNOWN] if the class was instantiated with an unknown value. + * + * Use the [known] method instead if you're certain the value is always known or if you + * want to throw for the unknown case. + */ + fun value(): Value = + when (this) { + MP3 -> Value.MP3 + WAV -> Value.WAV + else -> Value._UNKNOWN + } + + /** + * Returns an enum member corresponding to this class instance's value. + * + * Use the [value] method instead if you're uncertain the value is always known and + * don't want to throw for the unknown case. + * + * @throws OpenAIInvalidDataException if this class instance's value is a not a known + * member. + */ + fun known(): Known = + when (this) { + MP3 -> Known.MP3 + WAV -> Known.WAV + else -> throw OpenAIInvalidDataException("Unknown Format: $value") + } + + /** + * Returns this class instance's primitive wire representation. + * + * This differs from the [toString] method because that method is primarily for + * debugging and generally doesn't throw. + * + * @throws OpenAIInvalidDataException if this class instance's value does not have the + * expected primitive type. + */ + fun asString(): String = + _value().asString().orElseThrow { + OpenAIInvalidDataException("Value is not a String") + } + + private var validated: Boolean = false + + fun validate(): Format = apply { + if (validated) { + return@apply + } + + known() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: OpenAIInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is Format && value == other.value + } + + override fun hashCode() = value.hashCode() + + override fun toString() = value.toString() + } override fun equals(other: Any?): Boolean { if (this === other) { return true } - return other is Format && value == other.value + return other is InputAudio && + data == other.data && + format == other.format && + additionalProperties == other.additionalProperties } - override fun hashCode() = value.hashCode() + private val hashCode: Int by lazy { Objects.hash(data, format, additionalProperties) } + + override fun hashCode(): Int = hashCode - override fun toString() = value.toString() + override fun toString() = + "InputAudio{data=$data, format=$format, additionalProperties=$additionalProperties}" } override fun equals(other: Any?): Boolean { @@ -363,16 +531,15 @@ private constructor( } return other is ResponseInputAudio && - data == other.data && - format == other.format && + inputAudio == other.inputAudio && type == other.type && additionalProperties == other.additionalProperties } - private val hashCode: Int by lazy { Objects.hash(data, format, type, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(inputAudio, type, additionalProperties) } override fun hashCode(): Int = hashCode override fun toString() = - "ResponseInputAudio{data=$data, format=$format, type=$type, additionalProperties=$additionalProperties}" + "ResponseInputAudio{inputAudio=$inputAudio, type=$type, additionalProperties=$additionalProperties}" } diff --git a/openai-java-core/src/main/kotlin/com/openai/models/responses/ResponseInputContent.kt b/openai-java-core/src/main/kotlin/com/openai/models/responses/ResponseInputContent.kt index 252ffec1..43e26a2a 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/responses/ResponseInputContent.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/responses/ResponseInputContent.kt @@ -26,6 +26,7 @@ private constructor( private val inputText: ResponseInputText? = null, private val inputImage: ResponseInputImage? = null, private val inputFile: ResponseInputFile? = null, + private val inputAudio: ResponseInputAudio? = null, private val _json: JsonValue? = null, ) { @@ -41,12 +42,17 @@ private constructor( /** A file input to the model. */ fun inputFile(): Optional = Optional.ofNullable(inputFile) + /** An audio input to the model. */ + fun inputAudio(): Optional = Optional.ofNullable(inputAudio) + fun isInputText(): Boolean = inputText != null fun isInputImage(): Boolean = inputImage != null fun isInputFile(): Boolean = inputFile != null + fun isInputAudio(): Boolean = inputAudio != null + /** A text input to the model. */ fun asInputText(): ResponseInputText = inputText.getOrThrow("inputText") @@ -59,6 +65,9 @@ private constructor( /** A file input to the model. */ fun asInputFile(): ResponseInputFile = inputFile.getOrThrow("inputFile") + /** An audio input to the model. */ + fun asInputAudio(): ResponseInputAudio = inputAudio.getOrThrow("inputAudio") + fun _json(): Optional = Optional.ofNullable(_json) fun accept(visitor: Visitor): T = @@ -66,6 +75,7 @@ private constructor( inputText != null -> visitor.visitInputText(inputText) inputImage != null -> visitor.visitInputImage(inputImage) inputFile != null -> visitor.visitInputFile(inputFile) + inputAudio != null -> visitor.visitInputAudio(inputAudio) else -> visitor.unknown(_json) } @@ -89,6 +99,10 @@ private constructor( override fun visitInputFile(inputFile: ResponseInputFile) { inputFile.validate() } + + override fun visitInputAudio(inputAudio: ResponseInputAudio) { + inputAudio.validate() + } } ) validated = true @@ -117,6 +131,8 @@ private constructor( override fun visitInputFile(inputFile: ResponseInputFile) = inputFile.validity() + override fun visitInputAudio(inputAudio: ResponseInputAudio) = inputAudio.validity() + override fun unknown(json: JsonValue?) = 0 } ) @@ -129,16 +145,18 @@ private constructor( return other is ResponseInputContent && inputText == other.inputText && inputImage == other.inputImage && - inputFile == other.inputFile + inputFile == other.inputFile && + inputAudio == other.inputAudio } - override fun hashCode(): Int = Objects.hash(inputText, inputImage, inputFile) + override fun hashCode(): Int = Objects.hash(inputText, inputImage, inputFile, inputAudio) override fun toString(): String = when { inputText != null -> "ResponseInputContent{inputText=$inputText}" inputImage != null -> "ResponseInputContent{inputImage=$inputImage}" inputFile != null -> "ResponseInputContent{inputFile=$inputFile}" + inputAudio != null -> "ResponseInputContent{inputAudio=$inputAudio}" _json != null -> "ResponseInputContent{_unknown=$_json}" else -> throw IllegalStateException("Invalid ResponseInputContent") } @@ -160,6 +178,11 @@ private constructor( /** A file input to the model. */ @JvmStatic fun ofInputFile(inputFile: ResponseInputFile) = ResponseInputContent(inputFile = inputFile) + + /** An audio input to the model. */ + @JvmStatic + fun ofInputAudio(inputAudio: ResponseInputAudio) = + ResponseInputContent(inputAudio = inputAudio) } /** @@ -180,6 +203,9 @@ private constructor( /** A file input to the model. */ fun visitInputFile(inputFile: ResponseInputFile): T + /** An audio input to the model. */ + fun visitInputAudio(inputAudio: ResponseInputAudio): T + /** * Maps an unknown variant of [ResponseInputContent] to a value of type [T]. * @@ -218,6 +244,11 @@ private constructor( ResponseInputContent(inputFile = it, _json = json) } ?: ResponseInputContent(_json = json) } + "input_audio" -> { + return tryDeserialize(node, jacksonTypeRef())?.let { + ResponseInputContent(inputAudio = it, _json = json) + } ?: ResponseInputContent(_json = json) + } } return ResponseInputContent(_json = json) @@ -235,6 +266,7 @@ private constructor( value.inputText != null -> generator.writeObject(value.inputText) value.inputImage != null -> generator.writeObject(value.inputImage) value.inputFile != null -> generator.writeObject(value.inputFile) + value.inputAudio != null -> generator.writeObject(value.inputAudio) value._json != null -> generator.writeObject(value._json) else -> throw IllegalStateException("Invalid ResponseInputContent") } diff --git a/openai-java-core/src/main/kotlin/com/openai/models/responses/ResponseInputItem.kt b/openai-java-core/src/main/kotlin/com/openai/models/responses/ResponseInputItem.kt index 699ac92a..e0cb0ae6 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/responses/ResponseInputItem.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/responses/ResponseInputItem.kt @@ -1231,6 +1231,23 @@ private constructor( fun addContent(inputFile: ResponseInputFile) = addContent(ResponseInputContent.ofInputFile(inputFile)) + /** + * Alias for calling [addContent] with `ResponseInputContent.ofInputAudio(inputAudio)`. + */ + fun addContent(inputAudio: ResponseInputAudio) = + addContent(ResponseInputContent.ofInputAudio(inputAudio)) + + /** + * Alias for calling [addContent] with the following: + * ```java + * ResponseInputAudio.builder() + * .inputAudio(inputAudio) + * .build() + * ``` + */ + fun addInputAudioContent(inputAudio: ResponseInputAudio.InputAudio) = + addContent(ResponseInputAudio.builder().inputAudio(inputAudio).build()) + /** The role of the message input. One of `user`, `system`, or `developer`. */ fun role(role: Role) = role(JsonField.of(role)) diff --git a/openai-java-core/src/main/kotlin/com/openai/models/responses/ResponseInputMessageItem.kt b/openai-java-core/src/main/kotlin/com/openai/models/responses/ResponseInputMessageItem.kt index a8c81c87..bede8a0e 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/responses/ResponseInputMessageItem.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/responses/ResponseInputMessageItem.kt @@ -237,6 +237,21 @@ private constructor( fun addContent(inputFile: ResponseInputFile) = addContent(ResponseInputContent.ofInputFile(inputFile)) + /** Alias for calling [addContent] with `ResponseInputContent.ofInputAudio(inputAudio)`. */ + fun addContent(inputAudio: ResponseInputAudio) = + addContent(ResponseInputContent.ofInputAudio(inputAudio)) + + /** + * Alias for calling [addContent] with the following: + * ```java + * ResponseInputAudio.builder() + * .inputAudio(inputAudio) + * .build() + * ``` + */ + fun addInputAudioContent(inputAudio: ResponseInputAudio.InputAudio) = + addContent(ResponseInputAudio.builder().inputAudio(inputAudio).build()) + /** The role of the message input. One of `user`, `system`, or `developer`. */ fun role(role: Role) = role(JsonField.of(role)) diff --git a/openai-java-core/src/test/kotlin/com/openai/models/responses/ResponseContentTest.kt b/openai-java-core/src/test/kotlin/com/openai/models/responses/ResponseContentTest.kt index e4f105eb..a7e30e22 100644 --- a/openai-java-core/src/test/kotlin/com/openai/models/responses/ResponseContentTest.kt +++ b/openai-java-core/src/test/kotlin/com/openai/models/responses/ResponseContentTest.kt @@ -23,6 +23,7 @@ internal class ResponseContentTest { assertThat(responseContent.inputText()).contains(inputText) assertThat(responseContent.inputImage()).isEmpty assertThat(responseContent.inputFile()).isEmpty + assertThat(responseContent.inputAudio()).isEmpty assertThat(responseContent.outputText()).isEmpty assertThat(responseContent.outputRefusal()).isEmpty } @@ -56,6 +57,7 @@ internal class ResponseContentTest { assertThat(responseContent.inputText()).isEmpty assertThat(responseContent.inputImage()).contains(inputImage) assertThat(responseContent.inputFile()).isEmpty + assertThat(responseContent.inputAudio()).isEmpty assertThat(responseContent.outputText()).isEmpty assertThat(responseContent.outputRefusal()).isEmpty } @@ -96,6 +98,7 @@ internal class ResponseContentTest { assertThat(responseContent.inputText()).isEmpty assertThat(responseContent.inputImage()).isEmpty assertThat(responseContent.inputFile()).contains(inputFile) + assertThat(responseContent.inputAudio()).isEmpty assertThat(responseContent.outputText()).isEmpty assertThat(responseContent.outputRefusal()).isEmpty } @@ -122,6 +125,52 @@ internal class ResponseContentTest { assertThat(roundtrippedResponseContent).isEqualTo(responseContent) } + @Test + fun ofInputAudio() { + val inputAudio = + ResponseInputAudio.builder() + .inputAudio( + ResponseInputAudio.InputAudio.builder() + .data("data") + .format(ResponseInputAudio.InputAudio.Format.MP3) + .build() + ) + .build() + + val responseContent = ResponseContent.ofInputAudio(inputAudio) + + assertThat(responseContent.inputText()).isEmpty + assertThat(responseContent.inputImage()).isEmpty + assertThat(responseContent.inputFile()).isEmpty + assertThat(responseContent.inputAudio()).contains(inputAudio) + assertThat(responseContent.outputText()).isEmpty + assertThat(responseContent.outputRefusal()).isEmpty + } + + @Test + fun ofInputAudioRoundtrip() { + val jsonMapper = jsonMapper() + val responseContent = + ResponseContent.ofInputAudio( + ResponseInputAudio.builder() + .inputAudio( + ResponseInputAudio.InputAudio.builder() + .data("data") + .format(ResponseInputAudio.InputAudio.Format.MP3) + .build() + ) + .build() + ) + + val roundtrippedResponseContent = + jsonMapper.readValue( + jsonMapper.writeValueAsString(responseContent), + jacksonTypeRef(), + ) + + assertThat(roundtrippedResponseContent).isEqualTo(responseContent) + } + @Test fun ofOutputText() { val outputText = @@ -155,6 +204,7 @@ internal class ResponseContentTest { assertThat(responseContent.inputText()).isEmpty assertThat(responseContent.inputImage()).isEmpty assertThat(responseContent.inputFile()).isEmpty + assertThat(responseContent.inputAudio()).isEmpty assertThat(responseContent.outputText()).contains(outputText) assertThat(responseContent.outputRefusal()).isEmpty } @@ -208,6 +258,7 @@ internal class ResponseContentTest { assertThat(responseContent.inputText()).isEmpty assertThat(responseContent.inputImage()).isEmpty assertThat(responseContent.inputFile()).isEmpty + assertThat(responseContent.inputAudio()).isEmpty assertThat(responseContent.outputText()).isEmpty assertThat(responseContent.outputRefusal()).contains(outputRefusal) } diff --git a/openai-java-core/src/test/kotlin/com/openai/models/responses/ResponseInputAudioTest.kt b/openai-java-core/src/test/kotlin/com/openai/models/responses/ResponseInputAudioTest.kt index 8a96a6c6..cc8497e5 100644 --- a/openai-java-core/src/test/kotlin/com/openai/models/responses/ResponseInputAudioTest.kt +++ b/openai-java-core/src/test/kotlin/com/openai/models/responses/ResponseInputAudioTest.kt @@ -12,17 +12,36 @@ internal class ResponseInputAudioTest { @Test fun create() { val responseInputAudio = - ResponseInputAudio.builder().data("data").format(ResponseInputAudio.Format.MP3).build() - - assertThat(responseInputAudio.data()).isEqualTo("data") - assertThat(responseInputAudio.format()).isEqualTo(ResponseInputAudio.Format.MP3) + ResponseInputAudio.builder() + .inputAudio( + ResponseInputAudio.InputAudio.builder() + .data("data") + .format(ResponseInputAudio.InputAudio.Format.MP3) + .build() + ) + .build() + + assertThat(responseInputAudio.inputAudio()) + .isEqualTo( + ResponseInputAudio.InputAudio.builder() + .data("data") + .format(ResponseInputAudio.InputAudio.Format.MP3) + .build() + ) } @Test fun roundtrip() { val jsonMapper = jsonMapper() val responseInputAudio = - ResponseInputAudio.builder().data("data").format(ResponseInputAudio.Format.MP3).build() + ResponseInputAudio.builder() + .inputAudio( + ResponseInputAudio.InputAudio.builder() + .data("data") + .format(ResponseInputAudio.InputAudio.Format.MP3) + .build() + ) + .build() val roundtrippedResponseInputAudio = jsonMapper.readValue( diff --git a/openai-java-core/src/test/kotlin/com/openai/models/responses/ResponseInputContentTest.kt b/openai-java-core/src/test/kotlin/com/openai/models/responses/ResponseInputContentTest.kt index a262e03e..f2370583 100644 --- a/openai-java-core/src/test/kotlin/com/openai/models/responses/ResponseInputContentTest.kt +++ b/openai-java-core/src/test/kotlin/com/openai/models/responses/ResponseInputContentTest.kt @@ -23,6 +23,7 @@ internal class ResponseInputContentTest { assertThat(responseInputContent.inputText()).contains(inputText) assertThat(responseInputContent.inputImage()).isEmpty assertThat(responseInputContent.inputFile()).isEmpty + assertThat(responseInputContent.inputAudio()).isEmpty } @Test @@ -54,6 +55,7 @@ internal class ResponseInputContentTest { assertThat(responseInputContent.inputText()).isEmpty assertThat(responseInputContent.inputImage()).contains(inputImage) assertThat(responseInputContent.inputFile()).isEmpty + assertThat(responseInputContent.inputAudio()).isEmpty } @Test @@ -92,6 +94,7 @@ internal class ResponseInputContentTest { assertThat(responseInputContent.inputText()).isEmpty assertThat(responseInputContent.inputImage()).isEmpty assertThat(responseInputContent.inputFile()).contains(inputFile) + assertThat(responseInputContent.inputAudio()).isEmpty } @Test @@ -116,6 +119,50 @@ internal class ResponseInputContentTest { assertThat(roundtrippedResponseInputContent).isEqualTo(responseInputContent) } + @Test + fun ofInputAudio() { + val inputAudio = + ResponseInputAudio.builder() + .inputAudio( + ResponseInputAudio.InputAudio.builder() + .data("data") + .format(ResponseInputAudio.InputAudio.Format.MP3) + .build() + ) + .build() + + val responseInputContent = ResponseInputContent.ofInputAudio(inputAudio) + + assertThat(responseInputContent.inputText()).isEmpty + assertThat(responseInputContent.inputImage()).isEmpty + assertThat(responseInputContent.inputFile()).isEmpty + assertThat(responseInputContent.inputAudio()).contains(inputAudio) + } + + @Test + fun ofInputAudioRoundtrip() { + val jsonMapper = jsonMapper() + val responseInputContent = + ResponseInputContent.ofInputAudio( + ResponseInputAudio.builder() + .inputAudio( + ResponseInputAudio.InputAudio.builder() + .data("data") + .format(ResponseInputAudio.InputAudio.Format.MP3) + .build() + ) + .build() + ) + + val roundtrippedResponseInputContent = + jsonMapper.readValue( + jsonMapper.writeValueAsString(responseInputContent), + jacksonTypeRef(), + ) + + assertThat(roundtrippedResponseInputContent).isEqualTo(responseInputContent) + } + enum class IncompatibleJsonShapeTestCase(val value: JsonValue) { BOOLEAN(JsonValue.from(false)), STRING(JsonValue.from("invalid")),