diff --git a/.release-please-manifest.json b/.release-please-manifest.json
index ddc14bf1b..141929c0b 100644
--- a/.release-please-manifest.json
+++ b/.release-please-manifest.json
@@ -1,3 +1,3 @@
{
- ".": "4.24.1"
+ ".": "4.25.0"
}
\ No newline at end of file
diff --git a/.stats.yml b/.stats.yml
index 7f0dae8bb..2e994a70d 100644
--- a/.stats.yml
+++ b/.stats.yml
@@ -1,4 +1,4 @@
configured_endpoints: 147
-openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/openai%2Fopenai-b879fff3f51e71e4f1ce17f03efc017a46d888a1bfd88eb655a6210a86f02acf.yml
-openapi_spec_hash: cbf649cc2c944fb3f77450ec752ab1e9
-config_hash: 9c56fcc7ff64785b5cd448d9a754b4b3
+openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/openai%2Fopenai-9c802d45a9bf2a896b5fd22ac22bba185e8a145bd40ed242df9bb87a05e954eb.yml
+openapi_spec_hash: 97984ed69285e660b7d5c810c69ed449
+config_hash: acb0b1eb5d7284bfedaddb29f7f5a691
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 928b9a6b4..5f9792475 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,5 +1,23 @@
# Changelog
+## 4.25.0 (2026-03-05)
+
+Full Changelog: [v4.24.1...v4.25.0](https://github.com/openai/openai-java/compare/v4.24.1...v4.25.0)
+
+### Features
+
+* **api:** gpt-5.4, tool search tool, and new computer tool ([18c8870](https://github.com/openai/openai-java/commit/18c8870b9f16b4fb2d87eb10d73797da3ecc6fdf))
+
+
+### Bug Fixes
+
+* **api:** allow unknown video seconds in responses ([82d67cb](https://github.com/openai/openai-java/commit/82d67cb396925dbe221cd9713afc414c0b9406ad))
+
+
+### Chores
+
+* **internal:** codegen related update ([42a435d](https://github.com/openai/openai-java/commit/42a435d6e939b6ecf1dc5866d5fce60f50b8b08b))
+
## 4.24.1 (2026-03-04)
Full Changelog: [v4.24.0...v4.24.1](https://github.com/openai/openai-java/compare/v4.24.0...v4.24.1)
diff --git a/README.md b/README.md
index c88b1aa01..21d3f965e 100644
--- a/README.md
+++ b/README.md
@@ -2,8 +2,8 @@
-[](https://central.sonatype.com/artifact/com.openai/openai-java/4.24.1)
-[](https://javadoc.io/doc/com.openai/openai-java/4.24.1)
+[](https://central.sonatype.com/artifact/com.openai/openai-java/4.25.0)
+[](https://javadoc.io/doc/com.openai/openai-java/4.25.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.24.1).
+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.25.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.24.1")
+implementation("com.openai:openai-java:4.25.0")
```
### Maven
@@ -33,7 +33,7 @@ implementation("com.openai:openai-java:4.24.1")
com.openai
openai-java
- 4.24.1
+ 4.25.0
```
@@ -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.24.1")
+implementation("com.openai:openai-java-spring-boot-starter:4.25.0")
```
#### Maven
@@ -1351,7 +1351,7 @@ implementation("com.openai:openai-java-spring-boot-starter:4.24.1")
com.openai
openai-java-spring-boot-starter
- 4.24.1
+ 4.25.0
```
@@ -1690,7 +1690,7 @@ import com.openai.models.ChatModel;
import com.openai.models.chat.completions.ChatCompletionCreateParams;
ChatCompletionCreateParams params = ChatCompletionCreateParams.builder()
- .model(ChatModel.GPT_5_2)
+ .model(ChatModel.GPT_5_4)
.messages(JsonMissing.of())
.build();
```
diff --git a/build.gradle.kts b/build.gradle.kts
index 8199a4c46..7fe32ceba 100644
--- a/build.gradle.kts
+++ b/build.gradle.kts
@@ -8,7 +8,7 @@ repositories {
allprojects {
group = "com.openai"
- version = "4.24.1" // x-release-please-version
+ version = "4.25.0" // x-release-please-version
}
subprojects {
diff --git a/buildSrc/src/main/kotlin/openai.java.gradle.kts b/buildSrc/src/main/kotlin/openai.java.gradle.kts
index 70fc33f41..8f4f902a6 100644
--- a/buildSrc/src/main/kotlin/openai.java.gradle.kts
+++ b/buildSrc/src/main/kotlin/openai.java.gradle.kts
@@ -45,7 +45,7 @@ tasks.withType().configureEach {
val palantir by configurations.creating
dependencies {
- palantir("com.palantir.javaformat:palantir-java-format:2.73.0")
+ palantir("com.palantir.javaformat:palantir-java-format:2.89.0")
}
fun registerPalantir(
diff --git a/openai-java-core/src/main/kotlin/com/openai/core/http/RetryingHttpClient.kt b/openai-java-core/src/main/kotlin/com/openai/core/http/RetryingHttpClient.kt
index 2a641c60d..249ce3400 100644
--- a/openai-java-core/src/main/kotlin/com/openai/core/http/RetryingHttpClient.kt
+++ b/openai-java-core/src/main/kotlin/com/openai/core/http/RetryingHttpClient.kt
@@ -214,13 +214,8 @@ private constructor(
}
}
?.let { retryAfterNanos ->
- // If the API asks us to wait a certain amount of time (and it's a reasonable
- // amount), just
- // do what it says.
- val retryAfter = Duration.ofNanos(retryAfterNanos.toLong())
- if (retryAfter in Duration.ofNanos(0)..Duration.ofMinutes(1)) {
- return retryAfter
- }
+ // If the API asks us to wait a certain amount of time, do what it says.
+ return Duration.ofNanos(retryAfterNanos.toLong())
}
// Apply exponential backoff, but not more than the max.
diff --git a/openai-java-core/src/main/kotlin/com/openai/models/ChatModel.kt b/openai-java-core/src/main/kotlin/com/openai/models/ChatModel.kt
index 9a4ac20c3..a04238e15 100644
--- a/openai-java-core/src/main/kotlin/com/openai/models/ChatModel.kt
+++ b/openai-java-core/src/main/kotlin/com/openai/models/ChatModel.kt
@@ -20,6 +20,10 @@ class ChatModel @JsonCreator private constructor(private val value: JsonField Value.GPT_5_4
+ GPT_5_3_CHAT_LATEST -> Value.GPT_5_3_CHAT_LATEST
GPT_5_2 -> Value.GPT_5_2
GPT_5_2_2025_12_11 -> Value.GPT_5_2_2025_12_11
GPT_5_2_CHAT_LATEST -> Value.GPT_5_2_CHAT_LATEST
@@ -425,6 +435,8 @@ class ChatModel @JsonCreator private constructor(private val value: JsonField Known.GPT_5_4
+ GPT_5_3_CHAT_LATEST -> Known.GPT_5_3_CHAT_LATEST
GPT_5_2 -> Known.GPT_5_2
GPT_5_2_2025_12_11 -> Known.GPT_5_2_2025_12_11
GPT_5_2_CHAT_LATEST -> Known.GPT_5_2_CHAT_LATEST
diff --git a/openai-java-core/src/main/kotlin/com/openai/models/beta/assistants/AssistantCreateParams.kt b/openai-java-core/src/main/kotlin/com/openai/models/beta/assistants/AssistantCreateParams.kt
index 6b77ecf7a..d7410edb8 100644
--- a/openai-java-core/src/main/kotlin/com/openai/models/beta/assistants/AssistantCreateParams.kt
+++ b/openai-java-core/src/main/kotlin/com/openai/models/beta/assistants/AssistantCreateParams.kt
@@ -2298,7 +2298,9 @@ private constructor(
/**
* A list of [file](https://platform.openai.com/docs/api-reference/files) IDs to add
- * to the vector store. There can be a maximum of 10000 files in a vector store.
+ * to the vector store. For vector stores created before Nov 2025, there can be a
+ * maximum of 10,000 files in a vector store. For vector stores created starting in
+ * Nov 2025, the limit is 100,000,000 files.
*
* @throws OpenAIInvalidDataException if the JSON field has an unexpected type (e.g.
* if the server responded with an unexpected value).
@@ -2423,8 +2425,9 @@ private constructor(
/**
* A list of [file](https://platform.openai.com/docs/api-reference/files) IDs to
- * add to the vector store. There can be a maximum of 10000 files in a vector
- * store.
+ * add to the vector store. For vector stores created before Nov 2025, there can
+ * be a maximum of 10,000 files in a vector store. For vector stores created
+ * starting in Nov 2025, the limit is 100,000,000 files.
*/
fun fileIds(fileIds: List) = fileIds(JsonField.of(fileIds))
diff --git a/openai-java-core/src/main/kotlin/com/openai/models/beta/threads/ThreadCreateAndRunParams.kt b/openai-java-core/src/main/kotlin/com/openai/models/beta/threads/ThreadCreateAndRunParams.kt
index 91a292f78..0202733b9 100644
--- a/openai-java-core/src/main/kotlin/com/openai/models/beta/threads/ThreadCreateAndRunParams.kt
+++ b/openai-java-core/src/main/kotlin/com/openai/models/beta/threads/ThreadCreateAndRunParams.kt
@@ -4341,8 +4341,9 @@ private constructor(
/**
* A list of [file](https://platform.openai.com/docs/api-reference/files) IDs to
- * add to the vector store. There can be a maximum of 10000 files in a vector
- * store.
+ * add to the vector store. For vector stores created before Nov 2025, there can
+ * be a maximum of 10,000 files in a vector store. For vector stores created
+ * starting in Nov 2025, the limit is 100,000,000 files.
*
* @throws OpenAIInvalidDataException if the JSON field has an unexpected type
* (e.g. if the server responded with an unexpected value).
@@ -4475,8 +4476,10 @@ private constructor(
/**
* A list of [file](https://platform.openai.com/docs/api-reference/files)
- * IDs to add to the vector store. There can be a maximum of 10000 files in
- * a vector store.
+ * IDs to add to the vector store. For vector stores created before Nov
+ * 2025, there can be a maximum of 10,000 files in a vector store. For
+ * vector stores created starting in Nov 2025, the limit is 100,000,000
+ * files.
*/
fun fileIds(fileIds: List) = fileIds(JsonField.of(fileIds))
diff --git a/openai-java-core/src/main/kotlin/com/openai/models/beta/threads/ThreadCreateParams.kt b/openai-java-core/src/main/kotlin/com/openai/models/beta/threads/ThreadCreateParams.kt
index 6eb1b6ea8..d6f87f2b3 100644
--- a/openai-java-core/src/main/kotlin/com/openai/models/beta/threads/ThreadCreateParams.kt
+++ b/openai-java-core/src/main/kotlin/com/openai/models/beta/threads/ThreadCreateParams.kt
@@ -2524,7 +2524,9 @@ private constructor(
/**
* A list of [file](https://platform.openai.com/docs/api-reference/files) IDs to add
- * to the vector store. There can be a maximum of 10000 files in a vector store.
+ * to the vector store. For vector stores created before Nov 2025, there can be a
+ * maximum of 10,000 files in a vector store. For vector stores created starting in
+ * Nov 2025, the limit is 100,000,000 files.
*
* @throws OpenAIInvalidDataException if the JSON field has an unexpected type (e.g.
* if the server responded with an unexpected value).
@@ -2649,8 +2651,9 @@ private constructor(
/**
* A list of [file](https://platform.openai.com/docs/api-reference/files) IDs to
- * add to the vector store. There can be a maximum of 10000 files in a vector
- * store.
+ * add to the vector store. For vector stores created before Nov 2025, there can
+ * be a maximum of 10,000 files in a vector store. For vector stores created
+ * starting in Nov 2025, the limit is 100,000,000 files.
*/
fun fileIds(fileIds: List) = fileIds(JsonField.of(fileIds))
diff --git a/openai-java-core/src/main/kotlin/com/openai/models/conversations/ComputerScreenshotContent.kt b/openai-java-core/src/main/kotlin/com/openai/models/conversations/ComputerScreenshotContent.kt
index e71ea1691..1db895140 100644
--- a/openai-java-core/src/main/kotlin/com/openai/models/conversations/ComputerScreenshotContent.kt
+++ b/openai-java-core/src/main/kotlin/com/openai/models/conversations/ComputerScreenshotContent.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 @@ import kotlin.jvm.optionals.getOrNull
class ComputerScreenshotContent
@JsonCreator(mode = JsonCreator.Mode.DISABLED)
private constructor(
+ private val detail: JsonField,
private val fileId: JsonField,
private val imageUrl: JsonField,
private val type: JsonValue,
@@ -29,10 +31,20 @@ private constructor(
@JsonCreator
private constructor(
+ @JsonProperty("detail") @ExcludeMissing detail: JsonField = JsonMissing.of(),
@JsonProperty("file_id") @ExcludeMissing fileId: JsonField = JsonMissing.of(),
@JsonProperty("image_url") @ExcludeMissing imageUrl: JsonField = JsonMissing.of(),
@JsonProperty("type") @ExcludeMissing type: JsonValue = JsonMissing.of(),
- ) : this(fileId, imageUrl, type, mutableMapOf())
+ ) : this(detail, fileId, imageUrl, type, mutableMapOf())
+
+ /**
+ * The detail level of the screenshot image to be sent to the model. One of `high`, `low`,
+ * `auto`, or `original`. Defaults to `auto`.
+ *
+ * @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 detail(): Detail = detail.getRequired("detail")
/**
* The identifier of an uploaded file that contains the screenshot.
@@ -64,6 +76,13 @@ private constructor(
*/
@JsonProperty("type") @ExcludeMissing fun _type(): JsonValue = type
+ /**
+ * 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 [fileId].
*
@@ -97,6 +116,7 @@ private constructor(
*
* The following fields are required:
* ```java
+ * .detail()
* .fileId()
* .imageUrl()
* ```
@@ -107,6 +127,7 @@ private constructor(
/** A builder for [ComputerScreenshotContent]. */
class Builder internal constructor() {
+ private var detail: JsonField? = null
private var fileId: JsonField? = null
private var imageUrl: JsonField? = null
private var type: JsonValue = JsonValue.from("computer_screenshot")
@@ -114,12 +135,27 @@ private constructor(
@JvmSynthetic
internal fun from(computerScreenshotContent: ComputerScreenshotContent) = apply {
+ detail = computerScreenshotContent.detail
fileId = computerScreenshotContent.fileId
imageUrl = computerScreenshotContent.imageUrl
type = computerScreenshotContent.type
additionalProperties = computerScreenshotContent.additionalProperties.toMutableMap()
}
+ /**
+ * The detail level of the screenshot image to be sent to the model. One of `high`, `low`,
+ * `auto`, or `original`. Defaults to `auto`.
+ */
+ 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 identifier of an uploaded file that contains the screenshot. */
fun fileId(fileId: String?) = fileId(JsonField.ofNullable(fileId))
@@ -188,6 +224,7 @@ private constructor(
*
* The following fields are required:
* ```java
+ * .detail()
* .fileId()
* .imageUrl()
* ```
@@ -196,6 +233,7 @@ private constructor(
*/
fun build(): ComputerScreenshotContent =
ComputerScreenshotContent(
+ checkRequired("detail", detail),
checkRequired("fileId", fileId),
checkRequired("imageUrl", imageUrl),
type,
@@ -210,6 +248,7 @@ private constructor(
return@apply
}
+ detail().validate()
fileId()
imageUrl()
_type().let {
@@ -235,26 +274,171 @@ private constructor(
*/
@JvmSynthetic
internal fun validity(): Int =
- (if (fileId.asKnown().isPresent) 1 else 0) +
+ (detail.asKnown().getOrNull()?.validity() ?: 0) +
+ (if (fileId.asKnown().isPresent) 1 else 0) +
(if (imageUrl.asKnown().isPresent) 1 else 0) +
type.let { if (it == JsonValue.from("computer_screenshot")) 1 else 0 }
+ /**
+ * The detail level of the screenshot image to be sent to the model. One of `high`, `low`,
+ * `auto`, or `original`. Defaults to `auto`.
+ */
+ 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")
+
+ @JvmField val AUTO = of("auto")
+
+ @JvmField val ORIGINAL = of("original")
+
+ @JvmStatic fun of(value: String) = Detail(JsonField.of(value))
+ }
+
+ /** An enum containing [Detail]'s known values. */
+ enum class Known {
+ LOW,
+ HIGH,
+ AUTO,
+ ORIGINAL,
+ }
+
+ /**
+ * 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,
+ AUTO,
+ ORIGINAL,
+ /** 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
+ AUTO -> Value.AUTO
+ ORIGINAL -> Value.ORIGINAL
+ 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
+ AUTO -> Known.AUTO
+ ORIGINAL -> Known.ORIGINAL
+ 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
}
return other is ComputerScreenshotContent &&
+ detail == other.detail &&
fileId == other.fileId &&
imageUrl == other.imageUrl &&
type == other.type &&
additionalProperties == other.additionalProperties
}
- private val hashCode: Int by lazy { Objects.hash(fileId, imageUrl, type, additionalProperties) }
+ private val hashCode: Int by lazy {
+ Objects.hash(detail, fileId, imageUrl, type, additionalProperties)
+ }
override fun hashCode(): Int = hashCode
override fun toString() =
- "ComputerScreenshotContent{fileId=$fileId, imageUrl=$imageUrl, type=$type, additionalProperties=$additionalProperties}"
+ "ComputerScreenshotContent{detail=$detail, fileId=$fileId, imageUrl=$imageUrl, type=$type, additionalProperties=$additionalProperties}"
}
diff --git a/openai-java-core/src/main/kotlin/com/openai/models/conversations/ConversationCreateParams.kt b/openai-java-core/src/main/kotlin/com/openai/models/conversations/ConversationCreateParams.kt
index b886b09c0..408c0653a 100644
--- a/openai-java-core/src/main/kotlin/com/openai/models/conversations/ConversationCreateParams.kt
+++ b/openai-java-core/src/main/kotlin/com/openai/models/conversations/ConversationCreateParams.kt
@@ -28,6 +28,8 @@ import com.openai.models.responses.ResponseFunctionWebSearch
import com.openai.models.responses.ResponseInputItem
import com.openai.models.responses.ResponseOutputMessage
import com.openai.models.responses.ResponseReasoningItem
+import com.openai.models.responses.ResponseToolSearchOutputItemParam
+import com.openai.models.responses.Tool
import java.util.Collections
import java.util.Objects
import java.util.Optional
@@ -194,6 +196,45 @@ private constructor(
body.addItem(functionCallOutput)
}
+ /**
+ * Alias for calling [addItem] with `ResponseInputItem.ofToolSearchCall(toolSearchCall)`.
+ */
+ fun addItem(toolSearchCall: ResponseInputItem.ToolSearchCall) = apply {
+ body.addItem(toolSearchCall)
+ }
+
+ /**
+ * Alias for calling [addItem] with the following:
+ * ```java
+ * ResponseInputItem.ToolSearchCall.builder()
+ * .arguments(arguments)
+ * .build()
+ * ```
+ */
+ fun addToolSearchCallItem(arguments: JsonValue) = apply {
+ body.addToolSearchCallItem(arguments)
+ }
+
+ /**
+ * Alias for calling [addItem] with
+ * `ResponseInputItem.ofToolSearchOutput(toolSearchOutput)`.
+ */
+ fun addItem(toolSearchOutput: ResponseToolSearchOutputItemParam) = apply {
+ body.addItem(toolSearchOutput)
+ }
+
+ /**
+ * Alias for calling [addItem] with the following:
+ * ```java
+ * ResponseToolSearchOutputItemParam.builder()
+ * .tools(tools)
+ * .build()
+ * ```
+ */
+ fun addToolSearchOutputItem(tools: List) = apply {
+ body.addToolSearchOutputItem(tools)
+ }
+
/** Alias for calling [addItem] with `ResponseInputItem.ofReasoning(reasoning)`. */
fun addItem(reasoning: ResponseReasoningItem) = apply { body.addItem(reasoning) }
@@ -656,6 +697,42 @@ private constructor(
fun addItem(functionCallOutput: ResponseInputItem.FunctionCallOutput) =
addItem(ResponseInputItem.ofFunctionCallOutput(functionCallOutput))
+ /**
+ * Alias for calling [addItem] with
+ * `ResponseInputItem.ofToolSearchCall(toolSearchCall)`.
+ */
+ fun addItem(toolSearchCall: ResponseInputItem.ToolSearchCall) =
+ addItem(ResponseInputItem.ofToolSearchCall(toolSearchCall))
+
+ /**
+ * Alias for calling [addItem] with the following:
+ * ```java
+ * ResponseInputItem.ToolSearchCall.builder()
+ * .arguments(arguments)
+ * .build()
+ * ```
+ */
+ fun addToolSearchCallItem(arguments: JsonValue) =
+ addItem(ResponseInputItem.ToolSearchCall.builder().arguments(arguments).build())
+
+ /**
+ * Alias for calling [addItem] with
+ * `ResponseInputItem.ofToolSearchOutput(toolSearchOutput)`.
+ */
+ fun addItem(toolSearchOutput: ResponseToolSearchOutputItemParam) =
+ addItem(ResponseInputItem.ofToolSearchOutput(toolSearchOutput))
+
+ /**
+ * Alias for calling [addItem] with the following:
+ * ```java
+ * ResponseToolSearchOutputItemParam.builder()
+ * .tools(tools)
+ * .build()
+ * ```
+ */
+ fun addToolSearchOutputItem(tools: List) =
+ addItem(ResponseToolSearchOutputItemParam.builder().tools(tools).build())
+
/** Alias for calling [addItem] with `ResponseInputItem.ofReasoning(reasoning)`. */
fun addItem(reasoning: ResponseReasoningItem) =
addItem(ResponseInputItem.ofReasoning(reasoning))
diff --git a/openai-java-core/src/main/kotlin/com/openai/models/conversations/items/ConversationItem.kt b/openai-java-core/src/main/kotlin/com/openai/models/conversations/items/ConversationItem.kt
index 58ff34293..0795aa384 100644
--- a/openai-java-core/src/main/kotlin/com/openai/models/conversations/items/ConversationItem.kt
+++ b/openai-java-core/src/main/kotlin/com/openai/models/conversations/items/ConversationItem.kt
@@ -40,6 +40,8 @@ import com.openai.models.responses.ResponseFunctionToolCallItem
import com.openai.models.responses.ResponseFunctionToolCallOutputItem
import com.openai.models.responses.ResponseFunctionWebSearch
import com.openai.models.responses.ResponseReasoningItem
+import com.openai.models.responses.ResponseToolSearchCall
+import com.openai.models.responses.ResponseToolSearchOutputItem
import java.util.Collections
import java.util.Objects
import java.util.Optional
@@ -62,6 +64,8 @@ private constructor(
private val imageGenerationCall: ImageGenerationCall? = null,
private val computerCall: ResponseComputerToolCall? = null,
private val computerCallOutput: ResponseComputerToolCallOutputItem? = null,
+ private val toolSearchCall: ResponseToolSearchCall? = null,
+ private val toolSearchOutput: ResponseToolSearchOutputItem? = null,
private val reasoning: ResponseReasoningItem? = null,
private val codeInterpreterCall: ResponseCodeInterpreterToolCall? = null,
private val localShellCall: LocalShellCall? = null,
@@ -120,6 +124,11 @@ private constructor(
fun computerCallOutput(): Optional =
Optional.ofNullable(computerCallOutput)
+ fun toolSearchCall(): Optional = Optional.ofNullable(toolSearchCall)
+
+ fun toolSearchOutput(): Optional =
+ Optional.ofNullable(toolSearchOutput)
+
/**
* A description of the chain of thought used by a reasoning model while generating a response.
* Be sure to include these items in your `input` to the Responses API for subsequent turns of a
@@ -189,6 +198,10 @@ private constructor(
fun isComputerCallOutput(): Boolean = computerCallOutput != null
+ fun isToolSearchCall(): Boolean = toolSearchCall != null
+
+ fun isToolSearchOutput(): Boolean = toolSearchOutput != null
+
fun isReasoning(): Boolean = reasoning != null
fun isCodeInterpreterCall(): Boolean = codeInterpreterCall != null
@@ -258,6 +271,11 @@ private constructor(
fun asComputerCallOutput(): ResponseComputerToolCallOutputItem =
computerCallOutput.getOrThrow("computerCallOutput")
+ fun asToolSearchCall(): ResponseToolSearchCall = toolSearchCall.getOrThrow("toolSearchCall")
+
+ fun asToolSearchOutput(): ResponseToolSearchOutputItem =
+ toolSearchOutput.getOrThrow("toolSearchOutput")
+
/**
* A description of the chain of thought used by a reasoning model while generating a response.
* Be sure to include these items in your `input` to the Responses API for subsequent turns of a
@@ -324,6 +342,8 @@ private constructor(
imageGenerationCall != null -> visitor.visitImageGenerationCall(imageGenerationCall)
computerCall != null -> visitor.visitComputerCall(computerCall)
computerCallOutput != null -> visitor.visitComputerCallOutput(computerCallOutput)
+ toolSearchCall != null -> visitor.visitToolSearchCall(toolSearchCall)
+ toolSearchOutput != null -> visitor.visitToolSearchOutput(toolSearchOutput)
reasoning != null -> visitor.visitReasoning(reasoning)
codeInterpreterCall != null -> visitor.visitCodeInterpreterCall(codeInterpreterCall)
localShellCall != null -> visitor.visitLocalShellCall(localShellCall)
@@ -386,6 +406,14 @@ private constructor(
computerCallOutput.validate()
}
+ override fun visitToolSearchCall(toolSearchCall: ResponseToolSearchCall) {
+ toolSearchCall.validate()
+ }
+
+ override fun visitToolSearchOutput(toolSearchOutput: ResponseToolSearchOutputItem) {
+ toolSearchOutput.validate()
+ }
+
override fun visitReasoning(reasoning: ResponseReasoningItem) {
reasoning.validate()
}
@@ -496,6 +524,12 @@ private constructor(
computerCallOutput: ResponseComputerToolCallOutputItem
) = computerCallOutput.validity()
+ override fun visitToolSearchCall(toolSearchCall: ResponseToolSearchCall) =
+ toolSearchCall.validity()
+
+ override fun visitToolSearchOutput(toolSearchOutput: ResponseToolSearchOutputItem) =
+ toolSearchOutput.validity()
+
override fun visitReasoning(reasoning: ResponseReasoningItem) = reasoning.validity()
override fun visitCodeInterpreterCall(
@@ -557,6 +591,8 @@ private constructor(
imageGenerationCall == other.imageGenerationCall &&
computerCall == other.computerCall &&
computerCallOutput == other.computerCallOutput &&
+ toolSearchCall == other.toolSearchCall &&
+ toolSearchOutput == other.toolSearchOutput &&
reasoning == other.reasoning &&
codeInterpreterCall == other.codeInterpreterCall &&
localShellCall == other.localShellCall &&
@@ -583,6 +619,8 @@ private constructor(
imageGenerationCall,
computerCall,
computerCallOutput,
+ toolSearchCall,
+ toolSearchOutput,
reasoning,
codeInterpreterCall,
localShellCall,
@@ -610,6 +648,8 @@ private constructor(
"ConversationItem{imageGenerationCall=$imageGenerationCall}"
computerCall != null -> "ConversationItem{computerCall=$computerCall}"
computerCallOutput != null -> "ConversationItem{computerCallOutput=$computerCallOutput}"
+ toolSearchCall != null -> "ConversationItem{toolSearchCall=$toolSearchCall}"
+ toolSearchOutput != null -> "ConversationItem{toolSearchOutput=$toolSearchOutput}"
reasoning != null -> "ConversationItem{reasoning=$reasoning}"
codeInterpreterCall != null ->
"ConversationItem{codeInterpreterCall=$codeInterpreterCall}"
@@ -687,6 +727,14 @@ private constructor(
fun ofComputerCallOutput(computerCallOutput: ResponseComputerToolCallOutputItem) =
ConversationItem(computerCallOutput = computerCallOutput)
+ @JvmStatic
+ fun ofToolSearchCall(toolSearchCall: ResponseToolSearchCall) =
+ ConversationItem(toolSearchCall = toolSearchCall)
+
+ @JvmStatic
+ fun ofToolSearchOutput(toolSearchOutput: ResponseToolSearchOutputItem) =
+ ConversationItem(toolSearchOutput = toolSearchOutput)
+
/**
* A description of the chain of thought used by a reasoning model while generating a
* response. Be sure to include these items in your `input` to the Responses API for
@@ -804,6 +852,10 @@ private constructor(
fun visitComputerCallOutput(computerCallOutput: ResponseComputerToolCallOutputItem): T
+ fun visitToolSearchCall(toolSearchCall: ResponseToolSearchCall): T
+
+ fun visitToolSearchOutput(toolSearchOutput: ResponseToolSearchOutputItem): T
+
/**
* A description of the chain of thought used by a reasoning model while generating a
* response. Be sure to include these items in your `input` to the Responses API for
@@ -919,6 +971,16 @@ private constructor(
?.let { ConversationItem(computerCallOutput = it, _json = json) }
?: ConversationItem(_json = json)
}
+ "tool_search_call" -> {
+ return tryDeserialize(node, jacksonTypeRef())?.let {
+ ConversationItem(toolSearchCall = it, _json = json)
+ } ?: ConversationItem(_json = json)
+ }
+ "tool_search_output" -> {
+ return tryDeserialize(node, jacksonTypeRef())
+ ?.let { ConversationItem(toolSearchOutput = it, _json = json) }
+ ?: ConversationItem(_json = json)
+ }
"reasoning" -> {
return tryDeserialize(node, jacksonTypeRef())?.let {
ConversationItem(reasoning = it, _json = json)
@@ -1015,6 +1077,8 @@ private constructor(
generator.writeObject(value.imageGenerationCall)
value.computerCall != null -> generator.writeObject(value.computerCall)
value.computerCallOutput != null -> generator.writeObject(value.computerCallOutput)
+ value.toolSearchCall != null -> generator.writeObject(value.toolSearchCall)
+ value.toolSearchOutput != null -> generator.writeObject(value.toolSearchOutput)
value.reasoning != null -> generator.writeObject(value.reasoning)
value.codeInterpreterCall != null ->
generator.writeObject(value.codeInterpreterCall)
diff --git a/openai-java-core/src/main/kotlin/com/openai/models/conversations/items/ConversationItemList.kt b/openai-java-core/src/main/kotlin/com/openai/models/conversations/items/ConversationItemList.kt
index c3e736a2f..fd73aeb24 100644
--- a/openai-java-core/src/main/kotlin/com/openai/models/conversations/items/ConversationItemList.kt
+++ b/openai-java-core/src/main/kotlin/com/openai/models/conversations/items/ConversationItemList.kt
@@ -29,6 +29,8 @@ import com.openai.models.responses.ResponseFunctionToolCallItem
import com.openai.models.responses.ResponseFunctionToolCallOutputItem
import com.openai.models.responses.ResponseFunctionWebSearch
import com.openai.models.responses.ResponseReasoningItem
+import com.openai.models.responses.ResponseToolSearchCall
+import com.openai.models.responses.ResponseToolSearchOutputItem
import java.util.Collections
import java.util.Objects
import kotlin.jvm.optionals.getOrNull
@@ -243,6 +245,16 @@ private constructor(
fun addData(computerCallOutput: ResponseComputerToolCallOutputItem) =
addData(ConversationItem.ofComputerCallOutput(computerCallOutput))
+ /** Alias for calling [addData] with `ConversationItem.ofToolSearchCall(toolSearchCall)`. */
+ fun addData(toolSearchCall: ResponseToolSearchCall) =
+ addData(ConversationItem.ofToolSearchCall(toolSearchCall))
+
+ /**
+ * Alias for calling [addData] with `ConversationItem.ofToolSearchOutput(toolSearchOutput)`.
+ */
+ fun addData(toolSearchOutput: ResponseToolSearchOutputItem) =
+ addData(ConversationItem.ofToolSearchOutput(toolSearchOutput))
+
/** Alias for calling [addData] with `ConversationItem.ofReasoning(reasoning)`. */
fun addData(reasoning: ResponseReasoningItem) =
addData(ConversationItem.ofReasoning(reasoning))
diff --git a/openai-java-core/src/main/kotlin/com/openai/models/conversations/items/ItemCreateParams.kt b/openai-java-core/src/main/kotlin/com/openai/models/conversations/items/ItemCreateParams.kt
index f629d720e..9f4c47777 100644
--- a/openai-java-core/src/main/kotlin/com/openai/models/conversations/items/ItemCreateParams.kt
+++ b/openai-java-core/src/main/kotlin/com/openai/models/conversations/items/ItemCreateParams.kt
@@ -30,6 +30,8 @@ import com.openai.models.responses.ResponseIncludable
import com.openai.models.responses.ResponseInputItem
import com.openai.models.responses.ResponseOutputMessage
import com.openai.models.responses.ResponseReasoningItem
+import com.openai.models.responses.ResponseToolSearchOutputItemParam
+import com.openai.models.responses.Tool
import java.util.Collections
import java.util.Objects
import java.util.Optional
@@ -216,6 +218,45 @@ private constructor(
body.addItem(functionCallOutput)
}
+ /**
+ * Alias for calling [addItem] with `ResponseInputItem.ofToolSearchCall(toolSearchCall)`.
+ */
+ fun addItem(toolSearchCall: ResponseInputItem.ToolSearchCall) = apply {
+ body.addItem(toolSearchCall)
+ }
+
+ /**
+ * Alias for calling [addItem] with the following:
+ * ```java
+ * ResponseInputItem.ToolSearchCall.builder()
+ * .arguments(arguments)
+ * .build()
+ * ```
+ */
+ fun addToolSearchCallItem(arguments: JsonValue) = apply {
+ body.addToolSearchCallItem(arguments)
+ }
+
+ /**
+ * Alias for calling [addItem] with
+ * `ResponseInputItem.ofToolSearchOutput(toolSearchOutput)`.
+ */
+ fun addItem(toolSearchOutput: ResponseToolSearchOutputItemParam) = apply {
+ body.addItem(toolSearchOutput)
+ }
+
+ /**
+ * Alias for calling [addItem] with the following:
+ * ```java
+ * ResponseToolSearchOutputItemParam.builder()
+ * .tools(tools)
+ * .build()
+ * ```
+ */
+ fun addToolSearchOutputItem(tools: List) = apply {
+ body.addToolSearchOutputItem(tools)
+ }
+
/** Alias for calling [addItem] with `ResponseInputItem.ofReasoning(reasoning)`. */
fun addItem(reasoning: ResponseReasoningItem) = apply { body.addItem(reasoning) }
@@ -651,6 +692,42 @@ private constructor(
fun addItem(functionCallOutput: ResponseInputItem.FunctionCallOutput) =
addItem(ResponseInputItem.ofFunctionCallOutput(functionCallOutput))
+ /**
+ * Alias for calling [addItem] with
+ * `ResponseInputItem.ofToolSearchCall(toolSearchCall)`.
+ */
+ fun addItem(toolSearchCall: ResponseInputItem.ToolSearchCall) =
+ addItem(ResponseInputItem.ofToolSearchCall(toolSearchCall))
+
+ /**
+ * Alias for calling [addItem] with the following:
+ * ```java
+ * ResponseInputItem.ToolSearchCall.builder()
+ * .arguments(arguments)
+ * .build()
+ * ```
+ */
+ fun addToolSearchCallItem(arguments: JsonValue) =
+ addItem(ResponseInputItem.ToolSearchCall.builder().arguments(arguments).build())
+
+ /**
+ * Alias for calling [addItem] with
+ * `ResponseInputItem.ofToolSearchOutput(toolSearchOutput)`.
+ */
+ fun addItem(toolSearchOutput: ResponseToolSearchOutputItemParam) =
+ addItem(ResponseInputItem.ofToolSearchOutput(toolSearchOutput))
+
+ /**
+ * Alias for calling [addItem] with the following:
+ * ```java
+ * ResponseToolSearchOutputItemParam.builder()
+ * .tools(tools)
+ * .build()
+ * ```
+ */
+ fun addToolSearchOutputItem(tools: List) =
+ addItem(ResponseToolSearchOutputItemParam.builder().tools(tools).build())
+
/** Alias for calling [addItem] with `ResponseInputItem.ofReasoning(reasoning)`. */
fun addItem(reasoning: ResponseReasoningItem) =
addItem(ResponseInputItem.ofReasoning(reasoning))
diff --git a/openai-java-core/src/main/kotlin/com/openai/models/evals/runs/RunCancelResponse.kt b/openai-java-core/src/main/kotlin/com/openai/models/evals/runs/RunCancelResponse.kt
index 25861c24c..77e8ecc3c 100644
--- a/openai-java-core/src/main/kotlin/com/openai/models/evals/runs/RunCancelResponse.kt
+++ b/openai-java-core/src/main/kotlin/com/openai/models/evals/runs/RunCancelResponse.kt
@@ -32,15 +32,18 @@ import com.openai.models.ResponseFormatText
import com.openai.models.graders.gradermodels.EvalContentItem
import com.openai.models.responses.ApplyPatchTool
import com.openai.models.responses.ComputerTool
+import com.openai.models.responses.ComputerUseTool
import com.openai.models.responses.CustomTool
import com.openai.models.responses.FileSearchTool
import com.openai.models.responses.FunctionShellTool
import com.openai.models.responses.FunctionTool
+import com.openai.models.responses.NamespaceTool
import com.openai.models.responses.ResponseFormatTextConfig
import com.openai.models.responses.ResponseFormatTextJsonSchemaConfig
import com.openai.models.responses.ResponseInputAudio
import com.openai.models.responses.ResponseInputText
import com.openai.models.responses.Tool
+import com.openai.models.responses.ToolSearchTool
import com.openai.models.responses.WebSearchPreviewTool
import com.openai.models.responses.WebSearchTool
import java.util.Collections
@@ -6379,6 +6382,9 @@ private constructor(
fun addFileSearchTool(vectorStoreIds: List) =
addTool(FileSearchTool.builder().vectorStoreIds(vectorStoreIds).build())
+ /** Alias for calling [addTool] with `Tool.ofComputer(computer)`. */
+ fun addTool(computer: ComputerUseTool) = addTool(Tool.ofComputer(computer))
+
/**
* Alias for calling [addTool] with
* `Tool.ofComputerUsePreview(computerUsePreview)`.
@@ -6467,6 +6473,12 @@ private constructor(
fun addCustomTool(name: String) =
addTool(CustomTool.builder().name(name).build())
+ /** Alias for calling [addTool] with `Tool.ofNamespace(namespace)`. */
+ fun addTool(namespace: NamespaceTool) = addTool(Tool.ofNamespace(namespace))
+
+ /** Alias for calling [addTool] with `Tool.ofSearch(search)`. */
+ fun addTool(search: ToolSearchTool) = addTool(Tool.ofSearch(search))
+
/**
* Alias for calling [addTool] with `Tool.ofWebSearchPreview(webSearchPreview)`.
*/
diff --git a/openai-java-core/src/main/kotlin/com/openai/models/evals/runs/RunCreateParams.kt b/openai-java-core/src/main/kotlin/com/openai/models/evals/runs/RunCreateParams.kt
index 7e9625e26..7987b4362 100644
--- a/openai-java-core/src/main/kotlin/com/openai/models/evals/runs/RunCreateParams.kt
+++ b/openai-java-core/src/main/kotlin/com/openai/models/evals/runs/RunCreateParams.kt
@@ -35,15 +35,18 @@ import com.openai.models.ResponseFormatText
import com.openai.models.graders.gradermodels.EvalContentItem
import com.openai.models.responses.ApplyPatchTool
import com.openai.models.responses.ComputerTool
+import com.openai.models.responses.ComputerUseTool
import com.openai.models.responses.CustomTool
import com.openai.models.responses.FileSearchTool
import com.openai.models.responses.FunctionShellTool
import com.openai.models.responses.FunctionTool
+import com.openai.models.responses.NamespaceTool
import com.openai.models.responses.ResponseFormatTextConfig
import com.openai.models.responses.ResponseFormatTextJsonSchemaConfig
import com.openai.models.responses.ResponseInputAudio
import com.openai.models.responses.ResponseInputText
import com.openai.models.responses.Tool
+import com.openai.models.responses.ToolSearchTool
import com.openai.models.responses.WebSearchPreviewTool
import com.openai.models.responses.WebSearchTool
import java.util.Collections
@@ -6264,6 +6267,9 @@ private constructor(
fun addFileSearchTool(vectorStoreIds: List) =
addTool(FileSearchTool.builder().vectorStoreIds(vectorStoreIds).build())
+ /** Alias for calling [addTool] with `Tool.ofComputer(computer)`. */
+ fun addTool(computer: ComputerUseTool) = addTool(Tool.ofComputer(computer))
+
/**
* Alias for calling [addTool] with
* `Tool.ofComputerUsePreview(computerUsePreview)`.
@@ -6352,6 +6358,12 @@ private constructor(
fun addCustomTool(name: String) =
addTool(CustomTool.builder().name(name).build())
+ /** Alias for calling [addTool] with `Tool.ofNamespace(namespace)`. */
+ fun addTool(namespace: NamespaceTool) = addTool(Tool.ofNamespace(namespace))
+
+ /** Alias for calling [addTool] with `Tool.ofSearch(search)`. */
+ fun addTool(search: ToolSearchTool) = addTool(Tool.ofSearch(search))
+
/**
* Alias for calling [addTool] with `Tool.ofWebSearchPreview(webSearchPreview)`.
*/
diff --git a/openai-java-core/src/main/kotlin/com/openai/models/evals/runs/RunCreateResponse.kt b/openai-java-core/src/main/kotlin/com/openai/models/evals/runs/RunCreateResponse.kt
index f434b9e82..5ea1b8477 100644
--- a/openai-java-core/src/main/kotlin/com/openai/models/evals/runs/RunCreateResponse.kt
+++ b/openai-java-core/src/main/kotlin/com/openai/models/evals/runs/RunCreateResponse.kt
@@ -32,15 +32,18 @@ import com.openai.models.ResponseFormatText
import com.openai.models.graders.gradermodels.EvalContentItem
import com.openai.models.responses.ApplyPatchTool
import com.openai.models.responses.ComputerTool
+import com.openai.models.responses.ComputerUseTool
import com.openai.models.responses.CustomTool
import com.openai.models.responses.FileSearchTool
import com.openai.models.responses.FunctionShellTool
import com.openai.models.responses.FunctionTool
+import com.openai.models.responses.NamespaceTool
import com.openai.models.responses.ResponseFormatTextConfig
import com.openai.models.responses.ResponseFormatTextJsonSchemaConfig
import com.openai.models.responses.ResponseInputAudio
import com.openai.models.responses.ResponseInputText
import com.openai.models.responses.Tool
+import com.openai.models.responses.ToolSearchTool
import com.openai.models.responses.WebSearchPreviewTool
import com.openai.models.responses.WebSearchTool
import java.util.Collections
@@ -6379,6 +6382,9 @@ private constructor(
fun addFileSearchTool(vectorStoreIds: List) =
addTool(FileSearchTool.builder().vectorStoreIds(vectorStoreIds).build())
+ /** Alias for calling [addTool] with `Tool.ofComputer(computer)`. */
+ fun addTool(computer: ComputerUseTool) = addTool(Tool.ofComputer(computer))
+
/**
* Alias for calling [addTool] with
* `Tool.ofComputerUsePreview(computerUsePreview)`.
@@ -6467,6 +6473,12 @@ private constructor(
fun addCustomTool(name: String) =
addTool(CustomTool.builder().name(name).build())
+ /** Alias for calling [addTool] with `Tool.ofNamespace(namespace)`. */
+ fun addTool(namespace: NamespaceTool) = addTool(Tool.ofNamespace(namespace))
+
+ /** Alias for calling [addTool] with `Tool.ofSearch(search)`. */
+ fun addTool(search: ToolSearchTool) = addTool(Tool.ofSearch(search))
+
/**
* Alias for calling [addTool] with `Tool.ofWebSearchPreview(webSearchPreview)`.
*/
diff --git a/openai-java-core/src/main/kotlin/com/openai/models/evals/runs/RunListResponse.kt b/openai-java-core/src/main/kotlin/com/openai/models/evals/runs/RunListResponse.kt
index d193f6950..4ea2fcb38 100644
--- a/openai-java-core/src/main/kotlin/com/openai/models/evals/runs/RunListResponse.kt
+++ b/openai-java-core/src/main/kotlin/com/openai/models/evals/runs/RunListResponse.kt
@@ -32,15 +32,18 @@ import com.openai.models.ResponseFormatText
import com.openai.models.graders.gradermodels.EvalContentItem
import com.openai.models.responses.ApplyPatchTool
import com.openai.models.responses.ComputerTool
+import com.openai.models.responses.ComputerUseTool
import com.openai.models.responses.CustomTool
import com.openai.models.responses.FileSearchTool
import com.openai.models.responses.FunctionShellTool
import com.openai.models.responses.FunctionTool
+import com.openai.models.responses.NamespaceTool
import com.openai.models.responses.ResponseFormatTextConfig
import com.openai.models.responses.ResponseFormatTextJsonSchemaConfig
import com.openai.models.responses.ResponseInputAudio
import com.openai.models.responses.ResponseInputText
import com.openai.models.responses.Tool
+import com.openai.models.responses.ToolSearchTool
import com.openai.models.responses.WebSearchPreviewTool
import com.openai.models.responses.WebSearchTool
import java.util.Collections
@@ -6379,6 +6382,9 @@ private constructor(
fun addFileSearchTool(vectorStoreIds: List) =
addTool(FileSearchTool.builder().vectorStoreIds(vectorStoreIds).build())
+ /** Alias for calling [addTool] with `Tool.ofComputer(computer)`. */
+ fun addTool(computer: ComputerUseTool) = addTool(Tool.ofComputer(computer))
+
/**
* Alias for calling [addTool] with
* `Tool.ofComputerUsePreview(computerUsePreview)`.
@@ -6467,6 +6473,12 @@ private constructor(
fun addCustomTool(name: String) =
addTool(CustomTool.builder().name(name).build())
+ /** Alias for calling [addTool] with `Tool.ofNamespace(namespace)`. */
+ fun addTool(namespace: NamespaceTool) = addTool(Tool.ofNamespace(namespace))
+
+ /** Alias for calling [addTool] with `Tool.ofSearch(search)`. */
+ fun addTool(search: ToolSearchTool) = addTool(Tool.ofSearch(search))
+
/**
* Alias for calling [addTool] with `Tool.ofWebSearchPreview(webSearchPreview)`.
*/
diff --git a/openai-java-core/src/main/kotlin/com/openai/models/evals/runs/RunRetrieveResponse.kt b/openai-java-core/src/main/kotlin/com/openai/models/evals/runs/RunRetrieveResponse.kt
index 1bef9fc8d..c13a0eaf2 100644
--- a/openai-java-core/src/main/kotlin/com/openai/models/evals/runs/RunRetrieveResponse.kt
+++ b/openai-java-core/src/main/kotlin/com/openai/models/evals/runs/RunRetrieveResponse.kt
@@ -32,15 +32,18 @@ import com.openai.models.ResponseFormatText
import com.openai.models.graders.gradermodels.EvalContentItem
import com.openai.models.responses.ApplyPatchTool
import com.openai.models.responses.ComputerTool
+import com.openai.models.responses.ComputerUseTool
import com.openai.models.responses.CustomTool
import com.openai.models.responses.FileSearchTool
import com.openai.models.responses.FunctionShellTool
import com.openai.models.responses.FunctionTool
+import com.openai.models.responses.NamespaceTool
import com.openai.models.responses.ResponseFormatTextConfig
import com.openai.models.responses.ResponseFormatTextJsonSchemaConfig
import com.openai.models.responses.ResponseInputAudio
import com.openai.models.responses.ResponseInputText
import com.openai.models.responses.Tool
+import com.openai.models.responses.ToolSearchTool
import com.openai.models.responses.WebSearchPreviewTool
import com.openai.models.responses.WebSearchTool
import java.util.Collections
@@ -6379,6 +6382,9 @@ private constructor(
fun addFileSearchTool(vectorStoreIds: List) =
addTool(FileSearchTool.builder().vectorStoreIds(vectorStoreIds).build())
+ /** Alias for calling [addTool] with `Tool.ofComputer(computer)`. */
+ fun addTool(computer: ComputerUseTool) = addTool(Tool.ofComputer(computer))
+
/**
* Alias for calling [addTool] with
* `Tool.ofComputerUsePreview(computerUsePreview)`.
@@ -6467,6 +6473,12 @@ private constructor(
fun addCustomTool(name: String) =
addTool(CustomTool.builder().name(name).build())
+ /** Alias for calling [addTool] with `Tool.ofNamespace(namespace)`. */
+ fun addTool(namespace: NamespaceTool) = addTool(Tool.ofNamespace(namespace))
+
+ /** Alias for calling [addTool] with `Tool.ofSearch(search)`. */
+ fun addTool(search: ToolSearchTool) = addTool(Tool.ofSearch(search))
+
/**
* Alias for calling [addTool] with `Tool.ofWebSearchPreview(webSearchPreview)`.
*/
diff --git a/openai-java-core/src/main/kotlin/com/openai/models/realtime/RealtimeResponseCreateMcpTool.kt b/openai-java-core/src/main/kotlin/com/openai/models/realtime/RealtimeResponseCreateMcpTool.kt
index 2df36a165..7eb9809c5 100644
--- a/openai-java-core/src/main/kotlin/com/openai/models/realtime/RealtimeResponseCreateMcpTool.kt
+++ b/openai-java-core/src/main/kotlin/com/openai/models/realtime/RealtimeResponseCreateMcpTool.kt
@@ -43,6 +43,7 @@ private constructor(
private val allowedTools: JsonField,
private val authorization: JsonField,
private val connectorId: JsonField,
+ private val deferLoading: JsonField,
private val headers: JsonField,
private val requireApproval: JsonField,
private val serverDescription: JsonField,
@@ -65,6 +66,9 @@ private constructor(
@JsonProperty("connector_id")
@ExcludeMissing
connectorId: JsonField = JsonMissing.of(),
+ @JsonProperty("defer_loading")
+ @ExcludeMissing
+ deferLoading: JsonField = JsonMissing.of(),
@JsonProperty("headers") @ExcludeMissing headers: JsonField = JsonMissing.of(),
@JsonProperty("require_approval")
@ExcludeMissing
@@ -79,6 +83,7 @@ private constructor(
allowedTools,
authorization,
connectorId,
+ deferLoading,
headers,
requireApproval,
serverDescription,
@@ -145,6 +150,14 @@ private constructor(
*/
fun connectorId(): Optional = connectorId.getOptional("connector_id")
+ /**
+ * Whether this MCP tool is deferred and discovered via tool search.
+ *
+ * @throws OpenAIInvalidDataException if the JSON field has an unexpected type (e.g. if the
+ * server responded with an unexpected value).
+ */
+ fun deferLoading(): Optional = deferLoading.getOptional("defer_loading")
+
/**
* Optional HTTP headers to send to the MCP server. Use for authentication or other purposes.
*
@@ -214,6 +227,15 @@ private constructor(
@ExcludeMissing
fun _connectorId(): JsonField = connectorId
+ /**
+ * Returns the raw JSON value of [deferLoading].
+ *
+ * Unlike [deferLoading], this method doesn't throw if the JSON field has an unexpected type.
+ */
+ @JsonProperty("defer_loading")
+ @ExcludeMissing
+ fun _deferLoading(): JsonField = deferLoading
+
/**
* Returns the raw JSON value of [headers].
*
@@ -281,6 +303,7 @@ private constructor(
private var allowedTools: JsonField = JsonMissing.of()
private var authorization: JsonField = JsonMissing.of()
private var connectorId: JsonField = JsonMissing.of()
+ private var deferLoading: JsonField = JsonMissing.of()
private var headers: JsonField = JsonMissing.of()
private var requireApproval: JsonField = JsonMissing.of()
private var serverDescription: JsonField = JsonMissing.of()
@@ -294,6 +317,7 @@ private constructor(
allowedTools = realtimeResponseCreateMcpTool.allowedTools
authorization = realtimeResponseCreateMcpTool.authorization
connectorId = realtimeResponseCreateMcpTool.connectorId
+ deferLoading = realtimeResponseCreateMcpTool.deferLoading
headers = realtimeResponseCreateMcpTool.headers
requireApproval = realtimeResponseCreateMcpTool.requireApproval
serverDescription = realtimeResponseCreateMcpTool.serverDescription
@@ -399,6 +423,20 @@ private constructor(
this.connectorId = connectorId
}
+ /** Whether this MCP tool is deferred and discovered via tool search. */
+ fun deferLoading(deferLoading: Boolean) = deferLoading(JsonField.of(deferLoading))
+
+ /**
+ * Sets [Builder.deferLoading] to an arbitrary JSON value.
+ *
+ * You should usually call [Builder.deferLoading] with a well-typed [Boolean] value instead.
+ * This method is primarily for setting the field to an undocumented or not yet supported
+ * value.
+ */
+ fun deferLoading(deferLoading: JsonField) = apply {
+ this.deferLoading = deferLoading
+ }
+
/**
* Optional HTTP headers to send to the MCP server. Use for authentication or other
* purposes.
@@ -514,6 +552,7 @@ private constructor(
allowedTools,
authorization,
connectorId,
+ deferLoading,
headers,
requireApproval,
serverDescription,
@@ -538,6 +577,7 @@ private constructor(
allowedTools().ifPresent { it.validate() }
authorization()
connectorId().ifPresent { it.validate() }
+ deferLoading()
headers().ifPresent { it.validate() }
requireApproval().ifPresent { it.validate() }
serverDescription()
@@ -565,6 +605,7 @@ private constructor(
(allowedTools.asKnown().getOrNull()?.validity() ?: 0) +
(if (authorization.asKnown().isPresent) 1 else 0) +
(connectorId.asKnown().getOrNull()?.validity() ?: 0) +
+ (if (deferLoading.asKnown().isPresent) 1 else 0) +
(headers.asKnown().getOrNull()?.validity() ?: 0) +
(requireApproval.asKnown().getOrNull()?.validity() ?: 0) +
(if (serverDescription.asKnown().isPresent) 1 else 0) +
@@ -2270,6 +2311,7 @@ private constructor(
allowedTools == other.allowedTools &&
authorization == other.authorization &&
connectorId == other.connectorId &&
+ deferLoading == other.deferLoading &&
headers == other.headers &&
requireApproval == other.requireApproval &&
serverDescription == other.serverDescription &&
@@ -2284,6 +2326,7 @@ private constructor(
allowedTools,
authorization,
connectorId,
+ deferLoading,
headers,
requireApproval,
serverDescription,
@@ -2295,5 +2338,5 @@ private constructor(
override fun hashCode(): Int = hashCode
override fun toString() =
- "RealtimeResponseCreateMcpTool{serverLabel=$serverLabel, type=$type, allowedTools=$allowedTools, authorization=$authorization, connectorId=$connectorId, headers=$headers, requireApproval=$requireApproval, serverDescription=$serverDescription, serverUrl=$serverUrl, additionalProperties=$additionalProperties}"
+ "RealtimeResponseCreateMcpTool{serverLabel=$serverLabel, type=$type, allowedTools=$allowedTools, authorization=$authorization, connectorId=$connectorId, deferLoading=$deferLoading, headers=$headers, requireApproval=$requireApproval, serverDescription=$serverDescription, serverUrl=$serverUrl, additionalProperties=$additionalProperties}"
}
diff --git a/openai-java-core/src/main/kotlin/com/openai/models/realtime/RealtimeToolsConfigUnion.kt b/openai-java-core/src/main/kotlin/com/openai/models/realtime/RealtimeToolsConfigUnion.kt
index 2f4adfa70..d9ec7606d 100644
--- a/openai-java-core/src/main/kotlin/com/openai/models/realtime/RealtimeToolsConfigUnion.kt
+++ b/openai-java-core/src/main/kotlin/com/openai/models/realtime/RealtimeToolsConfigUnion.kt
@@ -234,6 +234,7 @@ private constructor(
private val allowedTools: JsonField,
private val authorization: JsonField,
private val connectorId: JsonField,
+ private val deferLoading: JsonField,
private val headers: JsonField,
private val requireApproval: JsonField,
private val serverDescription: JsonField,
@@ -256,6 +257,9 @@ private constructor(
@JsonProperty("connector_id")
@ExcludeMissing
connectorId: JsonField = JsonMissing.of(),
+ @JsonProperty("defer_loading")
+ @ExcludeMissing
+ deferLoading: JsonField = JsonMissing.of(),
@JsonProperty("headers") @ExcludeMissing headers: JsonField = JsonMissing.of(),
@JsonProperty("require_approval")
@ExcludeMissing
@@ -272,6 +276,7 @@ private constructor(
allowedTools,
authorization,
connectorId,
+ deferLoading,
headers,
requireApproval,
serverDescription,
@@ -338,6 +343,14 @@ private constructor(
*/
fun connectorId(): Optional = connectorId.getOptional("connector_id")
+ /**
+ * Whether this MCP tool is deferred and discovered via tool search.
+ *
+ * @throws OpenAIInvalidDataException if the JSON field has an unexpected type (e.g. if the
+ * server responded with an unexpected value).
+ */
+ fun deferLoading(): Optional = deferLoading.getOptional("defer_loading")
+
/**
* Optional HTTP headers to send to the MCP server. Use for authentication or other
* purposes.
@@ -411,6 +424,16 @@ private constructor(
@ExcludeMissing
fun _connectorId(): JsonField = connectorId
+ /**
+ * Returns the raw JSON value of [deferLoading].
+ *
+ * Unlike [deferLoading], this method doesn't throw if the JSON field has an unexpected
+ * type.
+ */
+ @JsonProperty("defer_loading")
+ @ExcludeMissing
+ fun _deferLoading(): JsonField = deferLoading
+
/**
* Returns the raw JSON value of [headers].
*
@@ -478,6 +501,7 @@ private constructor(
private var allowedTools: JsonField = JsonMissing.of()
private var authorization: JsonField = JsonMissing.of()
private var connectorId: JsonField = JsonMissing.of()
+ private var deferLoading: JsonField = JsonMissing.of()
private var headers: JsonField = JsonMissing.of()
private var requireApproval: JsonField = JsonMissing.of()
private var serverDescription: JsonField = JsonMissing.of()
@@ -491,6 +515,7 @@ private constructor(
allowedTools = mcp.allowedTools
authorization = mcp.authorization
connectorId = mcp.connectorId
+ deferLoading = mcp.deferLoading
headers = mcp.headers
requireApproval = mcp.requireApproval
serverDescription = mcp.serverDescription
@@ -600,6 +625,20 @@ private constructor(
this.connectorId = connectorId
}
+ /** Whether this MCP tool is deferred and discovered via tool search. */
+ fun deferLoading(deferLoading: Boolean) = deferLoading(JsonField.of(deferLoading))
+
+ /**
+ * Sets [Builder.deferLoading] to an arbitrary JSON value.
+ *
+ * You should usually call [Builder.deferLoading] with a well-typed [Boolean] value
+ * instead. This method is primarily for setting the field to an undocumented or not yet
+ * supported value.
+ */
+ fun deferLoading(deferLoading: JsonField) = apply {
+ this.deferLoading = deferLoading
+ }
+
/**
* Optional HTTP headers to send to the MCP server. Use for authentication or other
* purposes.
@@ -718,6 +757,7 @@ private constructor(
allowedTools,
authorization,
connectorId,
+ deferLoading,
headers,
requireApproval,
serverDescription,
@@ -742,6 +782,7 @@ private constructor(
allowedTools().ifPresent { it.validate() }
authorization()
connectorId().ifPresent { it.validate() }
+ deferLoading()
headers().ifPresent { it.validate() }
requireApproval().ifPresent { it.validate() }
serverDescription()
@@ -770,6 +811,7 @@ private constructor(
(allowedTools.asKnown().getOrNull()?.validity() ?: 0) +
(if (authorization.asKnown().isPresent) 1 else 0) +
(connectorId.asKnown().getOrNull()?.validity() ?: 0) +
+ (if (deferLoading.asKnown().isPresent) 1 else 0) +
(headers.asKnown().getOrNull()?.validity() ?: 0) +
(requireApproval.asKnown().getOrNull()?.validity() ?: 0) +
(if (serverDescription.asKnown().isPresent) 1 else 0) +
@@ -2507,6 +2549,7 @@ private constructor(
allowedTools == other.allowedTools &&
authorization == other.authorization &&
connectorId == other.connectorId &&
+ deferLoading == other.deferLoading &&
headers == other.headers &&
requireApproval == other.requireApproval &&
serverDescription == other.serverDescription &&
@@ -2521,6 +2564,7 @@ private constructor(
allowedTools,
authorization,
connectorId,
+ deferLoading,
headers,
requireApproval,
serverDescription,
@@ -2532,6 +2576,6 @@ private constructor(
override fun hashCode(): Int = hashCode
override fun toString() =
- "Mcp{serverLabel=$serverLabel, type=$type, allowedTools=$allowedTools, authorization=$authorization, connectorId=$connectorId, headers=$headers, requireApproval=$requireApproval, serverDescription=$serverDescription, serverUrl=$serverUrl, additionalProperties=$additionalProperties}"
+ "Mcp{serverLabel=$serverLabel, type=$type, allowedTools=$allowedTools, authorization=$authorization, connectorId=$connectorId, deferLoading=$deferLoading, headers=$headers, requireApproval=$requireApproval, serverDescription=$serverDescription, serverUrl=$serverUrl, additionalProperties=$additionalProperties}"
}
}
diff --git a/openai-java-core/src/main/kotlin/com/openai/models/realtime/clientsecrets/RealtimeSessionCreateResponse.kt b/openai-java-core/src/main/kotlin/com/openai/models/realtime/clientsecrets/RealtimeSessionCreateResponse.kt
index 958dcb920..438da7053 100644
--- a/openai-java-core/src/main/kotlin/com/openai/models/realtime/clientsecrets/RealtimeSessionCreateResponse.kt
+++ b/openai-java-core/src/main/kotlin/com/openai/models/realtime/clientsecrets/RealtimeSessionCreateResponse.kt
@@ -4344,6 +4344,7 @@ private constructor(
private val allowedTools: JsonField,
private val authorization: JsonField,
private val connectorId: JsonField,
+ private val deferLoading: JsonField,
private val headers: JsonField,
private val requireApproval: JsonField,
private val serverDescription: JsonField,
@@ -4366,6 +4367,9 @@ private constructor(
@JsonProperty("connector_id")
@ExcludeMissing
connectorId: JsonField = JsonMissing.of(),
+ @JsonProperty("defer_loading")
+ @ExcludeMissing
+ deferLoading: JsonField = JsonMissing.of(),
@JsonProperty("headers")
@ExcludeMissing
headers: JsonField = JsonMissing.of(),
@@ -4384,6 +4388,7 @@ private constructor(
allowedTools,
authorization,
connectorId,
+ deferLoading,
headers,
requireApproval,
serverDescription,
@@ -4451,6 +4456,14 @@ private constructor(
*/
fun connectorId(): Optional = connectorId.getOptional("connector_id")
+ /**
+ * Whether this MCP tool is deferred and discovered via tool search.
+ *
+ * @throws OpenAIInvalidDataException if the JSON field has an unexpected type (e.g. if
+ * the server responded with an unexpected value).
+ */
+ fun deferLoading(): Optional = deferLoading.getOptional("defer_loading")
+
/**
* Optional HTTP headers to send to the MCP server. Use for authentication or other
* purposes.
@@ -4526,6 +4539,16 @@ private constructor(
@ExcludeMissing
fun _connectorId(): JsonField = connectorId
+ /**
+ * Returns the raw JSON value of [deferLoading].
+ *
+ * Unlike [deferLoading], this method doesn't throw if the JSON field has an unexpected
+ * type.
+ */
+ @JsonProperty("defer_loading")
+ @ExcludeMissing
+ fun _deferLoading(): JsonField = deferLoading
+
/**
* Returns the raw JSON value of [headers].
*
@@ -4596,6 +4619,7 @@ private constructor(
private var allowedTools: JsonField = JsonMissing.of()
private var authorization: JsonField = JsonMissing.of()
private var connectorId: JsonField = JsonMissing.of()
+ private var deferLoading: JsonField = JsonMissing.of()
private var headers: JsonField = JsonMissing.of()
private var requireApproval: JsonField = JsonMissing.of()
private var serverDescription: JsonField = JsonMissing.of()
@@ -4609,6 +4633,7 @@ private constructor(
allowedTools = mcpTool.allowedTools
authorization = mcpTool.authorization
connectorId = mcpTool.connectorId
+ deferLoading = mcpTool.deferLoading
headers = mcpTool.headers
requireApproval = mcpTool.requireApproval
serverDescription = mcpTool.serverDescription
@@ -4721,6 +4746,20 @@ private constructor(
this.connectorId = connectorId
}
+ /** Whether this MCP tool is deferred and discovered via tool search. */
+ fun deferLoading(deferLoading: Boolean) = deferLoading(JsonField.of(deferLoading))
+
+ /**
+ * Sets [Builder.deferLoading] to an arbitrary JSON value.
+ *
+ * You should usually call [Builder.deferLoading] with a well-typed [Boolean] value
+ * instead. This method is primarily for setting the field to an undocumented or not
+ * yet supported value.
+ */
+ fun deferLoading(deferLoading: JsonField) = apply {
+ this.deferLoading = deferLoading
+ }
+
/**
* Optional HTTP headers to send to the MCP server. Use for authentication or other
* purposes.
@@ -4849,6 +4888,7 @@ private constructor(
allowedTools,
authorization,
connectorId,
+ deferLoading,
headers,
requireApproval,
serverDescription,
@@ -4873,6 +4913,7 @@ private constructor(
allowedTools().ifPresent { it.validate() }
authorization()
connectorId().ifPresent { it.validate() }
+ deferLoading()
headers().ifPresent { it.validate() }
requireApproval().ifPresent { it.validate() }
serverDescription()
@@ -4901,6 +4942,7 @@ private constructor(
(allowedTools.asKnown().getOrNull()?.validity() ?: 0) +
(if (authorization.asKnown().isPresent) 1 else 0) +
(connectorId.asKnown().getOrNull()?.validity() ?: 0) +
+ (if (deferLoading.asKnown().isPresent) 1 else 0) +
(headers.asKnown().getOrNull()?.validity() ?: 0) +
(requireApproval.asKnown().getOrNull()?.validity() ?: 0) +
(if (serverDescription.asKnown().isPresent) 1 else 0) +
@@ -6679,6 +6721,7 @@ private constructor(
allowedTools == other.allowedTools &&
authorization == other.authorization &&
connectorId == other.connectorId &&
+ deferLoading == other.deferLoading &&
headers == other.headers &&
requireApproval == other.requireApproval &&
serverDescription == other.serverDescription &&
@@ -6693,6 +6736,7 @@ private constructor(
allowedTools,
authorization,
connectorId,
+ deferLoading,
headers,
requireApproval,
serverDescription,
@@ -6704,7 +6748,7 @@ private constructor(
override fun hashCode(): Int = hashCode
override fun toString() =
- "McpTool{serverLabel=$serverLabel, type=$type, allowedTools=$allowedTools, authorization=$authorization, connectorId=$connectorId, headers=$headers, requireApproval=$requireApproval, serverDescription=$serverDescription, serverUrl=$serverUrl, additionalProperties=$additionalProperties}"
+ "McpTool{serverLabel=$serverLabel, type=$type, allowedTools=$allowedTools, authorization=$authorization, connectorId=$connectorId, deferLoading=$deferLoading, headers=$headers, requireApproval=$requireApproval, serverDescription=$serverDescription, serverUrl=$serverUrl, additionalProperties=$additionalProperties}"
}
}
diff --git a/openai-java-core/src/main/kotlin/com/openai/models/responses/CompactedResponse.kt b/openai-java-core/src/main/kotlin/com/openai/models/responses/CompactedResponse.kt
index fae2bd3b8..b2931c66a 100644
--- a/openai-java-core/src/main/kotlin/com/openai/models/responses/CompactedResponse.kt
+++ b/openai-java-core/src/main/kotlin/com/openai/models/responses/CompactedResponse.kt
@@ -257,6 +257,19 @@ private constructor(
fun addOutput(reasoning: ResponseReasoningItem) =
addOutput(ResponseOutputItem.ofReasoning(reasoning))
+ /**
+ * Alias for calling [addOutput] with `ResponseOutputItem.ofToolSearchCall(toolSearchCall)`.
+ */
+ fun addOutput(toolSearchCall: ResponseToolSearchCall) =
+ addOutput(ResponseOutputItem.ofToolSearchCall(toolSearchCall))
+
+ /**
+ * Alias for calling [addOutput] with
+ * `ResponseOutputItem.ofToolSearchOutput(toolSearchOutput)`.
+ */
+ fun addOutput(toolSearchOutput: ResponseToolSearchOutputItem) =
+ addOutput(ResponseOutputItem.ofToolSearchOutput(toolSearchOutput))
+
/** Alias for calling [addOutput] with `ResponseOutputItem.ofCompaction(compaction)`. */
fun addOutput(compaction: ResponseCompactionItem) =
addOutput(ResponseOutputItem.ofCompaction(compaction))
diff --git a/openai-java-core/src/main/kotlin/com/openai/models/responses/ComputerAction.kt b/openai-java-core/src/main/kotlin/com/openai/models/responses/ComputerAction.kt
new file mode 100644
index 000000000..bd1979712
--- /dev/null
+++ b/openai-java-core/src/main/kotlin/com/openai/models/responses/ComputerAction.kt
@@ -0,0 +1,2506 @@
+// File generated from our OpenAPI spec by Stainless.
+
+package com.openai.models.responses
+
+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.fasterxml.jackson.core.JsonGenerator
+import com.fasterxml.jackson.core.ObjectCodec
+import com.fasterxml.jackson.databind.JsonNode
+import com.fasterxml.jackson.databind.SerializerProvider
+import com.fasterxml.jackson.databind.annotation.JsonDeserialize
+import com.fasterxml.jackson.databind.annotation.JsonSerialize
+import com.fasterxml.jackson.module.kotlin.jacksonTypeRef
+import com.openai.core.BaseDeserializer
+import com.openai.core.BaseSerializer
+import com.openai.core.Enum
+import com.openai.core.ExcludeMissing
+import com.openai.core.JsonField
+import com.openai.core.JsonMissing
+import com.openai.core.JsonValue
+import com.openai.core.checkKnown
+import com.openai.core.checkRequired
+import com.openai.core.getOrThrow
+import com.openai.core.toImmutable
+import com.openai.errors.OpenAIInvalidDataException
+import java.util.Collections
+import java.util.Objects
+import java.util.Optional
+import kotlin.jvm.optionals.getOrNull
+
+/** A click action. */
+@JsonDeserialize(using = ComputerAction.Deserializer::class)
+@JsonSerialize(using = ComputerAction.Serializer::class)
+class ComputerAction
+private constructor(
+ private val click: Click? = null,
+ private val doubleClick: DoubleClick? = null,
+ private val drag: Drag? = null,
+ private val keypress: Keypress? = null,
+ private val move: Move? = null,
+ private val screenshot: JsonValue? = null,
+ private val scroll: Scroll? = null,
+ private val type: Type? = null,
+ private val wait: JsonValue? = null,
+ private val _json: JsonValue? = null,
+) {
+
+ /** A click action. */
+ fun click(): Optional = Optional.ofNullable(click)
+
+ /** A double click action. */
+ fun doubleClick(): Optional = Optional.ofNullable(doubleClick)
+
+ /** A drag action. */
+ fun drag(): Optional = Optional.ofNullable(drag)
+
+ /** A collection of keypresses the model would like to perform. */
+ fun keypress(): Optional = Optional.ofNullable(keypress)
+
+ /** A mouse move action. */
+ fun move(): Optional = Optional.ofNullable(move)
+
+ /** A screenshot action. */
+ fun screenshot(): Optional = Optional.ofNullable(screenshot)
+
+ /** A scroll action. */
+ fun scroll(): Optional = Optional.ofNullable(scroll)
+
+ /** An action to type in text. */
+ fun type(): Optional = Optional.ofNullable(type)
+
+ /** A wait action. */
+ fun wait(): Optional = Optional.ofNullable(wait)
+
+ fun isClick(): Boolean = click != null
+
+ fun isDoubleClick(): Boolean = doubleClick != null
+
+ fun isDrag(): Boolean = drag != null
+
+ fun isKeypress(): Boolean = keypress != null
+
+ fun isMove(): Boolean = move != null
+
+ fun isScreenshot(): Boolean = screenshot != null
+
+ fun isScroll(): Boolean = scroll != null
+
+ fun isType(): Boolean = type != null
+
+ fun isWait(): Boolean = wait != null
+
+ /** A click action. */
+ fun asClick(): Click = click.getOrThrow("click")
+
+ /** A double click action. */
+ fun asDoubleClick(): DoubleClick = doubleClick.getOrThrow("doubleClick")
+
+ /** A drag action. */
+ fun asDrag(): Drag = drag.getOrThrow("drag")
+
+ /** A collection of keypresses the model would like to perform. */
+ fun asKeypress(): Keypress = keypress.getOrThrow("keypress")
+
+ /** A mouse move action. */
+ fun asMove(): Move = move.getOrThrow("move")
+
+ /** A screenshot action. */
+ fun asScreenshot(): JsonValue = screenshot.getOrThrow("screenshot")
+
+ /** A scroll action. */
+ fun asScroll(): Scroll = scroll.getOrThrow("scroll")
+
+ /** An action to type in text. */
+ fun asType(): Type = type.getOrThrow("type")
+
+ /** A wait action. */
+ fun asWait(): JsonValue = wait.getOrThrow("wait")
+
+ fun _json(): Optional = Optional.ofNullable(_json)
+
+ fun accept(visitor: Visitor): T =
+ when {
+ click != null -> visitor.visitClick(click)
+ doubleClick != null -> visitor.visitDoubleClick(doubleClick)
+ drag != null -> visitor.visitDrag(drag)
+ keypress != null -> visitor.visitKeypress(keypress)
+ move != null -> visitor.visitMove(move)
+ screenshot != null -> visitor.visitScreenshot(screenshot)
+ scroll != null -> visitor.visitScroll(scroll)
+ type != null -> visitor.visitType(type)
+ wait != null -> visitor.visitWait(wait)
+ else -> visitor.unknown(_json)
+ }
+
+ private var validated: Boolean = false
+
+ fun validate(): ComputerAction = apply {
+ if (validated) {
+ return@apply
+ }
+
+ accept(
+ object : Visitor {
+ override fun visitClick(click: Click) {
+ click.validate()
+ }
+
+ override fun visitDoubleClick(doubleClick: DoubleClick) {
+ doubleClick.validate()
+ }
+
+ override fun visitDrag(drag: Drag) {
+ drag.validate()
+ }
+
+ override fun visitKeypress(keypress: Keypress) {
+ keypress.validate()
+ }
+
+ override fun visitMove(move: Move) {
+ move.validate()
+ }
+
+ override fun visitScreenshot(screenshot: JsonValue) {
+ screenshot.let {
+ if (it != JsonValue.from(mapOf("type" to "screenshot"))) {
+ throw OpenAIInvalidDataException(
+ "'screenshot' is invalid, received $it"
+ )
+ }
+ }
+ }
+
+ override fun visitScroll(scroll: Scroll) {
+ scroll.validate()
+ }
+
+ override fun visitType(type: Type) {
+ type.validate()
+ }
+
+ override fun visitWait(wait: JsonValue) {
+ wait.let {
+ if (it != JsonValue.from(mapOf("type" to "wait"))) {
+ throw OpenAIInvalidDataException("'wait' is invalid, received $it")
+ }
+ }
+ }
+ }
+ )
+ 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 =
+ accept(
+ object : Visitor {
+ override fun visitClick(click: Click) = click.validity()
+
+ override fun visitDoubleClick(doubleClick: DoubleClick) = doubleClick.validity()
+
+ override fun visitDrag(drag: Drag) = drag.validity()
+
+ override fun visitKeypress(keypress: Keypress) = keypress.validity()
+
+ override fun visitMove(move: Move) = move.validity()
+
+ override fun visitScreenshot(screenshot: JsonValue) =
+ screenshot.let {
+ if (it == JsonValue.from(mapOf("type" to "screenshot"))) 1 else 0
+ }
+
+ override fun visitScroll(scroll: Scroll) = scroll.validity()
+
+ override fun visitType(type: Type) = type.validity()
+
+ override fun visitWait(wait: JsonValue) =
+ wait.let { if (it == JsonValue.from(mapOf("type" to "wait"))) 1 else 0 }
+
+ override fun unknown(json: JsonValue?) = 0
+ }
+ )
+
+ override fun equals(other: Any?): Boolean {
+ if (this === other) {
+ return true
+ }
+
+ return other is ComputerAction &&
+ click == other.click &&
+ doubleClick == other.doubleClick &&
+ drag == other.drag &&
+ keypress == other.keypress &&
+ move == other.move &&
+ screenshot == other.screenshot &&
+ scroll == other.scroll &&
+ type == other.type &&
+ wait == other.wait
+ }
+
+ override fun hashCode(): Int =
+ Objects.hash(click, doubleClick, drag, keypress, move, screenshot, scroll, type, wait)
+
+ override fun toString(): String =
+ when {
+ click != null -> "ComputerAction{click=$click}"
+ doubleClick != null -> "ComputerAction{doubleClick=$doubleClick}"
+ drag != null -> "ComputerAction{drag=$drag}"
+ keypress != null -> "ComputerAction{keypress=$keypress}"
+ move != null -> "ComputerAction{move=$move}"
+ screenshot != null -> "ComputerAction{screenshot=$screenshot}"
+ scroll != null -> "ComputerAction{scroll=$scroll}"
+ type != null -> "ComputerAction{type=$type}"
+ wait != null -> "ComputerAction{wait=$wait}"
+ _json != null -> "ComputerAction{_unknown=$_json}"
+ else -> throw IllegalStateException("Invalid ComputerAction")
+ }
+
+ companion object {
+
+ /** A click action. */
+ @JvmStatic fun ofClick(click: Click) = ComputerAction(click = click)
+
+ /** A double click action. */
+ @JvmStatic
+ fun ofDoubleClick(doubleClick: DoubleClick) = ComputerAction(doubleClick = doubleClick)
+
+ /** A drag action. */
+ @JvmStatic fun ofDrag(drag: Drag) = ComputerAction(drag = drag)
+
+ /** A collection of keypresses the model would like to perform. */
+ @JvmStatic fun ofKeypress(keypress: Keypress) = ComputerAction(keypress = keypress)
+
+ /** A mouse move action. */
+ @JvmStatic fun ofMove(move: Move) = ComputerAction(move = move)
+
+ /** A screenshot action. */
+ @JvmStatic
+ fun ofScreenshot() =
+ ComputerAction(screenshot = JsonValue.from(mapOf("type" to "screenshot")))
+
+ /** A scroll action. */
+ @JvmStatic fun ofScroll(scroll: Scroll) = ComputerAction(scroll = scroll)
+
+ /** An action to type in text. */
+ @JvmStatic fun ofType(type: Type) = ComputerAction(type = type)
+
+ /** A wait action. */
+ @JvmStatic fun ofWait() = ComputerAction(wait = JsonValue.from(mapOf("type" to "wait")))
+ }
+
+ /**
+ * An interface that defines how to map each variant of [ComputerAction] to a value of type [T].
+ */
+ interface Visitor {
+
+ /** A click action. */
+ fun visitClick(click: Click): T
+
+ /** A double click action. */
+ fun visitDoubleClick(doubleClick: DoubleClick): T
+
+ /** A drag action. */
+ fun visitDrag(drag: Drag): T
+
+ /** A collection of keypresses the model would like to perform. */
+ fun visitKeypress(keypress: Keypress): T
+
+ /** A mouse move action. */
+ fun visitMove(move: Move): T
+
+ /** A screenshot action. */
+ fun visitScreenshot(screenshot: JsonValue): T
+
+ /** A scroll action. */
+ fun visitScroll(scroll: Scroll): T
+
+ /** An action to type in text. */
+ fun visitType(type: Type): T
+
+ /** A wait action. */
+ fun visitWait(wait: JsonValue): T
+
+ /**
+ * Maps an unknown variant of [ComputerAction] to a value of type [T].
+ *
+ * An instance of [ComputerAction] can contain an unknown variant if it was deserialized
+ * from data that doesn't match any known variant. For example, if the SDK is on an older
+ * version than the API, then the API may respond with new variants that the SDK is unaware
+ * of.
+ *
+ * @throws OpenAIInvalidDataException in the default implementation.
+ */
+ fun unknown(json: JsonValue?): T {
+ throw OpenAIInvalidDataException("Unknown ComputerAction: $json")
+ }
+ }
+
+ internal class Deserializer : BaseDeserializer(ComputerAction::class) {
+
+ override fun ObjectCodec.deserialize(node: JsonNode): ComputerAction {
+ val json = JsonValue.fromJsonNode(node)
+ val type = json.asObject().getOrNull()?.get("type")?.asString()?.getOrNull()
+
+ when (type) {
+ "click" -> {
+ return tryDeserialize(node, jacksonTypeRef())?.let {
+ ComputerAction(click = it, _json = json)
+ } ?: ComputerAction(_json = json)
+ }
+ "double_click" -> {
+ return tryDeserialize(node, jacksonTypeRef())?.let {
+ ComputerAction(doubleClick = it, _json = json)
+ } ?: ComputerAction(_json = json)
+ }
+ "drag" -> {
+ return tryDeserialize(node, jacksonTypeRef())?.let {
+ ComputerAction(drag = it, _json = json)
+ } ?: ComputerAction(_json = json)
+ }
+ "keypress" -> {
+ return tryDeserialize(node, jacksonTypeRef())?.let {
+ ComputerAction(keypress = it, _json = json)
+ } ?: ComputerAction(_json = json)
+ }
+ "move" -> {
+ return tryDeserialize(node, jacksonTypeRef())?.let {
+ ComputerAction(move = it, _json = json)
+ } ?: ComputerAction(_json = json)
+ }
+ "screenshot" -> {
+ return tryDeserialize(node, jacksonTypeRef())
+ ?.let { ComputerAction(screenshot = it, _json = json) }
+ ?.takeIf { it.isValid() } ?: ComputerAction(_json = json)
+ }
+ "scroll" -> {
+ return tryDeserialize(node, jacksonTypeRef())?.let {
+ ComputerAction(scroll = it, _json = json)
+ } ?: ComputerAction(_json = json)
+ }
+ "type" -> {
+ return tryDeserialize(node, jacksonTypeRef())?.let {
+ ComputerAction(type = it, _json = json)
+ } ?: ComputerAction(_json = json)
+ }
+ "wait" -> {
+ return tryDeserialize(node, jacksonTypeRef())
+ ?.let { ComputerAction(wait = it, _json = json) }
+ ?.takeIf { it.isValid() } ?: ComputerAction(_json = json)
+ }
+ }
+
+ return ComputerAction(_json = json)
+ }
+ }
+
+ internal class Serializer : BaseSerializer(ComputerAction::class) {
+
+ override fun serialize(
+ value: ComputerAction,
+ generator: JsonGenerator,
+ provider: SerializerProvider,
+ ) {
+ when {
+ value.click != null -> generator.writeObject(value.click)
+ value.doubleClick != null -> generator.writeObject(value.doubleClick)
+ value.drag != null -> generator.writeObject(value.drag)
+ value.keypress != null -> generator.writeObject(value.keypress)
+ value.move != null -> generator.writeObject(value.move)
+ value.screenshot != null -> generator.writeObject(value.screenshot)
+ value.scroll != null -> generator.writeObject(value.scroll)
+ value.type != null -> generator.writeObject(value.type)
+ value.wait != null -> generator.writeObject(value.wait)
+ value._json != null -> generator.writeObject(value._json)
+ else -> throw IllegalStateException("Invalid ComputerAction")
+ }
+ }
+ }
+
+ /** A click action. */
+ class Click
+ @JsonCreator(mode = JsonCreator.Mode.DISABLED)
+ private constructor(
+ private val button: JsonField