diff --git a/.release-please-manifest.json b/.release-please-manifest.json index a95c8527..263d47d2 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "4.31.0" + ".": "4.32.0" } \ No newline at end of file diff --git a/.stats.yml b/.stats.yml index e2b52c7b..f4cf00e9 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 151 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/openai%2Fopenai-dd99495ad509338e6de862802839360dfe394d5cd6d6ba6d13fec8fca92328b8.yml -openapi_spec_hash: 68abda9122013a9ae3f084cfdbe8e8c1 -config_hash: 5635033cdc8c930255f8b529a78de722 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/openai%2Fopenai-7c540cce6eb30401259f4831ea9803b6d88501605d13734f98212cbb3b199e10.yml +openapi_spec_hash: 06e656be22bbb92689954253668b42fc +config_hash: 1a88b104658b6c854117996c080ebe6b diff --git a/CHANGELOG.md b/CHANGELOG.md index 4cb81084..13f24027 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,19 @@ # Changelog +## 4.32.0 (2026-04-16) + +Full Changelog: [v4.31.0...v4.32.0](https://github.com/openai/openai-java/compare/v4.31.0...v4.32.0) + +### Features + +* **api:** Add detail to InputFileContent ([0c8418c](https://github.com/openai/openai-java/commit/0c8418cb584103e273b12f70b1cf535364d44bfd)) +* **api:** add OAuthErrorCode type ([09b41e1](https://github.com/openai/openai-java/commit/09b41e1d925371b6b6c94b8a147dce6264be6120)) + + +### Documentation + +* improve examples ([717a8d5](https://github.com/openai/openai-java/commit/717a8d5cc331c2746ed1548ef89418f70707d23a)) + ## 4.31.0 (2026-04-08) Full Changelog: [v4.30.0...v4.31.0](https://github.com/openai/openai-java/compare/v4.30.0...v4.31.0) diff --git a/README.md b/README.md index 023ccb78..568a0753 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/4.31.0) -[![javadoc](https://javadoc.io/badge2/com.openai/openai-java/4.31.0/javadoc.svg)](https://javadoc.io/doc/com.openai/openai-java/4.31.0) +[![Maven Central](https://img.shields.io/maven-central/v/com.openai/openai-java)](https://central.sonatype.com/artifact/com.openai/openai-java/4.32.0) +[![javadoc](https://javadoc.io/badge2/com.openai/openai-java/4.32.0/javadoc.svg)](https://javadoc.io/doc/com.openai/openai-java/4.32.0) @@ -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/4.31.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/4.32.0). @@ -24,7 +24,7 @@ The REST API documentation can be found on [platform.openai.com](https://platfor ### Gradle ```kotlin -implementation("com.openai:openai-java:4.31.0") +implementation("com.openai:openai-java:4.32.0") ``` ### Maven @@ -33,7 +33,7 @@ implementation("com.openai:openai-java:4.31.0") com.openai openai-java - 4.31.0 + 4.32.0 ``` @@ -1419,7 +1419,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:4.31.0") +implementation("com.openai:openai-java-spring-boot-starter:4.32.0") ``` #### Maven @@ -1428,7 +1428,7 @@ implementation("com.openai:openai-java-spring-boot-starter:4.31.0") com.openai openai-java-spring-boot-starter - 4.31.0 + 4.32.0 ``` diff --git a/build.gradle.kts b/build.gradle.kts index 9f350c47..642e40af 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -8,7 +8,7 @@ repositories { allprojects { group = "com.openai" - version = "4.31.0" // x-release-please-version + version = "4.32.0" // x-release-please-version } subprojects { diff --git a/openai-java-core/src/main/kotlin/com/openai/models/OAuthErrorCode.kt b/openai-java-core/src/main/kotlin/com/openai/models/OAuthErrorCode.kt new file mode 100644 index 00000000..704517d0 --- /dev/null +++ b/openai-java-core/src/main/kotlin/com/openai/models/OAuthErrorCode.kt @@ -0,0 +1,132 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.openai.models + +import com.fasterxml.jackson.annotation.JsonCreator +import com.openai.core.Enum +import com.openai.core.JsonField +import com.openai.errors.OpenAIInvalidDataException + +class OAuthErrorCode @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 INVALID_GRANT = of("invalid_grant") + + @JvmField val INVALID_SUBJECT_TOKEN = of("invalid_subject_token") + + @JvmStatic fun of(value: String) = OAuthErrorCode(JsonField.of(value)) + } + + /** An enum containing [OAuthErrorCode]'s known values. */ + enum class Known { + INVALID_GRANT, + INVALID_SUBJECT_TOKEN, + } + + /** + * An enum containing [OAuthErrorCode]'s known values, as well as an [_UNKNOWN] member. + * + * An instance of [OAuthErrorCode] 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 { + INVALID_GRANT, + INVALID_SUBJECT_TOKEN, + /** + * An enum member indicating that [OAuthErrorCode] 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) { + INVALID_GRANT -> Value.INVALID_GRANT + INVALID_SUBJECT_TOKEN -> Value.INVALID_SUBJECT_TOKEN + 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) { + INVALID_GRANT -> Known.INVALID_GRANT + INVALID_SUBJECT_TOKEN -> Known.INVALID_SUBJECT_TOKEN + else -> throw OpenAIInvalidDataException("Unknown OAuthErrorCode: $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(): OAuthErrorCode = 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 OAuthErrorCode && value == other.value + } + + override fun hashCode() = value.hashCode() + + override fun toString() = value.toString() +} diff --git a/openai-java-core/src/main/kotlin/com/openai/models/responses/ResponseInputFile.kt b/openai-java-core/src/main/kotlin/com/openai/models/responses/ResponseInputFile.kt index e9f1f4b0..e09506c7 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/responses/ResponseInputFile.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/responses/ResponseInputFile.kt @@ -6,6 +6,7 @@ import com.fasterxml.jackson.annotation.JsonAnyGetter import com.fasterxml.jackson.annotation.JsonAnySetter import com.fasterxml.jackson.annotation.JsonCreator import com.fasterxml.jackson.annotation.JsonProperty +import com.openai.core.Enum import com.openai.core.ExcludeMissing import com.openai.core.JsonField import com.openai.core.JsonMissing @@ -21,6 +22,7 @@ class ResponseInputFile @JsonCreator(mode = JsonCreator.Mode.DISABLED) private constructor( private val type: JsonValue, + private val detail: JsonField, private val fileData: JsonField, private val fileId: JsonField, private val fileUrl: JsonField, @@ -31,11 +33,12 @@ private constructor( @JsonCreator private constructor( @JsonProperty("type") @ExcludeMissing type: JsonValue = JsonMissing.of(), + @JsonProperty("detail") @ExcludeMissing detail: JsonField = JsonMissing.of(), @JsonProperty("file_data") @ExcludeMissing fileData: JsonField = JsonMissing.of(), @JsonProperty("file_id") @ExcludeMissing fileId: JsonField = JsonMissing.of(), @JsonProperty("file_url") @ExcludeMissing fileUrl: JsonField = JsonMissing.of(), @JsonProperty("filename") @ExcludeMissing filename: JsonField = JsonMissing.of(), - ) : this(type, fileData, fileId, fileUrl, filename, mutableMapOf()) + ) : this(type, detail, fileData, fileId, fileUrl, filename, mutableMapOf()) /** * The type of the input item. Always `input_file`. @@ -50,6 +53,15 @@ private constructor( */ @JsonProperty("type") @ExcludeMissing fun _type(): JsonValue = type + /** + * The detail level of the file to be sent to the model. Use `low` for the default rendering + * behavior, or `high` to render the file at higher quality. Defaults to `low`. + * + * @throws OpenAIInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun detail(): Optional = detail.getOptional("detail") + /** * The content of the file to be sent to the model. * @@ -82,6 +94,13 @@ private constructor( */ fun filename(): Optional = filename.getOptional("filename") + /** + * Returns the raw JSON value of [detail]. + * + * Unlike [detail], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("detail") @ExcludeMissing fun _detail(): JsonField = detail + /** * Returns the raw JSON value of [fileData]. * @@ -132,6 +151,7 @@ private constructor( class Builder internal constructor() { private var type: JsonValue = JsonValue.from("input_file") + private var detail: JsonField = JsonMissing.of() private var fileData: JsonField = JsonMissing.of() private var fileId: JsonField = JsonMissing.of() private var fileUrl: JsonField = JsonMissing.of() @@ -141,6 +161,7 @@ private constructor( @JvmSynthetic internal fun from(responseInputFile: ResponseInputFile) = apply { type = responseInputFile.type + detail = responseInputFile.detail fileData = responseInputFile.fileData fileId = responseInputFile.fileId fileUrl = responseInputFile.fileUrl @@ -162,6 +183,20 @@ private constructor( */ fun type(type: JsonValue) = apply { this.type = type } + /** + * The detail level of the file to be sent to the model. Use `low` for the default rendering + * behavior, or `high` to render the file at higher quality. Defaults to `low`. + */ + fun detail(detail: Detail) = detail(JsonField.of(detail)) + + /** + * Sets [Builder.detail] to an arbitrary JSON value. + * + * You should usually call [Builder.detail] with a well-typed [Detail] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ + fun detail(detail: JsonField) = apply { this.detail = detail } + /** The content of the file to be sent to the model. */ fun fileData(fileData: String) = fileData(JsonField.of(fileData)) @@ -236,6 +271,7 @@ private constructor( fun build(): ResponseInputFile = ResponseInputFile( type, + detail, fileData, fileId, fileUrl, @@ -256,6 +292,7 @@ private constructor( throw OpenAIInvalidDataException("'type' is invalid, received $it") } } + detail().ifPresent { it.validate() } fileData() fileId() fileUrl() @@ -279,11 +316,141 @@ private constructor( @JvmSynthetic internal fun validity(): Int = type.let { if (it == JsonValue.from("input_file")) 1 else 0 } + + (detail.asKnown().getOrNull()?.validity() ?: 0) + (if (fileData.asKnown().isPresent) 1 else 0) + (if (fileId.asKnown().isPresent) 1 else 0) + (if (fileUrl.asKnown().isPresent) 1 else 0) + (if (filename.asKnown().isPresent) 1 else 0) + /** + * The detail level of the file to be sent to the model. Use `low` for the default rendering + * behavior, or `high` to render the file at higher quality. Defaults to `low`. + */ + class Detail @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 LOW = of("low") + + @JvmField val HIGH = of("high") + + @JvmStatic fun of(value: String) = Detail(JsonField.of(value)) + } + + /** An enum containing [Detail]'s known values. */ + enum class Known { + LOW, + HIGH, + } + + /** + * An enum containing [Detail]'s known values, as well as an [_UNKNOWN] member. + * + * An instance of [Detail] 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 { + LOW, + HIGH, + /** An enum member indicating that [Detail] 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) { + LOW -> Value.LOW + HIGH -> Value.HIGH + 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) { + LOW -> Known.LOW + HIGH -> Known.HIGH + else -> throw OpenAIInvalidDataException("Unknown Detail: $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(): Detail = 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 Detail && value == other.value + } + + override fun hashCode() = value.hashCode() + + override fun toString() = value.toString() + } + override fun equals(other: Any?): Boolean { if (this === other) { return true @@ -291,6 +458,7 @@ private constructor( return other is ResponseInputFile && type == other.type && + detail == other.detail && fileData == other.fileData && fileId == other.fileId && fileUrl == other.fileUrl && @@ -299,11 +467,11 @@ private constructor( } private val hashCode: Int by lazy { - Objects.hash(type, fileData, fileId, fileUrl, filename, additionalProperties) + Objects.hash(type, detail, fileData, fileId, fileUrl, filename, additionalProperties) } override fun hashCode(): Int = hashCode override fun toString() = - "ResponseInputFile{type=$type, fileData=$fileData, fileId=$fileId, fileUrl=$fileUrl, filename=$filename, additionalProperties=$additionalProperties}" + "ResponseInputFile{type=$type, detail=$detail, fileData=$fileData, fileId=$fileId, fileUrl=$fileUrl, filename=$filename, additionalProperties=$additionalProperties}" } diff --git a/openai-java-core/src/main/kotlin/com/openai/models/responses/ResponseInputFileContent.kt b/openai-java-core/src/main/kotlin/com/openai/models/responses/ResponseInputFileContent.kt index e3f5c3cd..14222ea6 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/responses/ResponseInputFileContent.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/responses/ResponseInputFileContent.kt @@ -6,6 +6,7 @@ import com.fasterxml.jackson.annotation.JsonAnyGetter import com.fasterxml.jackson.annotation.JsonAnySetter import com.fasterxml.jackson.annotation.JsonCreator import com.fasterxml.jackson.annotation.JsonProperty +import com.openai.core.Enum import com.openai.core.ExcludeMissing import com.openai.core.JsonField import com.openai.core.JsonMissing @@ -21,6 +22,7 @@ class ResponseInputFileContent @JsonCreator(mode = JsonCreator.Mode.DISABLED) private constructor( private val type: JsonValue, + private val detail: JsonField, private val fileData: JsonField, private val fileId: JsonField, private val fileUrl: JsonField, @@ -31,11 +33,12 @@ private constructor( @JsonCreator private constructor( @JsonProperty("type") @ExcludeMissing type: JsonValue = JsonMissing.of(), + @JsonProperty("detail") @ExcludeMissing detail: JsonField = JsonMissing.of(), @JsonProperty("file_data") @ExcludeMissing fileData: JsonField = JsonMissing.of(), @JsonProperty("file_id") @ExcludeMissing fileId: JsonField = JsonMissing.of(), @JsonProperty("file_url") @ExcludeMissing fileUrl: JsonField = JsonMissing.of(), @JsonProperty("filename") @ExcludeMissing filename: JsonField = JsonMissing.of(), - ) : this(type, fileData, fileId, fileUrl, filename, mutableMapOf()) + ) : this(type, detail, fileData, fileId, fileUrl, filename, mutableMapOf()) /** * The type of the input item. Always `input_file`. @@ -50,6 +53,15 @@ private constructor( */ @JsonProperty("type") @ExcludeMissing fun _type(): JsonValue = type + /** + * The detail level of the file to be sent to the model. Use `low` for the default rendering + * behavior, or `high` to render the file at higher quality. Defaults to `low`. + * + * @throws OpenAIInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun detail(): Optional = detail.getOptional("detail") + /** * The base64-encoded data of the file to be sent to the model. * @@ -82,6 +94,13 @@ private constructor( */ fun filename(): Optional = filename.getOptional("filename") + /** + * Returns the raw JSON value of [detail]. + * + * Unlike [detail], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("detail") @ExcludeMissing fun _detail(): JsonField = detail + /** * Returns the raw JSON value of [fileData]. * @@ -132,6 +151,7 @@ private constructor( class Builder internal constructor() { private var type: JsonValue = JsonValue.from("input_file") + private var detail: JsonField = JsonMissing.of() private var fileData: JsonField = JsonMissing.of() private var fileId: JsonField = JsonMissing.of() private var fileUrl: JsonField = JsonMissing.of() @@ -141,6 +161,7 @@ private constructor( @JvmSynthetic internal fun from(responseInputFileContent: ResponseInputFileContent) = apply { type = responseInputFileContent.type + detail = responseInputFileContent.detail fileData = responseInputFileContent.fileData fileId = responseInputFileContent.fileId fileUrl = responseInputFileContent.fileUrl @@ -162,6 +183,20 @@ private constructor( */ fun type(type: JsonValue) = apply { this.type = type } + /** + * The detail level of the file to be sent to the model. Use `low` for the default rendering + * behavior, or `high` to render the file at higher quality. Defaults to `low`. + */ + fun detail(detail: Detail) = detail(JsonField.of(detail)) + + /** + * Sets [Builder.detail] to an arbitrary JSON value. + * + * You should usually call [Builder.detail] with a well-typed [Detail] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ + fun detail(detail: JsonField) = apply { this.detail = detail } + /** The base64-encoded data of the file to be sent to the model. */ fun fileData(fileData: String?) = fileData(JsonField.ofNullable(fileData)) @@ -245,6 +280,7 @@ private constructor( fun build(): ResponseInputFileContent = ResponseInputFileContent( type, + detail, fileData, fileId, fileUrl, @@ -265,6 +301,7 @@ private constructor( throw OpenAIInvalidDataException("'type' is invalid, received $it") } } + detail().ifPresent { it.validate() } fileData() fileId() fileUrl() @@ -288,11 +325,141 @@ private constructor( @JvmSynthetic internal fun validity(): Int = type.let { if (it == JsonValue.from("input_file")) 1 else 0 } + + (detail.asKnown().getOrNull()?.validity() ?: 0) + (if (fileData.asKnown().isPresent) 1 else 0) + (if (fileId.asKnown().isPresent) 1 else 0) + (if (fileUrl.asKnown().isPresent) 1 else 0) + (if (filename.asKnown().isPresent) 1 else 0) + /** + * The detail level of the file to be sent to the model. Use `low` for the default rendering + * behavior, or `high` to render the file at higher quality. Defaults to `low`. + */ + class Detail @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 LOW = of("low") + + @JvmField val HIGH = of("high") + + @JvmStatic fun of(value: String) = Detail(JsonField.of(value)) + } + + /** An enum containing [Detail]'s known values. */ + enum class Known { + LOW, + HIGH, + } + + /** + * An enum containing [Detail]'s known values, as well as an [_UNKNOWN] member. + * + * An instance of [Detail] 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 { + LOW, + HIGH, + /** An enum member indicating that [Detail] 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) { + LOW -> Value.LOW + HIGH -> Value.HIGH + 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) { + LOW -> Known.LOW + HIGH -> Known.HIGH + else -> throw OpenAIInvalidDataException("Unknown Detail: $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(): Detail = 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 Detail && value == other.value + } + + override fun hashCode() = value.hashCode() + + override fun toString() = value.toString() + } + override fun equals(other: Any?): Boolean { if (this === other) { return true @@ -300,6 +467,7 @@ private constructor( return other is ResponseInputFileContent && type == other.type && + detail == other.detail && fileData == other.fileData && fileId == other.fileId && fileUrl == other.fileUrl && @@ -308,11 +476,11 @@ private constructor( } private val hashCode: Int by lazy { - Objects.hash(type, fileData, fileId, fileUrl, filename, additionalProperties) + Objects.hash(type, detail, fileData, fileId, fileUrl, filename, additionalProperties) } override fun hashCode(): Int = hashCode override fun toString() = - "ResponseInputFileContent{type=$type, fileData=$fileData, fileId=$fileId, fileUrl=$fileUrl, filename=$filename, additionalProperties=$additionalProperties}" + "ResponseInputFileContent{type=$type, detail=$detail, fileData=$fileData, fileId=$fileId, fileUrl=$fileUrl, filename=$filename, additionalProperties=$additionalProperties}" } diff --git a/openai-java-core/src/test/kotlin/com/openai/models/audio/speech/SpeechCreateParamsTest.kt b/openai-java-core/src/test/kotlin/com/openai/models/audio/speech/SpeechCreateParamsTest.kt index 05988911..84ed2187 100644 --- a/openai-java-core/src/test/kotlin/com/openai/models/audio/speech/SpeechCreateParamsTest.kt +++ b/openai-java-core/src/test/kotlin/com/openai/models/audio/speech/SpeechCreateParamsTest.kt @@ -12,7 +12,7 @@ internal class SpeechCreateParamsTest { SpeechCreateParams.builder() .input("input") .model(SpeechModel.TTS_1) - .voice("string") + .voice(SpeechCreateParams.Voice.UnionMember1.ALLOY) .instructions("instructions") .responseFormat(SpeechCreateParams.ResponseFormat.MP3) .speed(0.25) @@ -26,7 +26,7 @@ internal class SpeechCreateParamsTest { SpeechCreateParams.builder() .input("input") .model(SpeechModel.TTS_1) - .voice("string") + .voice(SpeechCreateParams.Voice.UnionMember1.ALLOY) .instructions("instructions") .responseFormat(SpeechCreateParams.ResponseFormat.MP3) .speed(0.25) @@ -37,7 +37,10 @@ internal class SpeechCreateParamsTest { assertThat(body.input()).isEqualTo("input") assertThat(body.model()).isEqualTo(SpeechModel.TTS_1) - assertThat(body.voice()).isEqualTo(SpeechCreateParams.Voice.ofString("string")) + assertThat(body.voice()) + .isEqualTo( + SpeechCreateParams.Voice.ofUnionMember1(SpeechCreateParams.Voice.UnionMember1.ALLOY) + ) assertThat(body.instructions()).contains("instructions") assertThat(body.responseFormat()).contains(SpeechCreateParams.ResponseFormat.MP3) assertThat(body.speed()).contains(0.25) @@ -50,13 +53,16 @@ internal class SpeechCreateParamsTest { SpeechCreateParams.builder() .input("input") .model(SpeechModel.TTS_1) - .voice("string") + .voice(SpeechCreateParams.Voice.UnionMember1.ALLOY) .build() val body = params._body() assertThat(body.input()).isEqualTo("input") assertThat(body.model()).isEqualTo(SpeechModel.TTS_1) - assertThat(body.voice()).isEqualTo(SpeechCreateParams.Voice.ofString("string")) + assertThat(body.voice()) + .isEqualTo( + SpeechCreateParams.Voice.ofUnionMember1(SpeechCreateParams.Voice.UnionMember1.ALLOY) + ) } } diff --git a/openai-java-core/src/test/kotlin/com/openai/models/chat/completions/ChatCompletionAudioParamTest.kt b/openai-java-core/src/test/kotlin/com/openai/models/chat/completions/ChatCompletionAudioParamTest.kt index bc6d32fd..8464144f 100644 --- a/openai-java-core/src/test/kotlin/com/openai/models/chat/completions/ChatCompletionAudioParamTest.kt +++ b/openai-java-core/src/test/kotlin/com/openai/models/chat/completions/ChatCompletionAudioParamTest.kt @@ -14,12 +14,16 @@ internal class ChatCompletionAudioParamTest { val chatCompletionAudioParam = ChatCompletionAudioParam.builder() .format(ChatCompletionAudioParam.Format.WAV) - .voice("string") + .voice(ChatCompletionAudioParam.Voice.UnionMember1.ALLOY) .build() assertThat(chatCompletionAudioParam.format()).isEqualTo(ChatCompletionAudioParam.Format.WAV) assertThat(chatCompletionAudioParam.voice()) - .isEqualTo(ChatCompletionAudioParam.Voice.ofString("string")) + .isEqualTo( + ChatCompletionAudioParam.Voice.ofUnionMember1( + ChatCompletionAudioParam.Voice.UnionMember1.ALLOY + ) + ) } @Test @@ -28,7 +32,7 @@ internal class ChatCompletionAudioParamTest { val chatCompletionAudioParam = ChatCompletionAudioParam.builder() .format(ChatCompletionAudioParam.Format.WAV) - .voice("string") + .voice(ChatCompletionAudioParam.Voice.UnionMember1.ALLOY) .build() val roundtrippedChatCompletionAudioParam = diff --git a/openai-java-core/src/test/kotlin/com/openai/models/chat/completions/ChatCompletionCreateParamsTest.kt b/openai-java-core/src/test/kotlin/com/openai/models/chat/completions/ChatCompletionCreateParamsTest.kt index c3d3dd53..9cf84652 100644 --- a/openai-java-core/src/test/kotlin/com/openai/models/chat/completions/ChatCompletionCreateParamsTest.kt +++ b/openai-java-core/src/test/kotlin/com/openai/models/chat/completions/ChatCompletionCreateParamsTest.kt @@ -24,7 +24,7 @@ internal class ChatCompletionCreateParamsTest { .audio( ChatCompletionAudioParam.builder() .format(ChatCompletionAudioParam.Format.WAV) - .voice("string") + .voice(ChatCompletionAudioParam.Voice.UnionMember1.ALLOY) .build() ) .frequencyPenalty(-2.0) @@ -128,7 +128,7 @@ internal class ChatCompletionCreateParamsTest { .audio( ChatCompletionAudioParam.builder() .format(ChatCompletionAudioParam.Format.WAV) - .voice("string") + .voice(ChatCompletionAudioParam.Voice.UnionMember1.ALLOY) .build() ) .frequencyPenalty(-2.0) @@ -234,7 +234,7 @@ internal class ChatCompletionCreateParamsTest { .contains( ChatCompletionAudioParam.builder() .format(ChatCompletionAudioParam.Format.WAV) - .voice("string") + .voice(ChatCompletionAudioParam.Voice.UnionMember1.ALLOY) .build() ) assertThat(body.frequencyPenalty()).contains(-2.0) diff --git a/openai-java-core/src/test/kotlin/com/openai/models/realtime/RealtimeAudioConfigOutputTest.kt b/openai-java-core/src/test/kotlin/com/openai/models/realtime/RealtimeAudioConfigOutputTest.kt index 960b62f1..c2efa1d8 100644 --- a/openai-java-core/src/test/kotlin/com/openai/models/realtime/RealtimeAudioConfigOutputTest.kt +++ b/openai-java-core/src/test/kotlin/com/openai/models/realtime/RealtimeAudioConfigOutputTest.kt @@ -20,7 +20,7 @@ internal class RealtimeAudioConfigOutputTest { .build() ) .speed(0.25) - .voice("string") + .voice(RealtimeAudioConfigOutput.Voice.UnionMember1.ALLOY) .build() assertThat(realtimeAudioConfigOutput.format()) @@ -34,7 +34,11 @@ internal class RealtimeAudioConfigOutputTest { ) assertThat(realtimeAudioConfigOutput.speed()).contains(0.25) assertThat(realtimeAudioConfigOutput.voice()) - .contains(RealtimeAudioConfigOutput.Voice.ofString("string")) + .contains( + RealtimeAudioConfigOutput.Voice.ofUnionMember1( + RealtimeAudioConfigOutput.Voice.UnionMember1.ALLOY + ) + ) } @Test @@ -49,7 +53,7 @@ internal class RealtimeAudioConfigOutputTest { .build() ) .speed(0.25) - .voice("string") + .voice(RealtimeAudioConfigOutput.Voice.UnionMember1.ALLOY) .build() val roundtrippedRealtimeAudioConfigOutput = diff --git a/openai-java-core/src/test/kotlin/com/openai/models/realtime/RealtimeAudioConfigTest.kt b/openai-java-core/src/test/kotlin/com/openai/models/realtime/RealtimeAudioConfigTest.kt index 4553b622..618b7451 100644 --- a/openai-java-core/src/test/kotlin/com/openai/models/realtime/RealtimeAudioConfigTest.kt +++ b/openai-java-core/src/test/kotlin/com/openai/models/realtime/RealtimeAudioConfigTest.kt @@ -54,7 +54,7 @@ internal class RealtimeAudioConfigTest { .build() ) .speed(0.25) - .voice("string") + .voice(RealtimeAudioConfigOutput.Voice.UnionMember1.ALLOY) .build() ) .build() @@ -102,7 +102,7 @@ internal class RealtimeAudioConfigTest { .build() ) .speed(0.25) - .voice("string") + .voice(RealtimeAudioConfigOutput.Voice.UnionMember1.ALLOY) .build() ) } @@ -153,7 +153,7 @@ internal class RealtimeAudioConfigTest { .build() ) .speed(0.25) - .voice("string") + .voice(RealtimeAudioConfigOutput.Voice.UnionMember1.ALLOY) .build() ) .build() diff --git a/openai-java-core/src/test/kotlin/com/openai/models/realtime/RealtimeClientEventTest.kt b/openai-java-core/src/test/kotlin/com/openai/models/realtime/RealtimeClientEventTest.kt index 8d1f014e..18994d2e 100644 --- a/openai-java-core/src/test/kotlin/com/openai/models/realtime/RealtimeClientEventTest.kt +++ b/openai-java-core/src/test/kotlin/com/openai/models/realtime/RealtimeClientEventTest.kt @@ -422,7 +422,11 @@ internal class RealtimeClientEventTest { .type(RealtimeAudioFormats.AudioPcm.Type.AUDIO_PCM) .build() ) - .voice("string") + .voice( + RealtimeResponseCreateAudioOutput.Output.Voice + .UnionMember1 + .ALLOY + ) .build() ) .build() @@ -445,7 +449,7 @@ internal class RealtimeClientEventTest { .build() ) .instructions("instructions") - .maxOutputTokens(0L) + .maxOutputTokensInf() .metadata( RealtimeResponseCreateParams.Metadata.builder() .putAdditionalProperty("foo", JsonValue.from("string")) @@ -512,7 +516,11 @@ internal class RealtimeClientEventTest { ) .build() ) - .voice("string") + .voice( + RealtimeResponseCreateAudioOutput.Output.Voice + .UnionMember1 + .ALLOY + ) .build() ) .build() @@ -537,7 +545,7 @@ internal class RealtimeClientEventTest { .build() ) .instructions("instructions") - .maxOutputTokens(0L) + .maxOutputTokensInf() .metadata( RealtimeResponseCreateParams.Metadata.builder() .putAdditionalProperty("foo", JsonValue.from("string")) @@ -627,7 +635,7 @@ internal class RealtimeClientEventTest { .build() ) .speed(0.25) - .voice("string") + .voice(RealtimeAudioConfigOutput.Voice.UnionMember1.ALLOY) .build() ) .build() @@ -637,7 +645,7 @@ internal class RealtimeClientEventTest { .ITEM_INPUT_AUDIO_TRANSCRIPTION_LOGPROBS ) .instructions("instructions") - .maxOutputTokens(0L) + .maxOutputTokensInf() .model(RealtimeSessionCreateRequest.Model.GPT_REALTIME) .addOutputModality(RealtimeSessionCreateRequest.OutputModality.TEXT) .prompt( @@ -737,7 +745,9 @@ internal class RealtimeClientEventTest { .build() ) .speed(0.25) - .voice("string") + .voice( + RealtimeAudioConfigOutput.Voice.UnionMember1.ALLOY + ) .build() ) .build() @@ -747,7 +757,7 @@ internal class RealtimeClientEventTest { .ITEM_INPUT_AUDIO_TRANSCRIPTION_LOGPROBS ) .instructions("instructions") - .maxOutputTokens(0L) + .maxOutputTokensInf() .model(RealtimeSessionCreateRequest.Model.GPT_REALTIME) .addOutputModality(RealtimeSessionCreateRequest.OutputModality.TEXT) .prompt( diff --git a/openai-java-core/src/test/kotlin/com/openai/models/realtime/RealtimeResponseCreateAudioOutputTest.kt b/openai-java-core/src/test/kotlin/com/openai/models/realtime/RealtimeResponseCreateAudioOutputTest.kt index c2cdaea7..d850acf8 100644 --- a/openai-java-core/src/test/kotlin/com/openai/models/realtime/RealtimeResponseCreateAudioOutputTest.kt +++ b/openai-java-core/src/test/kotlin/com/openai/models/realtime/RealtimeResponseCreateAudioOutputTest.kt @@ -21,7 +21,7 @@ internal class RealtimeResponseCreateAudioOutputTest { .type(RealtimeAudioFormats.AudioPcm.Type.AUDIO_PCM) .build() ) - .voice("string") + .voice(RealtimeResponseCreateAudioOutput.Output.Voice.UnionMember1.ALLOY) .build() ) .build() @@ -35,7 +35,7 @@ internal class RealtimeResponseCreateAudioOutputTest { .type(RealtimeAudioFormats.AudioPcm.Type.AUDIO_PCM) .build() ) - .voice("string") + .voice(RealtimeResponseCreateAudioOutput.Output.Voice.UnionMember1.ALLOY) .build() ) } @@ -53,7 +53,7 @@ internal class RealtimeResponseCreateAudioOutputTest { .type(RealtimeAudioFormats.AudioPcm.Type.AUDIO_PCM) .build() ) - .voice("string") + .voice(RealtimeResponseCreateAudioOutput.Output.Voice.UnionMember1.ALLOY) .build() ) .build() diff --git a/openai-java-core/src/test/kotlin/com/openai/models/realtime/RealtimeResponseCreateMcpToolTest.kt b/openai-java-core/src/test/kotlin/com/openai/models/realtime/RealtimeResponseCreateMcpToolTest.kt index 4006044e..7d7b01f8 100644 --- a/openai-java-core/src/test/kotlin/com/openai/models/realtime/RealtimeResponseCreateMcpToolTest.kt +++ b/openai-java-core/src/test/kotlin/com/openai/models/realtime/RealtimeResponseCreateMcpToolTest.kt @@ -25,24 +25,7 @@ internal class RealtimeResponseCreateMcpToolTest { .build() ) .requireApproval( - RealtimeResponseCreateMcpTool.RequireApproval.McpToolApprovalFilter.builder() - .always( - RealtimeResponseCreateMcpTool.RequireApproval.McpToolApprovalFilter - .Always - .builder() - .readOnly(true) - .addToolName("string") - .build() - ) - .never( - RealtimeResponseCreateMcpTool.RequireApproval.McpToolApprovalFilter - .Never - .builder() - .readOnly(true) - .addToolName("string") - .build() - ) - .build() + RealtimeResponseCreateMcpTool.RequireApproval.McpToolApprovalSetting.ALWAYS ) .serverDescription("server_description") .serverUrl("server_url") @@ -63,25 +46,8 @@ internal class RealtimeResponseCreateMcpToolTest { ) assertThat(realtimeResponseCreateMcpTool.requireApproval()) .contains( - RealtimeResponseCreateMcpTool.RequireApproval.ofMcpToolApprovalFilter( - RealtimeResponseCreateMcpTool.RequireApproval.McpToolApprovalFilter.builder() - .always( - RealtimeResponseCreateMcpTool.RequireApproval.McpToolApprovalFilter - .Always - .builder() - .readOnly(true) - .addToolName("string") - .build() - ) - .never( - RealtimeResponseCreateMcpTool.RequireApproval.McpToolApprovalFilter - .Never - .builder() - .readOnly(true) - .addToolName("string") - .build() - ) - .build() + RealtimeResponseCreateMcpTool.RequireApproval.ofMcpToolApprovalSetting( + RealtimeResponseCreateMcpTool.RequireApproval.McpToolApprovalSetting.ALWAYS ) ) assertThat(realtimeResponseCreateMcpTool.serverDescription()).contains("server_description") @@ -104,24 +70,7 @@ internal class RealtimeResponseCreateMcpToolTest { .build() ) .requireApproval( - RealtimeResponseCreateMcpTool.RequireApproval.McpToolApprovalFilter.builder() - .always( - RealtimeResponseCreateMcpTool.RequireApproval.McpToolApprovalFilter - .Always - .builder() - .readOnly(true) - .addToolName("string") - .build() - ) - .never( - RealtimeResponseCreateMcpTool.RequireApproval.McpToolApprovalFilter - .Never - .builder() - .readOnly(true) - .addToolName("string") - .build() - ) - .build() + RealtimeResponseCreateMcpTool.RequireApproval.McpToolApprovalSetting.ALWAYS ) .serverDescription("server_description") .serverUrl("server_url") diff --git a/openai-java-core/src/test/kotlin/com/openai/models/realtime/RealtimeResponseCreateParamsTest.kt b/openai-java-core/src/test/kotlin/com/openai/models/realtime/RealtimeResponseCreateParamsTest.kt index 5feb6a03..f0ef7101 100644 --- a/openai-java-core/src/test/kotlin/com/openai/models/realtime/RealtimeResponseCreateParamsTest.kt +++ b/openai-java-core/src/test/kotlin/com/openai/models/realtime/RealtimeResponseCreateParamsTest.kt @@ -27,7 +27,10 @@ internal class RealtimeResponseCreateParamsTest { .type(RealtimeAudioFormats.AudioPcm.Type.AUDIO_PCM) .build() ) - .voice("string") + .voice( + RealtimeResponseCreateAudioOutput.Output.Voice.UnionMember1 + .ALLOY + ) .build() ) .build() @@ -47,7 +50,7 @@ internal class RealtimeResponseCreateParamsTest { .build() ) .instructions("instructions") - .maxOutputTokens(0L) + .maxOutputTokensInf() .metadata( RealtimeResponseCreateParams.Metadata.builder() .putAdditionalProperty("foo", JsonValue.from("string")) @@ -87,7 +90,9 @@ internal class RealtimeResponseCreateParamsTest { .type(RealtimeAudioFormats.AudioPcm.Type.AUDIO_PCM) .build() ) - .voice("string") + .voice( + RealtimeResponseCreateAudioOutput.Output.Voice.UnionMember1.ALLOY + ) .build() ) .build() @@ -112,7 +117,7 @@ internal class RealtimeResponseCreateParamsTest { ) assertThat(realtimeResponseCreateParams.instructions()).contains("instructions") assertThat(realtimeResponseCreateParams.maxOutputTokens()) - .contains(RealtimeResponseCreateParams.MaxOutputTokens.ofInteger(0L)) + .contains(RealtimeResponseCreateParams.MaxOutputTokens.ofInf()) assertThat(realtimeResponseCreateParams.metadata()) .contains( RealtimeResponseCreateParams.Metadata.builder() @@ -163,7 +168,10 @@ internal class RealtimeResponseCreateParamsTest { .type(RealtimeAudioFormats.AudioPcm.Type.AUDIO_PCM) .build() ) - .voice("string") + .voice( + RealtimeResponseCreateAudioOutput.Output.Voice.UnionMember1 + .ALLOY + ) .build() ) .build() @@ -183,7 +191,7 @@ internal class RealtimeResponseCreateParamsTest { .build() ) .instructions("instructions") - .maxOutputTokens(0L) + .maxOutputTokensInf() .metadata( RealtimeResponseCreateParams.Metadata.builder() .putAdditionalProperty("foo", JsonValue.from("string")) diff --git a/openai-java-core/src/test/kotlin/com/openai/models/realtime/RealtimeResponseTest.kt b/openai-java-core/src/test/kotlin/com/openai/models/realtime/RealtimeResponseTest.kt index c23a29fb..85150970 100644 --- a/openai-java-core/src/test/kotlin/com/openai/models/realtime/RealtimeResponseTest.kt +++ b/openai-java-core/src/test/kotlin/com/openai/models/realtime/RealtimeResponseTest.kt @@ -32,7 +32,7 @@ internal class RealtimeResponseTest { .build() ) .conversationId("conversation_id") - .maxOutputTokens(0L) + .maxOutputTokensInf() .metadata( RealtimeResponse.Metadata.builder() .putAdditionalProperty("foo", JsonValue.from("string")) @@ -113,7 +113,7 @@ internal class RealtimeResponseTest { ) assertThat(realtimeResponse.conversationId()).contains("conversation_id") assertThat(realtimeResponse.maxOutputTokens()) - .contains(RealtimeResponse.MaxOutputTokens.ofInteger(0L)) + .contains(RealtimeResponse.MaxOutputTokens.ofInf()) assertThat(realtimeResponse.metadata()) .contains( RealtimeResponse.Metadata.builder() @@ -201,7 +201,7 @@ internal class RealtimeResponseTest { .build() ) .conversationId("conversation_id") - .maxOutputTokens(0L) + .maxOutputTokensInf() .metadata( RealtimeResponse.Metadata.builder() .putAdditionalProperty("foo", JsonValue.from("string")) diff --git a/openai-java-core/src/test/kotlin/com/openai/models/realtime/RealtimeServerEventTest.kt b/openai-java-core/src/test/kotlin/com/openai/models/realtime/RealtimeServerEventTest.kt index d22510a8..199c37f8 100644 --- a/openai-java-core/src/test/kotlin/com/openai/models/realtime/RealtimeServerEventTest.kt +++ b/openai-java-core/src/test/kotlin/com/openai/models/realtime/RealtimeServerEventTest.kt @@ -1962,7 +1962,7 @@ internal class RealtimeServerEventTest { .build() ) .conversationId("conversation_id") - .maxOutputTokens(0L) + .maxOutputTokensInf() .metadata( RealtimeResponse.Metadata.builder() .putAdditionalProperty("foo", JsonValue.from("string")) @@ -2111,7 +2111,7 @@ internal class RealtimeServerEventTest { .build() ) .conversationId("conversation_id") - .maxOutputTokens(0L) + .maxOutputTokensInf() .metadata( RealtimeResponse.Metadata.builder() .putAdditionalProperty("foo", JsonValue.from("string")) @@ -2218,7 +2218,7 @@ internal class RealtimeServerEventTest { .build() ) .conversationId("conversation_id") - .maxOutputTokens(0L) + .maxOutputTokensInf() .metadata( RealtimeResponse.Metadata.builder() .putAdditionalProperty("foo", JsonValue.from("string")) @@ -2367,7 +2367,7 @@ internal class RealtimeServerEventTest { .build() ) .conversationId("conversation_id") - .maxOutputTokens(0L) + .maxOutputTokensInf() .metadata( RealtimeResponse.Metadata.builder() .putAdditionalProperty("foo", JsonValue.from("string")) @@ -3076,7 +3076,7 @@ internal class RealtimeServerEventTest { .build() ) .speed(0.25) - .voice("string") + .voice(RealtimeAudioConfigOutput.Voice.UnionMember1.ALLOY) .build() ) .build() @@ -3086,7 +3086,7 @@ internal class RealtimeServerEventTest { .ITEM_INPUT_AUDIO_TRANSCRIPTION_LOGPROBS ) .instructions("instructions") - .maxOutputTokens(0L) + .maxOutputTokensInf() .model(RealtimeSessionCreateRequest.Model.GPT_REALTIME) .addOutputModality(RealtimeSessionCreateRequest.OutputModality.TEXT) .prompt( @@ -3221,7 +3221,9 @@ internal class RealtimeServerEventTest { .build() ) .speed(0.25) - .voice("string") + .voice( + RealtimeAudioConfigOutput.Voice.UnionMember1.ALLOY + ) .build() ) .build() @@ -3231,7 +3233,7 @@ internal class RealtimeServerEventTest { .ITEM_INPUT_AUDIO_TRANSCRIPTION_LOGPROBS ) .instructions("instructions") - .maxOutputTokens(0L) + .maxOutputTokensInf() .model(RealtimeSessionCreateRequest.Model.GPT_REALTIME) .addOutputModality(RealtimeSessionCreateRequest.OutputModality.TEXT) .prompt( @@ -3320,7 +3322,7 @@ internal class RealtimeServerEventTest { .build() ) .speed(0.25) - .voice("string") + .voice(RealtimeAudioConfigOutput.Voice.UnionMember1.ALLOY) .build() ) .build() @@ -3330,7 +3332,7 @@ internal class RealtimeServerEventTest { .ITEM_INPUT_AUDIO_TRANSCRIPTION_LOGPROBS ) .instructions("instructions") - .maxOutputTokens(0L) + .maxOutputTokensInf() .model(RealtimeSessionCreateRequest.Model.GPT_REALTIME) .addOutputModality(RealtimeSessionCreateRequest.OutputModality.TEXT) .prompt( @@ -3465,7 +3467,9 @@ internal class RealtimeServerEventTest { .build() ) .speed(0.25) - .voice("string") + .voice( + RealtimeAudioConfigOutput.Voice.UnionMember1.ALLOY + ) .build() ) .build() @@ -3475,7 +3479,7 @@ internal class RealtimeServerEventTest { .ITEM_INPUT_AUDIO_TRANSCRIPTION_LOGPROBS ) .instructions("instructions") - .maxOutputTokens(0L) + .maxOutputTokensInf() .model(RealtimeSessionCreateRequest.Model.GPT_REALTIME) .addOutputModality(RealtimeSessionCreateRequest.OutputModality.TEXT) .prompt( diff --git a/openai-java-core/src/test/kotlin/com/openai/models/realtime/RealtimeSessionCreateRequestTest.kt b/openai-java-core/src/test/kotlin/com/openai/models/realtime/RealtimeSessionCreateRequestTest.kt index 27b728c0..835ad2c6 100644 --- a/openai-java-core/src/test/kotlin/com/openai/models/realtime/RealtimeSessionCreateRequestTest.kt +++ b/openai-java-core/src/test/kotlin/com/openai/models/realtime/RealtimeSessionCreateRequestTest.kt @@ -60,7 +60,7 @@ internal class RealtimeSessionCreateRequestTest { .build() ) .speed(0.25) - .voice("string") + .voice(RealtimeAudioConfigOutput.Voice.UnionMember1.ALLOY) .build() ) .build() @@ -69,7 +69,7 @@ internal class RealtimeSessionCreateRequestTest { RealtimeSessionCreateRequest.Include.ITEM_INPUT_AUDIO_TRANSCRIPTION_LOGPROBS ) .instructions("instructions") - .maxOutputTokens(0L) + .maxOutputTokensInf() .model(RealtimeSessionCreateRequest.Model.GPT_REALTIME) .addOutputModality(RealtimeSessionCreateRequest.OutputModality.TEXT) .prompt( @@ -140,7 +140,7 @@ internal class RealtimeSessionCreateRequestTest { .build() ) .speed(0.25) - .voice("string") + .voice(RealtimeAudioConfigOutput.Voice.UnionMember1.ALLOY) .build() ) .build() @@ -151,7 +151,7 @@ internal class RealtimeSessionCreateRequestTest { ) assertThat(realtimeSessionCreateRequest.instructions()).contains("instructions") assertThat(realtimeSessionCreateRequest.maxOutputTokens()) - .contains(RealtimeSessionCreateRequest.MaxOutputTokens.ofInteger(0L)) + .contains(RealtimeSessionCreateRequest.MaxOutputTokens.ofInf()) assertThat(realtimeSessionCreateRequest.model()) .contains(RealtimeSessionCreateRequest.Model.GPT_REALTIME) assertThat(realtimeSessionCreateRequest.outputModalities().getOrNull()) @@ -236,7 +236,7 @@ internal class RealtimeSessionCreateRequestTest { .build() ) .speed(0.25) - .voice("string") + .voice(RealtimeAudioConfigOutput.Voice.UnionMember1.ALLOY) .build() ) .build() @@ -245,7 +245,7 @@ internal class RealtimeSessionCreateRequestTest { RealtimeSessionCreateRequest.Include.ITEM_INPUT_AUDIO_TRANSCRIPTION_LOGPROBS ) .instructions("instructions") - .maxOutputTokens(0L) + .maxOutputTokensInf() .model(RealtimeSessionCreateRequest.Model.GPT_REALTIME) .addOutputModality(RealtimeSessionCreateRequest.OutputModality.TEXT) .prompt( diff --git a/openai-java-core/src/test/kotlin/com/openai/models/realtime/RealtimeSessionTest.kt b/openai-java-core/src/test/kotlin/com/openai/models/realtime/RealtimeSessionTest.kt index 64b72671..d2c48b3f 100644 --- a/openai-java-core/src/test/kotlin/com/openai/models/realtime/RealtimeSessionTest.kt +++ b/openai-java-core/src/test/kotlin/com/openai/models/realtime/RealtimeSessionTest.kt @@ -33,7 +33,7 @@ internal class RealtimeSessionTest { .build() ) .instructions("instructions") - .maxResponseOutputTokens(0L) + .maxResponseOutputTokensInf() .addModality(RealtimeSession.Modality.TEXT) .model(RealtimeSession.Model.GPT_REALTIME) .object_(RealtimeSession.Object.REALTIME_SESSION) @@ -96,7 +96,7 @@ internal class RealtimeSessionTest { ) assertThat(realtimeSession.instructions()).contains("instructions") assertThat(realtimeSession.maxResponseOutputTokens()) - .contains(RealtimeSession.MaxResponseOutputTokens.ofInteger(0L)) + .contains(RealtimeSession.MaxResponseOutputTokens.ofInf()) assertThat(realtimeSession.modalities().getOrNull()) .containsExactly(RealtimeSession.Modality.TEXT) assertThat(realtimeSession.model()).contains(RealtimeSession.Model.GPT_REALTIME) @@ -166,7 +166,7 @@ internal class RealtimeSessionTest { .build() ) .instructions("instructions") - .maxResponseOutputTokens(0L) + .maxResponseOutputTokensInf() .addModality(RealtimeSession.Modality.TEXT) .model(RealtimeSession.Model.GPT_REALTIME) .object_(RealtimeSession.Object.REALTIME_SESSION) diff --git a/openai-java-core/src/test/kotlin/com/openai/models/realtime/RealtimeToolsConfigUnionTest.kt b/openai-java-core/src/test/kotlin/com/openai/models/realtime/RealtimeToolsConfigUnionTest.kt index b820e462..df59c620 100644 --- a/openai-java-core/src/test/kotlin/com/openai/models/realtime/RealtimeToolsConfigUnionTest.kt +++ b/openai-java-core/src/test/kotlin/com/openai/models/realtime/RealtimeToolsConfigUnionTest.kt @@ -67,23 +67,7 @@ internal class RealtimeToolsConfigUnionTest { .build() ) .requireApproval( - RealtimeToolsConfigUnion.Mcp.RequireApproval.McpToolApprovalFilter.builder() - .always( - RealtimeToolsConfigUnion.Mcp.RequireApproval.McpToolApprovalFilter - .Always - .builder() - .readOnly(true) - .addToolName("string") - .build() - ) - .never( - RealtimeToolsConfigUnion.Mcp.RequireApproval.McpToolApprovalFilter.Never - .builder() - .readOnly(true) - .addToolName("string") - .build() - ) - .build() + RealtimeToolsConfigUnion.Mcp.RequireApproval.McpToolApprovalSetting.ALWAYS ) .serverDescription("server_description") .serverUrl("server_url") @@ -112,24 +96,7 @@ internal class RealtimeToolsConfigUnionTest { .build() ) .requireApproval( - RealtimeToolsConfigUnion.Mcp.RequireApproval.McpToolApprovalFilter.builder() - .always( - RealtimeToolsConfigUnion.Mcp.RequireApproval.McpToolApprovalFilter - .Always - .builder() - .readOnly(true) - .addToolName("string") - .build() - ) - .never( - RealtimeToolsConfigUnion.Mcp.RequireApproval.McpToolApprovalFilter - .Never - .builder() - .readOnly(true) - .addToolName("string") - .build() - ) - .build() + RealtimeToolsConfigUnion.Mcp.RequireApproval.McpToolApprovalSetting.ALWAYS ) .serverDescription("server_description") .serverUrl("server_url") diff --git a/openai-java-core/src/test/kotlin/com/openai/models/realtime/ResponseCreateEventTest.kt b/openai-java-core/src/test/kotlin/com/openai/models/realtime/ResponseCreateEventTest.kt index 33487dd7..90e56c4c 100644 --- a/openai-java-core/src/test/kotlin/com/openai/models/realtime/ResponseCreateEventTest.kt +++ b/openai-java-core/src/test/kotlin/com/openai/models/realtime/ResponseCreateEventTest.kt @@ -29,7 +29,11 @@ internal class ResponseCreateEventTest { .type(RealtimeAudioFormats.AudioPcm.Type.AUDIO_PCM) .build() ) - .voice("string") + .voice( + RealtimeResponseCreateAudioOutput.Output.Voice + .UnionMember1 + .ALLOY + ) .build() ) .build() @@ -52,7 +56,7 @@ internal class ResponseCreateEventTest { .build() ) .instructions("instructions") - .maxOutputTokens(0L) + .maxOutputTokensInf() .metadata( RealtimeResponseCreateParams.Metadata.builder() .putAdditionalProperty("foo", JsonValue.from("string")) @@ -97,7 +101,10 @@ internal class ResponseCreateEventTest { .type(RealtimeAudioFormats.AudioPcm.Type.AUDIO_PCM) .build() ) - .voice("string") + .voice( + RealtimeResponseCreateAudioOutput.Output.Voice.UnionMember1 + .ALLOY + ) .build() ) .build() @@ -120,7 +127,7 @@ internal class ResponseCreateEventTest { .build() ) .instructions("instructions") - .maxOutputTokens(0L) + .maxOutputTokensInf() .metadata( RealtimeResponseCreateParams.Metadata.builder() .putAdditionalProperty("foo", JsonValue.from("string")) @@ -169,7 +176,11 @@ internal class ResponseCreateEventTest { .type(RealtimeAudioFormats.AudioPcm.Type.AUDIO_PCM) .build() ) - .voice("string") + .voice( + RealtimeResponseCreateAudioOutput.Output.Voice + .UnionMember1 + .ALLOY + ) .build() ) .build() @@ -192,7 +203,7 @@ internal class ResponseCreateEventTest { .build() ) .instructions("instructions") - .maxOutputTokens(0L) + .maxOutputTokensInf() .metadata( RealtimeResponseCreateParams.Metadata.builder() .putAdditionalProperty("foo", JsonValue.from("string")) diff --git a/openai-java-core/src/test/kotlin/com/openai/models/realtime/ResponseCreatedEventTest.kt b/openai-java-core/src/test/kotlin/com/openai/models/realtime/ResponseCreatedEventTest.kt index eb3d2105..d938ddaf 100644 --- a/openai-java-core/src/test/kotlin/com/openai/models/realtime/ResponseCreatedEventTest.kt +++ b/openai-java-core/src/test/kotlin/com/openai/models/realtime/ResponseCreatedEventTest.kt @@ -34,7 +34,7 @@ internal class ResponseCreatedEventTest { .build() ) .conversationId("conversation_id") - .maxOutputTokens(0L) + .maxOutputTokensInf() .metadata( RealtimeResponse.Metadata.builder() .putAdditionalProperty("foo", JsonValue.from("string")) @@ -126,7 +126,7 @@ internal class ResponseCreatedEventTest { .build() ) .conversationId("conversation_id") - .maxOutputTokens(0L) + .maxOutputTokensInf() .metadata( RealtimeResponse.Metadata.builder() .putAdditionalProperty("foo", JsonValue.from("string")) @@ -221,7 +221,7 @@ internal class ResponseCreatedEventTest { .build() ) .conversationId("conversation_id") - .maxOutputTokens(0L) + .maxOutputTokensInf() .metadata( RealtimeResponse.Metadata.builder() .putAdditionalProperty("foo", JsonValue.from("string")) diff --git a/openai-java-core/src/test/kotlin/com/openai/models/realtime/ResponseDoneEventTest.kt b/openai-java-core/src/test/kotlin/com/openai/models/realtime/ResponseDoneEventTest.kt index 1a606f0c..f90868a4 100644 --- a/openai-java-core/src/test/kotlin/com/openai/models/realtime/ResponseDoneEventTest.kt +++ b/openai-java-core/src/test/kotlin/com/openai/models/realtime/ResponseDoneEventTest.kt @@ -34,7 +34,7 @@ internal class ResponseDoneEventTest { .build() ) .conversationId("conversation_id") - .maxOutputTokens(0L) + .maxOutputTokensInf() .metadata( RealtimeResponse.Metadata.builder() .putAdditionalProperty("foo", JsonValue.from("string")) @@ -126,7 +126,7 @@ internal class ResponseDoneEventTest { .build() ) .conversationId("conversation_id") - .maxOutputTokens(0L) + .maxOutputTokensInf() .metadata( RealtimeResponse.Metadata.builder() .putAdditionalProperty("foo", JsonValue.from("string")) @@ -221,7 +221,7 @@ internal class ResponseDoneEventTest { .build() ) .conversationId("conversation_id") - .maxOutputTokens(0L) + .maxOutputTokensInf() .metadata( RealtimeResponse.Metadata.builder() .putAdditionalProperty("foo", JsonValue.from("string")) diff --git a/openai-java-core/src/test/kotlin/com/openai/models/realtime/SessionCreatedEventTest.kt b/openai-java-core/src/test/kotlin/com/openai/models/realtime/SessionCreatedEventTest.kt index 71aa300c..c1bfee2e 100644 --- a/openai-java-core/src/test/kotlin/com/openai/models/realtime/SessionCreatedEventTest.kt +++ b/openai-java-core/src/test/kotlin/com/openai/models/realtime/SessionCreatedEventTest.kt @@ -62,7 +62,7 @@ internal class SessionCreatedEventTest { .build() ) .speed(0.25) - .voice("string") + .voice(RealtimeAudioConfigOutput.Voice.UnionMember1.ALLOY) .build() ) .build() @@ -72,7 +72,7 @@ internal class SessionCreatedEventTest { .ITEM_INPUT_AUDIO_TRANSCRIPTION_LOGPROBS ) .instructions("instructions") - .maxOutputTokens(0L) + .maxOutputTokensInf() .model(RealtimeSessionCreateRequest.Model.GPT_REALTIME) .addOutputModality(RealtimeSessionCreateRequest.OutputModality.TEXT) .prompt( @@ -149,7 +149,7 @@ internal class SessionCreatedEventTest { .build() ) .speed(0.25) - .voice("string") + .voice(RealtimeAudioConfigOutput.Voice.UnionMember1.ALLOY) .build() ) .build() @@ -159,7 +159,7 @@ internal class SessionCreatedEventTest { .ITEM_INPUT_AUDIO_TRANSCRIPTION_LOGPROBS ) .instructions("instructions") - .maxOutputTokens(0L) + .maxOutputTokensInf() .model(RealtimeSessionCreateRequest.Model.GPT_REALTIME) .addOutputModality(RealtimeSessionCreateRequest.OutputModality.TEXT) .prompt( @@ -240,7 +240,7 @@ internal class SessionCreatedEventTest { .build() ) .speed(0.25) - .voice("string") + .voice(RealtimeAudioConfigOutput.Voice.UnionMember1.ALLOY) .build() ) .build() @@ -250,7 +250,7 @@ internal class SessionCreatedEventTest { .ITEM_INPUT_AUDIO_TRANSCRIPTION_LOGPROBS ) .instructions("instructions") - .maxOutputTokens(0L) + .maxOutputTokensInf() .model(RealtimeSessionCreateRequest.Model.GPT_REALTIME) .addOutputModality(RealtimeSessionCreateRequest.OutputModality.TEXT) .prompt( diff --git a/openai-java-core/src/test/kotlin/com/openai/models/realtime/SessionUpdateEventTest.kt b/openai-java-core/src/test/kotlin/com/openai/models/realtime/SessionUpdateEventTest.kt index 7af4c81a..c5fb1a04 100644 --- a/openai-java-core/src/test/kotlin/com/openai/models/realtime/SessionUpdateEventTest.kt +++ b/openai-java-core/src/test/kotlin/com/openai/models/realtime/SessionUpdateEventTest.kt @@ -61,7 +61,7 @@ internal class SessionUpdateEventTest { .build() ) .speed(0.25) - .voice("string") + .voice(RealtimeAudioConfigOutput.Voice.UnionMember1.ALLOY) .build() ) .build() @@ -71,7 +71,7 @@ internal class SessionUpdateEventTest { .ITEM_INPUT_AUDIO_TRANSCRIPTION_LOGPROBS ) .instructions("instructions") - .maxOutputTokens(0L) + .maxOutputTokensInf() .model(RealtimeSessionCreateRequest.Model.GPT_REALTIME) .addOutputModality(RealtimeSessionCreateRequest.OutputModality.TEXT) .prompt( @@ -148,7 +148,7 @@ internal class SessionUpdateEventTest { .build() ) .speed(0.25) - .voice("string") + .voice(RealtimeAudioConfigOutput.Voice.UnionMember1.ALLOY) .build() ) .build() @@ -158,7 +158,7 @@ internal class SessionUpdateEventTest { .ITEM_INPUT_AUDIO_TRANSCRIPTION_LOGPROBS ) .instructions("instructions") - .maxOutputTokens(0L) + .maxOutputTokensInf() .model(RealtimeSessionCreateRequest.Model.GPT_REALTIME) .addOutputModality(RealtimeSessionCreateRequest.OutputModality.TEXT) .prompt( @@ -239,7 +239,7 @@ internal class SessionUpdateEventTest { .build() ) .speed(0.25) - .voice("string") + .voice(RealtimeAudioConfigOutput.Voice.UnionMember1.ALLOY) .build() ) .build() @@ -249,7 +249,7 @@ internal class SessionUpdateEventTest { .ITEM_INPUT_AUDIO_TRANSCRIPTION_LOGPROBS ) .instructions("instructions") - .maxOutputTokens(0L) + .maxOutputTokensInf() .model(RealtimeSessionCreateRequest.Model.GPT_REALTIME) .addOutputModality(RealtimeSessionCreateRequest.OutputModality.TEXT) .prompt( diff --git a/openai-java-core/src/test/kotlin/com/openai/models/realtime/SessionUpdatedEventTest.kt b/openai-java-core/src/test/kotlin/com/openai/models/realtime/SessionUpdatedEventTest.kt index d9197734..d7599e4f 100644 --- a/openai-java-core/src/test/kotlin/com/openai/models/realtime/SessionUpdatedEventTest.kt +++ b/openai-java-core/src/test/kotlin/com/openai/models/realtime/SessionUpdatedEventTest.kt @@ -62,7 +62,7 @@ internal class SessionUpdatedEventTest { .build() ) .speed(0.25) - .voice("string") + .voice(RealtimeAudioConfigOutput.Voice.UnionMember1.ALLOY) .build() ) .build() @@ -72,7 +72,7 @@ internal class SessionUpdatedEventTest { .ITEM_INPUT_AUDIO_TRANSCRIPTION_LOGPROBS ) .instructions("instructions") - .maxOutputTokens(0L) + .maxOutputTokensInf() .model(RealtimeSessionCreateRequest.Model.GPT_REALTIME) .addOutputModality(RealtimeSessionCreateRequest.OutputModality.TEXT) .prompt( @@ -149,7 +149,7 @@ internal class SessionUpdatedEventTest { .build() ) .speed(0.25) - .voice("string") + .voice(RealtimeAudioConfigOutput.Voice.UnionMember1.ALLOY) .build() ) .build() @@ -159,7 +159,7 @@ internal class SessionUpdatedEventTest { .ITEM_INPUT_AUDIO_TRANSCRIPTION_LOGPROBS ) .instructions("instructions") - .maxOutputTokens(0L) + .maxOutputTokensInf() .model(RealtimeSessionCreateRequest.Model.GPT_REALTIME) .addOutputModality(RealtimeSessionCreateRequest.OutputModality.TEXT) .prompt( @@ -240,7 +240,7 @@ internal class SessionUpdatedEventTest { .build() ) .speed(0.25) - .voice("string") + .voice(RealtimeAudioConfigOutput.Voice.UnionMember1.ALLOY) .build() ) .build() @@ -250,7 +250,7 @@ internal class SessionUpdatedEventTest { .ITEM_INPUT_AUDIO_TRANSCRIPTION_LOGPROBS ) .instructions("instructions") - .maxOutputTokens(0L) + .maxOutputTokensInf() .model(RealtimeSessionCreateRequest.Model.GPT_REALTIME) .addOutputModality(RealtimeSessionCreateRequest.OutputModality.TEXT) .prompt( diff --git a/openai-java-core/src/test/kotlin/com/openai/models/realtime/calls/CallAcceptParamsTest.kt b/openai-java-core/src/test/kotlin/com/openai/models/realtime/calls/CallAcceptParamsTest.kt index 305ef63d..c18ddad9 100644 --- a/openai-java-core/src/test/kotlin/com/openai/models/realtime/calls/CallAcceptParamsTest.kt +++ b/openai-java-core/src/test/kotlin/com/openai/models/realtime/calls/CallAcceptParamsTest.kt @@ -69,7 +69,7 @@ internal class CallAcceptParamsTest { .build() ) .speed(0.25) - .voice("string") + .voice(RealtimeAudioConfigOutput.Voice.UnionMember1.ALLOY) .build() ) .build() @@ -78,7 +78,7 @@ internal class CallAcceptParamsTest { RealtimeSessionCreateRequest.Include.ITEM_INPUT_AUDIO_TRANSCRIPTION_LOGPROBS ) .instructions("instructions") - .maxOutputTokens(0L) + .maxOutputTokensInf() .model(RealtimeSessionCreateRequest.Model.GPT_REALTIME) .addOutputModality(RealtimeSessionCreateRequest.OutputModality.TEXT) .prompt( @@ -171,7 +171,7 @@ internal class CallAcceptParamsTest { .build() ) .speed(0.25) - .voice("string") + .voice(RealtimeAudioConfigOutput.Voice.UnionMember1.ALLOY) .build() ) .build() @@ -181,7 +181,7 @@ internal class CallAcceptParamsTest { .ITEM_INPUT_AUDIO_TRANSCRIPTION_LOGPROBS ) .instructions("instructions") - .maxOutputTokens(0L) + .maxOutputTokensInf() .model(RealtimeSessionCreateRequest.Model.GPT_REALTIME) .addOutputModality(RealtimeSessionCreateRequest.OutputModality.TEXT) .prompt( @@ -258,7 +258,7 @@ internal class CallAcceptParamsTest { .build() ) .speed(0.25) - .voice("string") + .voice(RealtimeAudioConfigOutput.Voice.UnionMember1.ALLOY) .build() ) .build() @@ -267,7 +267,7 @@ internal class CallAcceptParamsTest { RealtimeSessionCreateRequest.Include.ITEM_INPUT_AUDIO_TRANSCRIPTION_LOGPROBS ) .instructions("instructions") - .maxOutputTokens(0L) + .maxOutputTokensInf() .model(RealtimeSessionCreateRequest.Model.GPT_REALTIME) .addOutputModality(RealtimeSessionCreateRequest.OutputModality.TEXT) .prompt( diff --git a/openai-java-core/src/test/kotlin/com/openai/models/realtime/clientsecrets/ClientSecretCreateParamsTest.kt b/openai-java-core/src/test/kotlin/com/openai/models/realtime/clientsecrets/ClientSecretCreateParamsTest.kt index b9944706..ab58f2aa 100644 --- a/openai-java-core/src/test/kotlin/com/openai/models/realtime/clientsecrets/ClientSecretCreateParamsTest.kt +++ b/openai-java-core/src/test/kotlin/com/openai/models/realtime/clientsecrets/ClientSecretCreateParamsTest.kt @@ -74,7 +74,7 @@ internal class ClientSecretCreateParamsTest { .build() ) .speed(0.25) - .voice("string") + .voice(RealtimeAudioConfigOutput.Voice.UnionMember1.ALLOY) .build() ) .build() @@ -83,7 +83,7 @@ internal class ClientSecretCreateParamsTest { RealtimeSessionCreateRequest.Include.ITEM_INPUT_AUDIO_TRANSCRIPTION_LOGPROBS ) .instructions("instructions") - .maxOutputTokens(0L) + .maxOutputTokensInf() .model(RealtimeSessionCreateRequest.Model.GPT_REALTIME) .addOutputModality(RealtimeSessionCreateRequest.OutputModality.TEXT) .prompt( @@ -168,7 +168,7 @@ internal class ClientSecretCreateParamsTest { .build() ) .speed(0.25) - .voice("string") + .voice(RealtimeAudioConfigOutput.Voice.UnionMember1.ALLOY) .build() ) .build() @@ -178,7 +178,7 @@ internal class ClientSecretCreateParamsTest { .ITEM_INPUT_AUDIO_TRANSCRIPTION_LOGPROBS ) .instructions("instructions") - .maxOutputTokens(0L) + .maxOutputTokensInf() .model(RealtimeSessionCreateRequest.Model.GPT_REALTIME) .addOutputModality(RealtimeSessionCreateRequest.OutputModality.TEXT) .prompt( @@ -263,7 +263,7 @@ internal class ClientSecretCreateParamsTest { .build() ) .speed(0.25) - .voice("string") + .voice(RealtimeAudioConfigOutput.Voice.UnionMember1.ALLOY) .build() ) .build() @@ -273,7 +273,7 @@ internal class ClientSecretCreateParamsTest { .ITEM_INPUT_AUDIO_TRANSCRIPTION_LOGPROBS ) .instructions("instructions") - .maxOutputTokens(0L) + .maxOutputTokensInf() .model(RealtimeSessionCreateRequest.Model.GPT_REALTIME) .addOutputModality(RealtimeSessionCreateRequest.OutputModality.TEXT) .prompt( diff --git a/openai-java-core/src/test/kotlin/com/openai/models/realtime/clientsecrets/ClientSecretCreateResponseTest.kt b/openai-java-core/src/test/kotlin/com/openai/models/realtime/clientsecrets/ClientSecretCreateResponseTest.kt index e17f28b1..49ea523e 100644 --- a/openai-java-core/src/test/kotlin/com/openai/models/realtime/clientsecrets/ClientSecretCreateResponseTest.kt +++ b/openai-java-core/src/test/kotlin/com/openai/models/realtime/clientsecrets/ClientSecretCreateResponseTest.kt @@ -86,7 +86,7 @@ internal class ClientSecretCreateResponseTest { .ITEM_INPUT_AUDIO_TRANSCRIPTION_LOGPROBS ) .instructions("instructions") - .maxOutputTokens(0L) + .maxOutputTokensInf() .model(RealtimeSessionCreateResponse.Model.GPT_REALTIME) .addOutputModality(RealtimeSessionCreateResponse.OutputModality.TEXT) .prompt( @@ -183,7 +183,7 @@ internal class ClientSecretCreateResponseTest { .ITEM_INPUT_AUDIO_TRANSCRIPTION_LOGPROBS ) .instructions("instructions") - .maxOutputTokens(0L) + .maxOutputTokensInf() .model(RealtimeSessionCreateResponse.Model.GPT_REALTIME) .addOutputModality(RealtimeSessionCreateResponse.OutputModality.TEXT) .prompt( @@ -284,7 +284,7 @@ internal class ClientSecretCreateResponseTest { .ITEM_INPUT_AUDIO_TRANSCRIPTION_LOGPROBS ) .instructions("instructions") - .maxOutputTokens(0L) + .maxOutputTokensInf() .model(RealtimeSessionCreateResponse.Model.GPT_REALTIME) .addOutputModality(RealtimeSessionCreateResponse.OutputModality.TEXT) .prompt( diff --git a/openai-java-core/src/test/kotlin/com/openai/models/realtime/clientsecrets/RealtimeSessionCreateResponseTest.kt b/openai-java-core/src/test/kotlin/com/openai/models/realtime/clientsecrets/RealtimeSessionCreateResponseTest.kt index 3a8a5e20..93df00fd 100644 --- a/openai-java-core/src/test/kotlin/com/openai/models/realtime/clientsecrets/RealtimeSessionCreateResponseTest.kt +++ b/openai-java-core/src/test/kotlin/com/openai/models/realtime/clientsecrets/RealtimeSessionCreateResponseTest.kt @@ -80,7 +80,7 @@ internal class RealtimeSessionCreateResponseTest { RealtimeSessionCreateResponse.Include.ITEM_INPUT_AUDIO_TRANSCRIPTION_LOGPROBS ) .instructions("instructions") - .maxOutputTokens(0L) + .maxOutputTokensInf() .model(RealtimeSessionCreateResponse.Model.GPT_REALTIME) .addOutputModality(RealtimeSessionCreateResponse.OutputModality.TEXT) .prompt( @@ -165,7 +165,7 @@ internal class RealtimeSessionCreateResponseTest { ) assertThat(realtimeSessionCreateResponse.instructions()).contains("instructions") assertThat(realtimeSessionCreateResponse.maxOutputTokens()) - .contains(RealtimeSessionCreateResponse.MaxOutputTokens.ofInteger(0L)) + .contains(RealtimeSessionCreateResponse.MaxOutputTokens.ofInf()) assertThat(realtimeSessionCreateResponse.model()) .contains(RealtimeSessionCreateResponse.Model.GPT_REALTIME) assertThat(realtimeSessionCreateResponse.outputModalities().getOrNull()) @@ -266,7 +266,7 @@ internal class RealtimeSessionCreateResponseTest { RealtimeSessionCreateResponse.Include.ITEM_INPUT_AUDIO_TRANSCRIPTION_LOGPROBS ) .instructions("instructions") - .maxOutputTokens(0L) + .maxOutputTokensInf() .model(RealtimeSessionCreateResponse.Model.GPT_REALTIME) .addOutputModality(RealtimeSessionCreateResponse.OutputModality.TEXT) .prompt( 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 4770c2ce..ce3b0115 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 @@ -87,6 +87,7 @@ internal class ResponseContentTest { fun ofInputFile() { val inputFile = ResponseInputFile.builder() + .detail(ResponseInputFile.Detail.LOW) .fileData("file_data") .fileId("file_id") .fileUrl("file_url") @@ -109,6 +110,7 @@ internal class ResponseContentTest { val responseContent = ResponseContent.ofInputFile( ResponseInputFile.builder() + .detail(ResponseInputFile.Detail.LOW) .fileData("file_data") .fileId("file_id") .fileUrl("file_url") diff --git a/openai-java-core/src/test/kotlin/com/openai/models/responses/ResponseCreateParamsTest.kt b/openai-java-core/src/test/kotlin/com/openai/models/responses/ResponseCreateParamsTest.kt index f9cbf335..3e51b850 100644 --- a/openai-java-core/src/test/kotlin/com/openai/models/responses/ResponseCreateParamsTest.kt +++ b/openai-java-core/src/test/kotlin/com/openai/models/responses/ResponseCreateParamsTest.kt @@ -28,7 +28,7 @@ internal class ResponseCreateParamsTest { .addInclude(ResponseIncludable.FILE_SEARCH_CALL_RESULTS) .input("string") .instructions("instructions") - .maxOutputTokens(0L) + .maxOutputTokens(16L) .maxToolCalls(0L) .metadata( ResponseCreateParams.Metadata.builder() @@ -107,7 +107,7 @@ internal class ResponseCreateParamsTest { .addInclude(ResponseIncludable.FILE_SEARCH_CALL_RESULTS) .input("string") .instructions("instructions") - .maxOutputTokens(0L) + .maxOutputTokens(16L) .maxToolCalls(0L) .metadata( ResponseCreateParams.Metadata.builder() @@ -185,7 +185,7 @@ internal class ResponseCreateParamsTest { .containsExactly(ResponseIncludable.FILE_SEARCH_CALL_RESULTS) assertThat(body.input()).contains(ResponseCreateParams.Input.ofText("string")) assertThat(body.instructions()).contains("instructions") - assertThat(body.maxOutputTokens()).contains(0L) + assertThat(body.maxOutputTokens()).contains(16L) assertThat(body.maxToolCalls()).contains(0L) assertThat(body.metadata()) .contains( diff --git a/openai-java-core/src/test/kotlin/com/openai/models/responses/ResponseFunctionCallOutputItemTest.kt b/openai-java-core/src/test/kotlin/com/openai/models/responses/ResponseFunctionCallOutputItemTest.kt index 582bf794..c0bf0274 100644 --- a/openai-java-core/src/test/kotlin/com/openai/models/responses/ResponseFunctionCallOutputItemTest.kt +++ b/openai-java-core/src/test/kotlin/com/openai/models/responses/ResponseFunctionCallOutputItemTest.kt @@ -85,6 +85,7 @@ internal class ResponseFunctionCallOutputItemTest { fun ofInputFile() { val inputFile = ResponseInputFileContent.builder() + .detail(ResponseInputFileContent.Detail.LOW) .fileData("file_data") .fileId("file-123") .fileUrl("file_url") @@ -104,6 +105,7 @@ internal class ResponseFunctionCallOutputItemTest { val responseFunctionCallOutputItem = ResponseFunctionCallOutputItem.ofInputFile( ResponseInputFileContent.builder() + .detail(ResponseInputFileContent.Detail.LOW) .fileData("file_data") .fileId("file-123") .fileUrl("file_url") 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..e858d4ed 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 @@ -81,6 +81,7 @@ internal class ResponseInputContentTest { fun ofInputFile() { val inputFile = ResponseInputFile.builder() + .detail(ResponseInputFile.Detail.LOW) .fileData("file_data") .fileId("file_id") .fileUrl("file_url") @@ -100,6 +101,7 @@ internal class ResponseInputContentTest { val responseInputContent = ResponseInputContent.ofInputFile( ResponseInputFile.builder() + .detail(ResponseInputFile.Detail.LOW) .fileData("file_data") .fileId("file_id") .fileUrl("file_url") diff --git a/openai-java-core/src/test/kotlin/com/openai/models/responses/ResponseInputFileContentTest.kt b/openai-java-core/src/test/kotlin/com/openai/models/responses/ResponseInputFileContentTest.kt index 31922593..6da42f67 100644 --- a/openai-java-core/src/test/kotlin/com/openai/models/responses/ResponseInputFileContentTest.kt +++ b/openai-java-core/src/test/kotlin/com/openai/models/responses/ResponseInputFileContentTest.kt @@ -13,12 +13,14 @@ internal class ResponseInputFileContentTest { fun create() { val responseInputFileContent = ResponseInputFileContent.builder() + .detail(ResponseInputFileContent.Detail.LOW) .fileData("file_data") .fileId("file-123") .fileUrl("file_url") .filename("filename") .build() + assertThat(responseInputFileContent.detail()).contains(ResponseInputFileContent.Detail.LOW) assertThat(responseInputFileContent.fileData()).contains("file_data") assertThat(responseInputFileContent.fileId()).contains("file-123") assertThat(responseInputFileContent.fileUrl()).contains("file_url") @@ -30,6 +32,7 @@ internal class ResponseInputFileContentTest { val jsonMapper = jsonMapper() val responseInputFileContent = ResponseInputFileContent.builder() + .detail(ResponseInputFileContent.Detail.LOW) .fileData("file_data") .fileId("file-123") .fileUrl("file_url") diff --git a/openai-java-core/src/test/kotlin/com/openai/models/responses/ResponseInputFileTest.kt b/openai-java-core/src/test/kotlin/com/openai/models/responses/ResponseInputFileTest.kt index 873b251c..cdeb34f3 100644 --- a/openai-java-core/src/test/kotlin/com/openai/models/responses/ResponseInputFileTest.kt +++ b/openai-java-core/src/test/kotlin/com/openai/models/responses/ResponseInputFileTest.kt @@ -13,12 +13,14 @@ internal class ResponseInputFileTest { fun create() { val responseInputFile = ResponseInputFile.builder() + .detail(ResponseInputFile.Detail.LOW) .fileData("file_data") .fileId("file_id") .fileUrl("file_url") .filename("filename") .build() + assertThat(responseInputFile.detail()).contains(ResponseInputFile.Detail.LOW) assertThat(responseInputFile.fileData()).contains("file_data") assertThat(responseInputFile.fileId()).contains("file_id") assertThat(responseInputFile.fileUrl()).contains("file_url") @@ -30,6 +32,7 @@ internal class ResponseInputFileTest { val jsonMapper = jsonMapper() val responseInputFile = ResponseInputFile.builder() + .detail(ResponseInputFile.Detail.LOW) .fileData("file_data") .fileId("file_id") .fileUrl("file_url") diff --git a/openai-java-core/src/test/kotlin/com/openai/models/responses/ResponsesClientEventTest.kt b/openai-java-core/src/test/kotlin/com/openai/models/responses/ResponsesClientEventTest.kt index 81cf9b95..401b3c3a 100644 --- a/openai-java-core/src/test/kotlin/com/openai/models/responses/ResponsesClientEventTest.kt +++ b/openai-java-core/src/test/kotlin/com/openai/models/responses/ResponsesClientEventTest.kt @@ -31,7 +31,7 @@ internal class ResponsesClientEventTest { .addInclude(ResponseIncludable.FILE_SEARCH_CALL_RESULTS) .input("string") .instructions("instructions") - .maxOutputTokens(0L) + .maxOutputTokens(16L) .maxToolCalls(0L) .metadata( ResponsesClientEvent.Metadata.builder() @@ -110,7 +110,7 @@ internal class ResponsesClientEventTest { assertThat(responsesClientEvent.input()) .contains(ResponsesClientEvent.Input.ofText("string")) assertThat(responsesClientEvent.instructions()).contains("instructions") - assertThat(responsesClientEvent.maxOutputTokens()).contains(0L) + assertThat(responsesClientEvent.maxOutputTokens()).contains(16L) assertThat(responsesClientEvent.maxToolCalls()).contains(0L) assertThat(responsesClientEvent.metadata()) .contains( @@ -199,7 +199,7 @@ internal class ResponsesClientEventTest { .addInclude(ResponseIncludable.FILE_SEARCH_CALL_RESULTS) .input("string") .instructions("instructions") - .maxOutputTokens(0L) + .maxOutputTokens(16L) .maxToolCalls(0L) .metadata( ResponsesClientEvent.Metadata.builder() diff --git a/openai-java-core/src/test/kotlin/com/openai/models/responses/ToolTest.kt b/openai-java-core/src/test/kotlin/com/openai/models/responses/ToolTest.kt index 519ce566..43d86fd2 100644 --- a/openai-java-core/src/test/kotlin/com/openai/models/responses/ToolTest.kt +++ b/openai-java-core/src/test/kotlin/com/openai/models/responses/ToolTest.kt @@ -313,22 +313,7 @@ internal class ToolTest { .putAdditionalProperty("foo", JsonValue.from("string")) .build() ) - .requireApproval( - Tool.Mcp.RequireApproval.McpToolApprovalFilter.builder() - .always( - Tool.Mcp.RequireApproval.McpToolApprovalFilter.Always.builder() - .readOnly(true) - .addToolName("string") - .build() - ) - .never( - Tool.Mcp.RequireApproval.McpToolApprovalFilter.Never.builder() - .readOnly(true) - .addToolName("string") - .build() - ) - .build() - ) + .requireApproval(Tool.Mcp.RequireApproval.McpToolApprovalSetting.ALWAYS) .serverDescription("server_description") .serverUrl("server_url") .build() @@ -368,22 +353,7 @@ internal class ToolTest { .putAdditionalProperty("foo", JsonValue.from("string")) .build() ) - .requireApproval( - Tool.Mcp.RequireApproval.McpToolApprovalFilter.builder() - .always( - Tool.Mcp.RequireApproval.McpToolApprovalFilter.Always.builder() - .readOnly(true) - .addToolName("string") - .build() - ) - .never( - Tool.Mcp.RequireApproval.McpToolApprovalFilter.Never.builder() - .readOnly(true) - .addToolName("string") - .build() - ) - .build() - ) + .requireApproval(Tool.Mcp.RequireApproval.McpToolApprovalSetting.ALWAYS) .serverDescription("server_description") .serverUrl("server_url") .build() diff --git a/openai-java-core/src/test/kotlin/com/openai/services/ServiceParamsTest.kt b/openai-java-core/src/test/kotlin/com/openai/services/ServiceParamsTest.kt index 0c15e0a7..d7cef45a 100644 --- a/openai-java-core/src/test/kotlin/com/openai/services/ServiceParamsTest.kt +++ b/openai-java-core/src/test/kotlin/com/openai/services/ServiceParamsTest.kt @@ -62,7 +62,7 @@ internal class ServiceParamsTest { .audio( ChatCompletionAudioParam.builder() .format(ChatCompletionAudioParam.Format.WAV) - .voice("string") + .voice(ChatCompletionAudioParam.Voice.UnionMember1.ALLOY) .build() ) .frequencyPenalty(-2.0) diff --git a/openai-java-core/src/test/kotlin/com/openai/services/async/ResponseServiceAsyncTest.kt b/openai-java-core/src/test/kotlin/com/openai/services/async/ResponseServiceAsyncTest.kt index 817ad9d4..744d7c79 100644 --- a/openai-java-core/src/test/kotlin/com/openai/services/async/ResponseServiceAsyncTest.kt +++ b/openai-java-core/src/test/kotlin/com/openai/services/async/ResponseServiceAsyncTest.kt @@ -47,7 +47,7 @@ internal class ResponseServiceAsyncTest { .addInclude(ResponseIncludable.FILE_SEARCH_CALL_RESULTS) .input("string") .instructions("instructions") - .maxOutputTokens(0L) + .maxOutputTokens(16L) .maxToolCalls(0L) .metadata( ResponseCreateParams.Metadata.builder() @@ -141,7 +141,7 @@ internal class ResponseServiceAsyncTest { .addInclude(ResponseIncludable.FILE_SEARCH_CALL_RESULTS) .input("string") .instructions("instructions") - .maxOutputTokens(0L) + .maxOutputTokens(16L) .maxToolCalls(0L) .metadata( ResponseCreateParams.Metadata.builder() diff --git a/openai-java-core/src/test/kotlin/com/openai/services/async/audio/SpeechServiceAsyncTest.kt b/openai-java-core/src/test/kotlin/com/openai/services/async/audio/SpeechServiceAsyncTest.kt index 9454ef71..a8d6fa2b 100644 --- a/openai-java-core/src/test/kotlin/com/openai/services/async/audio/SpeechServiceAsyncTest.kt +++ b/openai-java-core/src/test/kotlin/com/openai/services/async/audio/SpeechServiceAsyncTest.kt @@ -37,7 +37,7 @@ internal class SpeechServiceAsyncTest { SpeechCreateParams.builder() .input("input") .model(SpeechModel.TTS_1) - .voice("string") + .voice(SpeechCreateParams.Voice.UnionMember1.ALLOY) .instructions("instructions") .responseFormat(SpeechCreateParams.ResponseFormat.MP3) .speed(0.25) diff --git a/openai-java-core/src/test/kotlin/com/openai/services/async/chat/ChatCompletionServiceAsyncTest.kt b/openai-java-core/src/test/kotlin/com/openai/services/async/chat/ChatCompletionServiceAsyncTest.kt index d18d959a..ecd8ec7c 100644 --- a/openai-java-core/src/test/kotlin/com/openai/services/async/chat/ChatCompletionServiceAsyncTest.kt +++ b/openai-java-core/src/test/kotlin/com/openai/services/async/chat/ChatCompletionServiceAsyncTest.kt @@ -46,7 +46,7 @@ internal class ChatCompletionServiceAsyncTest { .audio( ChatCompletionAudioParam.builder() .format(ChatCompletionAudioParam.Format.WAV) - .voice("string") + .voice(ChatCompletionAudioParam.Voice.UnionMember1.ALLOY) .build() ) .frequencyPenalty(-2.0) @@ -164,7 +164,7 @@ internal class ChatCompletionServiceAsyncTest { .audio( ChatCompletionAudioParam.builder() .format(ChatCompletionAudioParam.Format.WAV) - .voice("string") + .voice(ChatCompletionAudioParam.Voice.UnionMember1.ALLOY) .build() ) .frequencyPenalty(-2.0) diff --git a/openai-java-core/src/test/kotlin/com/openai/services/async/realtime/CallServiceAsyncTest.kt b/openai-java-core/src/test/kotlin/com/openai/services/async/realtime/CallServiceAsyncTest.kt index 79e92bb7..99774f04 100644 --- a/openai-java-core/src/test/kotlin/com/openai/services/async/realtime/CallServiceAsyncTest.kt +++ b/openai-java-core/src/test/kotlin/com/openai/services/async/realtime/CallServiceAsyncTest.kt @@ -88,7 +88,9 @@ internal class CallServiceAsyncTest { .build() ) .speed(0.25) - .voice("string") + .voice( + RealtimeAudioConfigOutput.Voice.UnionMember1.ALLOY + ) .build() ) .build() @@ -98,7 +100,7 @@ internal class CallServiceAsyncTest { .ITEM_INPUT_AUDIO_TRANSCRIPTION_LOGPROBS ) .instructions("instructions") - .maxOutputTokens(0L) + .maxOutputTokensInf() .model(RealtimeSessionCreateRequest.Model.GPT_REALTIME) .addOutputModality(RealtimeSessionCreateRequest.OutputModality.TEXT) .prompt( diff --git a/openai-java-core/src/test/kotlin/com/openai/services/async/realtime/ClientSecretServiceAsyncTest.kt b/openai-java-core/src/test/kotlin/com/openai/services/async/realtime/ClientSecretServiceAsyncTest.kt index df88d109..cdd85394 100644 --- a/openai-java-core/src/test/kotlin/com/openai/services/async/realtime/ClientSecretServiceAsyncTest.kt +++ b/openai-java-core/src/test/kotlin/com/openai/services/async/realtime/ClientSecretServiceAsyncTest.kt @@ -91,7 +91,9 @@ internal class ClientSecretServiceAsyncTest { .build() ) .speed(0.25) - .voice("string") + .voice( + RealtimeAudioConfigOutput.Voice.UnionMember1.ALLOY + ) .build() ) .build() @@ -101,7 +103,7 @@ internal class ClientSecretServiceAsyncTest { .ITEM_INPUT_AUDIO_TRANSCRIPTION_LOGPROBS ) .instructions("instructions") - .maxOutputTokens(0L) + .maxOutputTokensInf() .model(RealtimeSessionCreateRequest.Model.GPT_REALTIME) .addOutputModality(RealtimeSessionCreateRequest.OutputModality.TEXT) .prompt( diff --git a/openai-java-core/src/test/kotlin/com/openai/services/blocking/ResponseServiceTest.kt b/openai-java-core/src/test/kotlin/com/openai/services/blocking/ResponseServiceTest.kt index cda4d0c1..aa1c9b5f 100644 --- a/openai-java-core/src/test/kotlin/com/openai/services/blocking/ResponseServiceTest.kt +++ b/openai-java-core/src/test/kotlin/com/openai/services/blocking/ResponseServiceTest.kt @@ -47,7 +47,7 @@ internal class ResponseServiceTest { .addInclude(ResponseIncludable.FILE_SEARCH_CALL_RESULTS) .input("string") .instructions("instructions") - .maxOutputTokens(0L) + .maxOutputTokens(16L) .maxToolCalls(0L) .metadata( ResponseCreateParams.Metadata.builder() @@ -140,7 +140,7 @@ internal class ResponseServiceTest { .addInclude(ResponseIncludable.FILE_SEARCH_CALL_RESULTS) .input("string") .instructions("instructions") - .maxOutputTokens(0L) + .maxOutputTokens(16L) .maxToolCalls(0L) .metadata( ResponseCreateParams.Metadata.builder() diff --git a/openai-java-core/src/test/kotlin/com/openai/services/blocking/audio/SpeechServiceTest.kt b/openai-java-core/src/test/kotlin/com/openai/services/blocking/audio/SpeechServiceTest.kt index 0fdfa992..d7ef8db1 100644 --- a/openai-java-core/src/test/kotlin/com/openai/services/blocking/audio/SpeechServiceTest.kt +++ b/openai-java-core/src/test/kotlin/com/openai/services/blocking/audio/SpeechServiceTest.kt @@ -37,7 +37,7 @@ internal class SpeechServiceTest { SpeechCreateParams.builder() .input("input") .model(SpeechModel.TTS_1) - .voice("string") + .voice(SpeechCreateParams.Voice.UnionMember1.ALLOY) .instructions("instructions") .responseFormat(SpeechCreateParams.ResponseFormat.MP3) .speed(0.25) diff --git a/openai-java-core/src/test/kotlin/com/openai/services/blocking/chat/ChatCompletionServiceTest.kt b/openai-java-core/src/test/kotlin/com/openai/services/blocking/chat/ChatCompletionServiceTest.kt index dc09ebe0..ca42dc44 100644 --- a/openai-java-core/src/test/kotlin/com/openai/services/blocking/chat/ChatCompletionServiceTest.kt +++ b/openai-java-core/src/test/kotlin/com/openai/services/blocking/chat/ChatCompletionServiceTest.kt @@ -46,7 +46,7 @@ internal class ChatCompletionServiceTest { .audio( ChatCompletionAudioParam.builder() .format(ChatCompletionAudioParam.Format.WAV) - .voice("string") + .voice(ChatCompletionAudioParam.Voice.UnionMember1.ALLOY) .build() ) .frequencyPenalty(-2.0) @@ -163,7 +163,7 @@ internal class ChatCompletionServiceTest { .audio( ChatCompletionAudioParam.builder() .format(ChatCompletionAudioParam.Format.WAV) - .voice("string") + .voice(ChatCompletionAudioParam.Voice.UnionMember1.ALLOY) .build() ) .frequencyPenalty(-2.0) diff --git a/openai-java-core/src/test/kotlin/com/openai/services/blocking/realtime/CallServiceTest.kt b/openai-java-core/src/test/kotlin/com/openai/services/blocking/realtime/CallServiceTest.kt index b31777b2..d129758c 100644 --- a/openai-java-core/src/test/kotlin/com/openai/services/blocking/realtime/CallServiceTest.kt +++ b/openai-java-core/src/test/kotlin/com/openai/services/blocking/realtime/CallServiceTest.kt @@ -83,7 +83,7 @@ internal class CallServiceTest { .build() ) .speed(0.25) - .voice("string") + .voice(RealtimeAudioConfigOutput.Voice.UnionMember1.ALLOY) .build() ) .build() @@ -93,7 +93,7 @@ internal class CallServiceTest { .ITEM_INPUT_AUDIO_TRANSCRIPTION_LOGPROBS ) .instructions("instructions") - .maxOutputTokens(0L) + .maxOutputTokensInf() .model(RealtimeSessionCreateRequest.Model.GPT_REALTIME) .addOutputModality(RealtimeSessionCreateRequest.OutputModality.TEXT) .prompt( diff --git a/openai-java-core/src/test/kotlin/com/openai/services/blocking/realtime/ClientSecretServiceTest.kt b/openai-java-core/src/test/kotlin/com/openai/services/blocking/realtime/ClientSecretServiceTest.kt index e515ef71..014f2683 100644 --- a/openai-java-core/src/test/kotlin/com/openai/services/blocking/realtime/ClientSecretServiceTest.kt +++ b/openai-java-core/src/test/kotlin/com/openai/services/blocking/realtime/ClientSecretServiceTest.kt @@ -91,7 +91,9 @@ internal class ClientSecretServiceTest { .build() ) .speed(0.25) - .voice("string") + .voice( + RealtimeAudioConfigOutput.Voice.UnionMember1.ALLOY + ) .build() ) .build() @@ -101,7 +103,7 @@ internal class ClientSecretServiceTest { .ITEM_INPUT_AUDIO_TRANSCRIPTION_LOGPROBS ) .instructions("instructions") - .maxOutputTokens(0L) + .maxOutputTokensInf() .model(RealtimeSessionCreateRequest.Model.GPT_REALTIME) .addOutputModality(RealtimeSessionCreateRequest.OutputModality.TEXT) .prompt(