diff --git a/.release-please-manifest.json b/.release-please-manifest.json
index 90eeef65..7c37fb19 100644
--- a/.release-please-manifest.json
+++ b/.release-please-manifest.json
@@ -1,3 +1,3 @@
{
- ".": "4.8.0"
+ ".": "4.8.1"
}
\ No newline at end of file
diff --git a/.stats.yml b/.stats.yml
index 38f260dd..d15659c7 100644
--- a/.stats.yml
+++ b/.stats.yml
@@ -1,4 +1,4 @@
configured_endpoints: 135
-openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/openai%2Fopenai-ca24bc4d8125b5153514ce643c4e3220f25971b7d67ca384d56d493c72c0d977.yml
-openapi_spec_hash: c6f048c7b3d29f4de48fde0e845ba33f
+openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/openai%2Fopenai-a7e92d12ebe89ca019a7ac5b29759064eefa2c38fe08d03516f2620e66abb32b.yml
+openapi_spec_hash: acbc703b2739447abc6312b2d753631c
config_hash: b876221dfb213df9f0a999e75d38a65e
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 4203879a..2c5b668a 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,5 +1,13 @@
# Changelog
+## 4.8.1 (2025-11-21)
+
+Full Changelog: [v4.8.0...v4.8.1](https://github.com/openai/openai-java/compare/v4.8.0...v4.8.1)
+
+### Bug Fixes
+
+* **api:** align types of input items / output items for typescript ([9202c69](https://github.com/openai/openai-java/commit/9202c695d939def7c9598e9ee75999b8ebd87e32))
+
## 4.8.0 (2025-11-13)
Full Changelog: [v4.7.2...v4.8.0](https://github.com/openai/openai-java/compare/v4.7.2...v4.8.0)
diff --git a/README.md b/README.md
index e8a28b7d..e7052487 100644
--- a/README.md
+++ b/README.md
@@ -2,8 +2,8 @@
-[](https://central.sonatype.com/artifact/com.openai/openai-java/4.8.0)
-[](https://javadoc.io/doc/com.openai/openai-java/4.8.0)
+[](https://central.sonatype.com/artifact/com.openai/openai-java/4.8.1)
+[](https://javadoc.io/doc/com.openai/openai-java/4.8.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/4.8.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.8.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:4.8.0")
+implementation("com.openai:openai-java:4.8.1")
```
### Maven
@@ -33,7 +33,7 @@ implementation("com.openai:openai-java:4.8.0")
com.openai
openai-java
- 4.8.0
+ 4.8.1
```
@@ -1342,7 +1342,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.8.0")
+implementation("com.openai:openai-java-spring-boot-starter:4.8.1")
```
#### Maven
@@ -1351,7 +1351,7 @@ implementation("com.openai:openai-java-spring-boot-starter:4.8.0")
com.openai
openai-java-spring-boot-starter
- 4.8.0
+ 4.8.1
```
diff --git a/build.gradle.kts b/build.gradle.kts
index 6ec56e42..fab5c017 100644
--- a/build.gradle.kts
+++ b/build.gradle.kts
@@ -8,7 +8,7 @@ repositories {
allprojects {
group = "com.openai"
- version = "4.8.0" // x-release-please-version
+ version = "4.8.1" // x-release-please-version
}
subprojects {
diff --git a/openai-java-core/src/main/kotlin/com/openai/models/responses/ResponseApplyPatchToolCall.kt b/openai-java-core/src/main/kotlin/com/openai/models/responses/ResponseApplyPatchToolCall.kt
index bf3e8167..b406fb42 100644
--- a/openai-java-core/src/main/kotlin/com/openai/models/responses/ResponseApplyPatchToolCall.kt
+++ b/openai-java-core/src/main/kotlin/com/openai/models/responses/ResponseApplyPatchToolCall.kt
@@ -34,10 +34,10 @@ class ResponseApplyPatchToolCall
private constructor(
private val id: JsonField,
private val callId: JsonField,
+ private val operation: JsonField,
private val status: JsonField,
private val type: JsonValue,
private val createdBy: JsonField,
- private val operation: JsonField,
private val additionalProperties: MutableMap,
) {
@@ -45,13 +45,13 @@ private constructor(
private constructor(
@JsonProperty("id") @ExcludeMissing id: JsonField = JsonMissing.of(),
@JsonProperty("call_id") @ExcludeMissing callId: JsonField = JsonMissing.of(),
- @JsonProperty("status") @ExcludeMissing status: JsonField = JsonMissing.of(),
- @JsonProperty("type") @ExcludeMissing type: JsonValue = JsonMissing.of(),
- @JsonProperty("created_by") @ExcludeMissing createdBy: JsonField = JsonMissing.of(),
@JsonProperty("operation")
@ExcludeMissing
operation: JsonField = JsonMissing.of(),
- ) : this(id, callId, status, type, createdBy, operation, mutableMapOf())
+ @JsonProperty("status") @ExcludeMissing status: JsonField = JsonMissing.of(),
+ @JsonProperty("type") @ExcludeMissing type: JsonValue = JsonMissing.of(),
+ @JsonProperty("created_by") @ExcludeMissing createdBy: JsonField = JsonMissing.of(),
+ ) : this(id, callId, operation, status, type, createdBy, mutableMapOf())
/**
* The unique ID of the apply patch tool call. Populated when this item is returned via API.
@@ -69,6 +69,14 @@ private constructor(
*/
fun callId(): String = callId.getRequired("call_id")
+ /**
+ * One of the create_file, delete_file, or update_file operations applied via apply_patch.
+ *
+ * @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 operation(): Operation = operation.getRequired("operation")
+
/**
* The status of the apply patch tool call. One of `in_progress` or `completed`.
*
@@ -98,14 +106,6 @@ private constructor(
*/
fun createdBy(): Optional = createdBy.getOptional("created_by")
- /**
- * One of the create_file, delete_file, or update_file operations applied via apply_patch.
- *
- * @throws OpenAIInvalidDataException if the JSON field has an unexpected type (e.g. if the
- * server responded with an unexpected value).
- */
- fun operation(): Optional = operation.getOptional("operation")
-
/**
* Returns the raw JSON value of [id].
*
@@ -120,6 +120,13 @@ private constructor(
*/
@JsonProperty("call_id") @ExcludeMissing fun _callId(): JsonField = callId
+ /**
+ * Returns the raw JSON value of [operation].
+ *
+ * Unlike [operation], this method doesn't throw if the JSON field has an unexpected type.
+ */
+ @JsonProperty("operation") @ExcludeMissing fun _operation(): JsonField = operation
+
/**
* Returns the raw JSON value of [status].
*
@@ -134,13 +141,6 @@ private constructor(
*/
@JsonProperty("created_by") @ExcludeMissing fun _createdBy(): JsonField = createdBy
- /**
- * Returns the raw JSON value of [operation].
- *
- * Unlike [operation], this method doesn't throw if the JSON field has an unexpected type.
- */
- @JsonProperty("operation") @ExcludeMissing fun _operation(): JsonField = operation
-
@JsonAnySetter
private fun putAdditionalProperty(key: String, value: JsonValue) {
additionalProperties.put(key, value)
@@ -162,6 +162,7 @@ private constructor(
* ```java
* .id()
* .callId()
+ * .operation()
* .status()
* ```
*/
@@ -173,20 +174,20 @@ private constructor(
private var id: JsonField? = null
private var callId: JsonField? = null
+ private var operation: JsonField? = null
private var status: JsonField? = null
private var type: JsonValue = JsonValue.from("apply_patch_call")
private var createdBy: JsonField = JsonMissing.of()
- private var operation: JsonField = JsonMissing.of()
private var additionalProperties: MutableMap = mutableMapOf()
@JvmSynthetic
internal fun from(responseApplyPatchToolCall: ResponseApplyPatchToolCall) = apply {
id = responseApplyPatchToolCall.id
callId = responseApplyPatchToolCall.callId
+ operation = responseApplyPatchToolCall.operation
status = responseApplyPatchToolCall.status
type = responseApplyPatchToolCall.type
createdBy = responseApplyPatchToolCall.createdBy
- operation = responseApplyPatchToolCall.operation
additionalProperties = responseApplyPatchToolCall.additionalProperties.toMutableMap()
}
@@ -214,43 +215,6 @@ private constructor(
*/
fun callId(callId: JsonField) = apply { this.callId = callId }
- /** The status of the apply patch tool call. One of `in_progress` or `completed`. */
- fun status(status: Status) = status(JsonField.of(status))
-
- /**
- * Sets [Builder.status] to an arbitrary JSON value.
- *
- * You should usually call [Builder.status] with a well-typed [Status] value instead. This
- * method is primarily for setting the field to an undocumented or not yet supported value.
- */
- fun status(status: JsonField) = apply { this.status = status }
-
- /**
- * Sets the field to an arbitrary JSON value.
- *
- * It is usually unnecessary to call this method because the field defaults to the
- * following:
- * ```java
- * JsonValue.from("apply_patch_call")
- * ```
- *
- * This method is primarily for setting the field to an undocumented or not yet supported
- * value.
- */
- fun type(type: JsonValue) = apply { this.type = type }
-
- /** The ID of the entity that created this tool call. */
- fun createdBy(createdBy: String) = createdBy(JsonField.of(createdBy))
-
- /**
- * Sets [Builder.createdBy] to an arbitrary JSON value.
- *
- * You should usually call [Builder.createdBy] with a well-typed [String] value instead.
- * This method is primarily for setting the field to an undocumented or not yet supported
- * value.
- */
- fun createdBy(createdBy: JsonField) = apply { this.createdBy = createdBy }
-
/**
* One of the create_file, delete_file, or update_file operations applied via apply_patch.
*/
@@ -288,6 +252,43 @@ private constructor(
fun operation(updateFile: Operation.UpdateFile) =
operation(Operation.ofUpdateFile(updateFile))
+ /** The status of the apply patch tool call. One of `in_progress` or `completed`. */
+ fun status(status: Status) = status(JsonField.of(status))
+
+ /**
+ * Sets [Builder.status] to an arbitrary JSON value.
+ *
+ * You should usually call [Builder.status] with a well-typed [Status] value instead. This
+ * method is primarily for setting the field to an undocumented or not yet supported value.
+ */
+ fun status(status: JsonField) = apply { this.status = status }
+
+ /**
+ * Sets the field to an arbitrary JSON value.
+ *
+ * It is usually unnecessary to call this method because the field defaults to the
+ * following:
+ * ```java
+ * JsonValue.from("apply_patch_call")
+ * ```
+ *
+ * This method is primarily for setting the field to an undocumented or not yet supported
+ * value.
+ */
+ fun type(type: JsonValue) = apply { this.type = type }
+
+ /** The ID of the entity that created this tool call. */
+ fun createdBy(createdBy: String) = createdBy(JsonField.of(createdBy))
+
+ /**
+ * Sets [Builder.createdBy] to an arbitrary JSON value.
+ *
+ * You should usually call [Builder.createdBy] with a well-typed [String] value instead.
+ * This method is primarily for setting the field to an undocumented or not yet supported
+ * value.
+ */
+ fun createdBy(createdBy: JsonField) = apply { this.createdBy = createdBy }
+
fun additionalProperties(additionalProperties: Map) = apply {
this.additionalProperties.clear()
putAllAdditionalProperties(additionalProperties)
@@ -316,6 +317,7 @@ private constructor(
* ```java
* .id()
* .callId()
+ * .operation()
* .status()
* ```
*
@@ -325,10 +327,10 @@ private constructor(
ResponseApplyPatchToolCall(
checkRequired("id", id),
checkRequired("callId", callId),
+ checkRequired("operation", operation),
checkRequired("status", status),
type,
createdBy,
- operation,
additionalProperties.toMutableMap(),
)
}
@@ -342,6 +344,7 @@ private constructor(
id()
callId()
+ operation().validate()
status().validate()
_type().let {
if (it != JsonValue.from("apply_patch_call")) {
@@ -349,7 +352,6 @@ private constructor(
}
}
createdBy()
- operation().ifPresent { it.validate() }
validated = true
}
@@ -370,136 +372,10 @@ private constructor(
internal fun validity(): Int =
(if (id.asKnown().isPresent) 1 else 0) +
(if (callId.asKnown().isPresent) 1 else 0) +
+ (operation.asKnown().getOrNull()?.validity() ?: 0) +
(status.asKnown().getOrNull()?.validity() ?: 0) +
type.let { if (it == JsonValue.from("apply_patch_call")) 1 else 0 } +
- (if (createdBy.asKnown().isPresent) 1 else 0) +
- (operation.asKnown().getOrNull()?.validity() ?: 0)
-
- /** The status of the apply patch tool call. One of `in_progress` or `completed`. */
- class Status @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 IN_PROGRESS = of("in_progress")
-
- @JvmField val COMPLETED = of("completed")
-
- @JvmStatic fun of(value: String) = Status(JsonField.of(value))
- }
-
- /** An enum containing [Status]'s known values. */
- enum class Known {
- IN_PROGRESS,
- COMPLETED,
- }
-
- /**
- * An enum containing [Status]'s known values, as well as an [_UNKNOWN] member.
- *
- * An instance of [Status] 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 {
- IN_PROGRESS,
- COMPLETED,
- /** An enum member indicating that [Status] 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) {
- IN_PROGRESS -> Value.IN_PROGRESS
- COMPLETED -> Value.COMPLETED
- 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) {
- IN_PROGRESS -> Known.IN_PROGRESS
- COMPLETED -> Known.COMPLETED
- else -> throw OpenAIInvalidDataException("Unknown Status: $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(): Status = 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 Status && value == other.value
- }
-
- override fun hashCode() = value.hashCode()
-
- override fun toString() = value.toString()
- }
+ (if (createdBy.asKnown().isPresent) 1 else 0)
/** One of the create_file, delete_file, or update_file operations applied via apply_patch. */
@JsonDeserialize(using = Operation.Deserializer::class)
@@ -1403,6 +1279,132 @@ private constructor(
}
}
+ /** The status of the apply patch tool call. One of `in_progress` or `completed`. */
+ class Status @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 IN_PROGRESS = of("in_progress")
+
+ @JvmField val COMPLETED = of("completed")
+
+ @JvmStatic fun of(value: String) = Status(JsonField.of(value))
+ }
+
+ /** An enum containing [Status]'s known values. */
+ enum class Known {
+ IN_PROGRESS,
+ COMPLETED,
+ }
+
+ /**
+ * An enum containing [Status]'s known values, as well as an [_UNKNOWN] member.
+ *
+ * An instance of [Status] 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 {
+ IN_PROGRESS,
+ COMPLETED,
+ /** An enum member indicating that [Status] 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) {
+ IN_PROGRESS -> Value.IN_PROGRESS
+ COMPLETED -> Value.COMPLETED
+ 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) {
+ IN_PROGRESS -> Known.IN_PROGRESS
+ COMPLETED -> Known.COMPLETED
+ else -> throw OpenAIInvalidDataException("Unknown Status: $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(): Status = 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 Status && value == other.value
+ }
+
+ override fun hashCode() = value.hashCode()
+
+ override fun toString() = value.toString()
+ }
+
override fun equals(other: Any?): Boolean {
if (this === other) {
return true
@@ -1411,19 +1413,19 @@ private constructor(
return other is ResponseApplyPatchToolCall &&
id == other.id &&
callId == other.callId &&
+ operation == other.operation &&
status == other.status &&
type == other.type &&
createdBy == other.createdBy &&
- operation == other.operation &&
additionalProperties == other.additionalProperties
}
private val hashCode: Int by lazy {
- Objects.hash(id, callId, status, type, createdBy, operation, additionalProperties)
+ Objects.hash(id, callId, operation, status, type, createdBy, additionalProperties)
}
override fun hashCode(): Int = hashCode
override fun toString() =
- "ResponseApplyPatchToolCall{id=$id, callId=$callId, status=$status, type=$type, createdBy=$createdBy, operation=$operation, additionalProperties=$additionalProperties}"
+ "ResponseApplyPatchToolCall{id=$id, callId=$callId, operation=$operation, status=$status, type=$type, createdBy=$createdBy, additionalProperties=$additionalProperties}"
}
diff --git a/openai-java-core/src/main/kotlin/com/openai/models/responses/ResponseApplyPatchToolCallOutput.kt b/openai-java-core/src/main/kotlin/com/openai/models/responses/ResponseApplyPatchToolCallOutput.kt
index 0956f691..86d82ee4 100644
--- a/openai-java-core/src/main/kotlin/com/openai/models/responses/ResponseApplyPatchToolCallOutput.kt
+++ b/openai-java-core/src/main/kotlin/com/openai/models/responses/ResponseApplyPatchToolCallOutput.kt
@@ -24,10 +24,10 @@ class ResponseApplyPatchToolCallOutput
private constructor(
private val id: JsonField,
private val callId: JsonField,
- private val output: JsonField,
private val status: JsonField,
private val type: JsonValue,
private val createdBy: JsonField,
+ private val output: JsonField,
private val additionalProperties: MutableMap,
) {
@@ -35,11 +35,11 @@ private constructor(
private constructor(
@JsonProperty("id") @ExcludeMissing id: JsonField = JsonMissing.of(),
@JsonProperty("call_id") @ExcludeMissing callId: JsonField = JsonMissing.of(),
- @JsonProperty("output") @ExcludeMissing output: JsonField = JsonMissing.of(),
@JsonProperty("status") @ExcludeMissing status: JsonField = JsonMissing.of(),
@JsonProperty("type") @ExcludeMissing type: JsonValue = JsonMissing.of(),
@JsonProperty("created_by") @ExcludeMissing createdBy: JsonField = JsonMissing.of(),
- ) : this(id, callId, output, status, type, createdBy, mutableMapOf())
+ @JsonProperty("output") @ExcludeMissing output: JsonField = JsonMissing.of(),
+ ) : this(id, callId, status, type, createdBy, output, mutableMapOf())
/**
* The unique ID of the apply patch tool call output. Populated when this item is returned via
@@ -58,14 +58,6 @@ private constructor(
*/
fun callId(): String = callId.getRequired("call_id")
- /**
- * Optional textual output returned by the apply patch tool.
- *
- * @throws OpenAIInvalidDataException if the JSON field has an unexpected type (e.g. if the
- * server responded with an unexpected value).
- */
- fun output(): Optional = output.getOptional("output")
-
/**
* The status of the apply patch tool call output. One of `completed` or `failed`.
*
@@ -95,6 +87,14 @@ private constructor(
*/
fun createdBy(): Optional = createdBy.getOptional("created_by")
+ /**
+ * Optional textual output returned by the apply patch tool.
+ *
+ * @throws OpenAIInvalidDataException if the JSON field has an unexpected type (e.g. if the
+ * server responded with an unexpected value).
+ */
+ fun output(): Optional = output.getOptional("output")
+
/**
* Returns the raw JSON value of [id].
*
@@ -109,13 +109,6 @@ private constructor(
*/
@JsonProperty("call_id") @ExcludeMissing fun _callId(): JsonField = callId
- /**
- * Returns the raw JSON value of [output].
- *
- * Unlike [output], this method doesn't throw if the JSON field has an unexpected type.
- */
- @JsonProperty("output") @ExcludeMissing fun _output(): JsonField = output
-
/**
* Returns the raw JSON value of [status].
*
@@ -130,6 +123,13 @@ private constructor(
*/
@JsonProperty("created_by") @ExcludeMissing fun _createdBy(): JsonField = createdBy
+ /**
+ * Returns the raw JSON value of [output].
+ *
+ * Unlike [output], this method doesn't throw if the JSON field has an unexpected type.
+ */
+ @JsonProperty("output") @ExcludeMissing fun _output(): JsonField = output
+
@JsonAnySetter
private fun putAdditionalProperty(key: String, value: JsonValue) {
additionalProperties.put(key, value)
@@ -152,7 +152,6 @@ private constructor(
* ```java
* .id()
* .callId()
- * .output()
* .status()
* ```
*/
@@ -164,10 +163,10 @@ private constructor(
private var id: JsonField? = null
private var callId: JsonField? = null
- private var output: JsonField? = null
private var status: JsonField? = null
private var type: JsonValue = JsonValue.from("apply_patch_call_output")
private var createdBy: JsonField = JsonMissing.of()
+ private var output: JsonField = JsonMissing.of()
private var additionalProperties: MutableMap = mutableMapOf()
@JvmSynthetic
@@ -175,10 +174,10 @@ private constructor(
apply {
id = responseApplyPatchToolCallOutput.id
callId = responseApplyPatchToolCallOutput.callId
- output = responseApplyPatchToolCallOutput.output
status = responseApplyPatchToolCallOutput.status
type = responseApplyPatchToolCallOutput.type
createdBy = responseApplyPatchToolCallOutput.createdBy
+ output = responseApplyPatchToolCallOutput.output
additionalProperties =
responseApplyPatchToolCallOutput.additionalProperties.toMutableMap()
}
@@ -208,20 +207,6 @@ private constructor(
*/
fun callId(callId: JsonField) = apply { this.callId = callId }
- /** Optional textual output returned by the apply patch tool. */
- fun output(output: String?) = output(JsonField.ofNullable(output))
-
- /** Alias for calling [Builder.output] with `output.orElse(null)`. */
- fun output(output: Optional) = output(output.getOrNull())
-
- /**
- * Sets [Builder.output] to an arbitrary JSON value.
- *
- * You should usually call [Builder.output] with a well-typed [String] value instead. This
- * method is primarily for setting the field to an undocumented or not yet supported value.
- */
- fun output(output: JsonField) = apply { this.output = output }
-
/** The status of the apply patch tool call output. One of `completed` or `failed`. */
fun status(status: Status) = status(JsonField.of(status))
@@ -259,6 +244,20 @@ private constructor(
*/
fun createdBy(createdBy: JsonField) = apply { this.createdBy = createdBy }
+ /** Optional textual output returned by the apply patch tool. */
+ fun output(output: String?) = output(JsonField.ofNullable(output))
+
+ /** Alias for calling [Builder.output] with `output.orElse(null)`. */
+ fun output(output: Optional) = output(output.getOrNull())
+
+ /**
+ * Sets [Builder.output] to an arbitrary JSON value.
+ *
+ * You should usually call [Builder.output] with a well-typed [String] value instead. This
+ * method is primarily for setting the field to an undocumented or not yet supported value.
+ */
+ fun output(output: JsonField) = apply { this.output = output }
+
fun additionalProperties(additionalProperties: Map) = apply {
this.additionalProperties.clear()
putAllAdditionalProperties(additionalProperties)
@@ -287,7 +286,6 @@ private constructor(
* ```java
* .id()
* .callId()
- * .output()
* .status()
* ```
*
@@ -297,10 +295,10 @@ private constructor(
ResponseApplyPatchToolCallOutput(
checkRequired("id", id),
checkRequired("callId", callId),
- checkRequired("output", output),
checkRequired("status", status),
type,
createdBy,
+ output,
additionalProperties.toMutableMap(),
)
}
@@ -314,7 +312,6 @@ private constructor(
id()
callId()
- output()
status().validate()
_type().let {
if (it != JsonValue.from("apply_patch_call_output")) {
@@ -322,6 +319,7 @@ private constructor(
}
}
createdBy()
+ output()
validated = true
}
@@ -342,10 +340,10 @@ private constructor(
internal fun validity(): Int =
(if (id.asKnown().isPresent) 1 else 0) +
(if (callId.asKnown().isPresent) 1 else 0) +
- (if (output.asKnown().isPresent) 1 else 0) +
(status.asKnown().getOrNull()?.validity() ?: 0) +
type.let { if (it == JsonValue.from("apply_patch_call_output")) 1 else 0 } +
- (if (createdBy.asKnown().isPresent) 1 else 0)
+ (if (createdBy.asKnown().isPresent) 1 else 0) +
+ (if (output.asKnown().isPresent) 1 else 0)
/** The status of the apply patch tool call output. One of `completed` or `failed`. */
class Status @JsonCreator private constructor(private val value: JsonField) : Enum {
@@ -481,19 +479,19 @@ private constructor(
return other is ResponseApplyPatchToolCallOutput &&
id == other.id &&
callId == other.callId &&
- output == other.output &&
status == other.status &&
type == other.type &&
createdBy == other.createdBy &&
+ output == other.output &&
additionalProperties == other.additionalProperties
}
private val hashCode: Int by lazy {
- Objects.hash(id, callId, output, status, type, createdBy, additionalProperties)
+ Objects.hash(id, callId, status, type, createdBy, output, additionalProperties)
}
override fun hashCode(): Int = hashCode
override fun toString() =
- "ResponseApplyPatchToolCallOutput{id=$id, callId=$callId, output=$output, status=$status, type=$type, createdBy=$createdBy, additionalProperties=$additionalProperties}"
+ "ResponseApplyPatchToolCallOutput{id=$id, callId=$callId, status=$status, type=$type, createdBy=$createdBy, output=$output, additionalProperties=$additionalProperties}"
}
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 aed22f62..f389252a 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
@@ -7908,7 +7908,10 @@ private constructor(
* Optional human-readable log text from the apply patch tool (e.g., patch results or
* errors).
*/
- fun output(output: String) = output(JsonField.of(output))
+ fun output(output: String?) = output(JsonField.ofNullable(output))
+
+ /** Alias for calling [Builder.output] with `output.orElse(null)`. */
+ fun output(output: Optional) = output(output.getOrNull())
/**
* Sets [Builder.output] to an arbitrary JSON value.
diff --git a/openai-java-core/src/test/kotlin/com/openai/models/conversations/items/ConversationItemTest.kt b/openai-java-core/src/test/kotlin/com/openai/models/conversations/items/ConversationItemTest.kt
index eb907c49..8e4bc785 100644
--- a/openai-java-core/src/test/kotlin/com/openai/models/conversations/items/ConversationItemTest.kt
+++ b/openai-java-core/src/test/kotlin/com/openai/models/conversations/items/ConversationItemTest.kt
@@ -997,14 +997,14 @@ internal class ConversationItemTest {
ResponseApplyPatchToolCall.builder()
.id("id")
.callId("call_id")
- .status(ResponseApplyPatchToolCall.Status.IN_PROGRESS)
- .createdBy("created_by")
.operation(
ResponseApplyPatchToolCall.Operation.CreateFile.builder()
.diff("diff")
.path("path")
.build()
)
+ .status(ResponseApplyPatchToolCall.Status.IN_PROGRESS)
+ .createdBy("created_by")
.build()
val conversationItem = ConversationItem.ofApplyPatchCall(applyPatchCall)
@@ -1041,14 +1041,14 @@ internal class ConversationItemTest {
ResponseApplyPatchToolCall.builder()
.id("id")
.callId("call_id")
- .status(ResponseApplyPatchToolCall.Status.IN_PROGRESS)
- .createdBy("created_by")
.operation(
ResponseApplyPatchToolCall.Operation.CreateFile.builder()
.diff("diff")
.path("path")
.build()
)
+ .status(ResponseApplyPatchToolCall.Status.IN_PROGRESS)
+ .createdBy("created_by")
.build()
)
@@ -1067,9 +1067,9 @@ internal class ConversationItemTest {
ResponseApplyPatchToolCallOutput.builder()
.id("id")
.callId("call_id")
- .output("output")
.status(ResponseApplyPatchToolCallOutput.Status.COMPLETED)
.createdBy("created_by")
+ .output("output")
.build()
val conversationItem = ConversationItem.ofApplyPatchCallOutput(applyPatchCallOutput)
@@ -1106,9 +1106,9 @@ internal class ConversationItemTest {
ResponseApplyPatchToolCallOutput.builder()
.id("id")
.callId("call_id")
- .output("output")
.status(ResponseApplyPatchToolCallOutput.Status.COMPLETED)
.createdBy("created_by")
+ .output("output")
.build()
)
diff --git a/openai-java-core/src/test/kotlin/com/openai/models/responses/ResponseApplyPatchToolCallOutputTest.kt b/openai-java-core/src/test/kotlin/com/openai/models/responses/ResponseApplyPatchToolCallOutputTest.kt
index 55e4a9f6..069e965f 100644
--- a/openai-java-core/src/test/kotlin/com/openai/models/responses/ResponseApplyPatchToolCallOutputTest.kt
+++ b/openai-java-core/src/test/kotlin/com/openai/models/responses/ResponseApplyPatchToolCallOutputTest.kt
@@ -15,17 +15,17 @@ internal class ResponseApplyPatchToolCallOutputTest {
ResponseApplyPatchToolCallOutput.builder()
.id("id")
.callId("call_id")
- .output("output")
.status(ResponseApplyPatchToolCallOutput.Status.COMPLETED)
.createdBy("created_by")
+ .output("output")
.build()
assertThat(responseApplyPatchToolCallOutput.id()).isEqualTo("id")
assertThat(responseApplyPatchToolCallOutput.callId()).isEqualTo("call_id")
- assertThat(responseApplyPatchToolCallOutput.output()).contains("output")
assertThat(responseApplyPatchToolCallOutput.status())
.isEqualTo(ResponseApplyPatchToolCallOutput.Status.COMPLETED)
assertThat(responseApplyPatchToolCallOutput.createdBy()).contains("created_by")
+ assertThat(responseApplyPatchToolCallOutput.output()).contains("output")
}
@Test
@@ -35,9 +35,9 @@ internal class ResponseApplyPatchToolCallOutputTest {
ResponseApplyPatchToolCallOutput.builder()
.id("id")
.callId("call_id")
- .output("output")
.status(ResponseApplyPatchToolCallOutput.Status.COMPLETED)
.createdBy("created_by")
+ .output("output")
.build()
val roundtrippedResponseApplyPatchToolCallOutput =
diff --git a/openai-java-core/src/test/kotlin/com/openai/models/responses/ResponseApplyPatchToolCallTest.kt b/openai-java-core/src/test/kotlin/com/openai/models/responses/ResponseApplyPatchToolCallTest.kt
index c75d3504..22de5069 100644
--- a/openai-java-core/src/test/kotlin/com/openai/models/responses/ResponseApplyPatchToolCallTest.kt
+++ b/openai-java-core/src/test/kotlin/com/openai/models/responses/ResponseApplyPatchToolCallTest.kt
@@ -15,23 +15,20 @@ internal class ResponseApplyPatchToolCallTest {
ResponseApplyPatchToolCall.builder()
.id("id")
.callId("call_id")
- .status(ResponseApplyPatchToolCall.Status.IN_PROGRESS)
- .createdBy("created_by")
.operation(
ResponseApplyPatchToolCall.Operation.CreateFile.builder()
.diff("diff")
.path("path")
.build()
)
+ .status(ResponseApplyPatchToolCall.Status.IN_PROGRESS)
+ .createdBy("created_by")
.build()
assertThat(responseApplyPatchToolCall.id()).isEqualTo("id")
assertThat(responseApplyPatchToolCall.callId()).isEqualTo("call_id")
- assertThat(responseApplyPatchToolCall.status())
- .isEqualTo(ResponseApplyPatchToolCall.Status.IN_PROGRESS)
- assertThat(responseApplyPatchToolCall.createdBy()).contains("created_by")
assertThat(responseApplyPatchToolCall.operation())
- .contains(
+ .isEqualTo(
ResponseApplyPatchToolCall.Operation.ofCreateFile(
ResponseApplyPatchToolCall.Operation.CreateFile.builder()
.diff("diff")
@@ -39,6 +36,9 @@ internal class ResponseApplyPatchToolCallTest {
.build()
)
)
+ assertThat(responseApplyPatchToolCall.status())
+ .isEqualTo(ResponseApplyPatchToolCall.Status.IN_PROGRESS)
+ assertThat(responseApplyPatchToolCall.createdBy()).contains("created_by")
}
@Test
@@ -48,14 +48,14 @@ internal class ResponseApplyPatchToolCallTest {
ResponseApplyPatchToolCall.builder()
.id("id")
.callId("call_id")
- .status(ResponseApplyPatchToolCall.Status.IN_PROGRESS)
- .createdBy("created_by")
.operation(
ResponseApplyPatchToolCall.Operation.CreateFile.builder()
.diff("diff")
.path("path")
.build()
)
+ .status(ResponseApplyPatchToolCall.Status.IN_PROGRESS)
+ .createdBy("created_by")
.build()
val roundtrippedResponseApplyPatchToolCall =
diff --git a/openai-java-core/src/test/kotlin/com/openai/models/responses/ResponseItemTest.kt b/openai-java-core/src/test/kotlin/com/openai/models/responses/ResponseItemTest.kt
index 552a8d0e..71a984b9 100644
--- a/openai-java-core/src/test/kotlin/com/openai/models/responses/ResponseItemTest.kt
+++ b/openai-java-core/src/test/kotlin/com/openai/models/responses/ResponseItemTest.kt
@@ -1000,14 +1000,14 @@ internal class ResponseItemTest {
ResponseApplyPatchToolCall.builder()
.id("id")
.callId("call_id")
- .status(ResponseApplyPatchToolCall.Status.IN_PROGRESS)
- .createdBy("created_by")
.operation(
ResponseApplyPatchToolCall.Operation.CreateFile.builder()
.diff("diff")
.path("path")
.build()
)
+ .status(ResponseApplyPatchToolCall.Status.IN_PROGRESS)
+ .createdBy("created_by")
.build()
val responseItem = ResponseItem.ofApplyPatchCall(applyPatchCall)
@@ -1042,14 +1042,14 @@ internal class ResponseItemTest {
ResponseApplyPatchToolCall.builder()
.id("id")
.callId("call_id")
- .status(ResponseApplyPatchToolCall.Status.IN_PROGRESS)
- .createdBy("created_by")
.operation(
ResponseApplyPatchToolCall.Operation.CreateFile.builder()
.diff("diff")
.path("path")
.build()
)
+ .status(ResponseApplyPatchToolCall.Status.IN_PROGRESS)
+ .createdBy("created_by")
.build()
)
@@ -1068,9 +1068,9 @@ internal class ResponseItemTest {
ResponseApplyPatchToolCallOutput.builder()
.id("id")
.callId("call_id")
- .output("output")
.status(ResponseApplyPatchToolCallOutput.Status.COMPLETED)
.createdBy("created_by")
+ .output("output")
.build()
val responseItem = ResponseItem.ofApplyPatchCallOutput(applyPatchCallOutput)
@@ -1105,9 +1105,9 @@ internal class ResponseItemTest {
ResponseApplyPatchToolCallOutput.builder()
.id("id")
.callId("call_id")
- .output("output")
.status(ResponseApplyPatchToolCallOutput.Status.COMPLETED)
.createdBy("created_by")
+ .output("output")
.build()
)
diff --git a/openai-java-core/src/test/kotlin/com/openai/models/responses/ResponseOutputItemTest.kt b/openai-java-core/src/test/kotlin/com/openai/models/responses/ResponseOutputItemTest.kt
index 275bf369..2348ad9f 100644
--- a/openai-java-core/src/test/kotlin/com/openai/models/responses/ResponseOutputItemTest.kt
+++ b/openai-java-core/src/test/kotlin/com/openai/models/responses/ResponseOutputItemTest.kt
@@ -777,14 +777,14 @@ internal class ResponseOutputItemTest {
ResponseApplyPatchToolCall.builder()
.id("id")
.callId("call_id")
- .status(ResponseApplyPatchToolCall.Status.IN_PROGRESS)
- .createdBy("created_by")
.operation(
ResponseApplyPatchToolCall.Operation.CreateFile.builder()
.diff("diff")
.path("path")
.build()
)
+ .status(ResponseApplyPatchToolCall.Status.IN_PROGRESS)
+ .createdBy("created_by")
.build()
val responseOutputItem = ResponseOutputItem.ofApplyPatchCall(applyPatchCall)
@@ -816,14 +816,14 @@ internal class ResponseOutputItemTest {
ResponseApplyPatchToolCall.builder()
.id("id")
.callId("call_id")
- .status(ResponseApplyPatchToolCall.Status.IN_PROGRESS)
- .createdBy("created_by")
.operation(
ResponseApplyPatchToolCall.Operation.CreateFile.builder()
.diff("diff")
.path("path")
.build()
)
+ .status(ResponseApplyPatchToolCall.Status.IN_PROGRESS)
+ .createdBy("created_by")
.build()
)
@@ -842,9 +842,9 @@ internal class ResponseOutputItemTest {
ResponseApplyPatchToolCallOutput.builder()
.id("id")
.callId("call_id")
- .output("output")
.status(ResponseApplyPatchToolCallOutput.Status.COMPLETED)
.createdBy("created_by")
+ .output("output")
.build()
val responseOutputItem = ResponseOutputItem.ofApplyPatchCallOutput(applyPatchCallOutput)
@@ -876,9 +876,9 @@ internal class ResponseOutputItemTest {
ResponseApplyPatchToolCallOutput.builder()
.id("id")
.callId("call_id")
- .output("output")
.status(ResponseApplyPatchToolCallOutput.Status.COMPLETED)
.createdBy("created_by")
+ .output("output")
.build()
)
diff --git a/openai-java-core/src/test/kotlin/com/openai/models/responses/StructuredResponseOutputItemTest.kt b/openai-java-core/src/test/kotlin/com/openai/models/responses/StructuredResponseOutputItemTest.kt
index 66826bd1..809dc306 100644
--- a/openai-java-core/src/test/kotlin/com/openai/models/responses/StructuredResponseOutputItemTest.kt
+++ b/openai-java-core/src/test/kotlin/com/openai/models/responses/StructuredResponseOutputItemTest.kt
@@ -119,6 +119,12 @@ internal class StructuredResponseOutputItemTest {
ResponseApplyPatchToolCall.builder()
.id(STRING)
.callId(STRING)
+ .operation(
+ ResponseApplyPatchToolCall.Operation.CreateFile.builder()
+ .diff(STRING)
+ .path(STRING)
+ .build()
+ )
.status(ResponseApplyPatchToolCall.Status.COMPLETED)
.build()
private val APPLY_PATCH_TOOL_CALL_OUTPUT =