diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index 2e17c9c0..ab02f266 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -59,6 +59,9 @@ jobs:
uses: gradle/actions/setup-gradle@v4
- name: Build SDK
+ # disable gradle daemon in CI because it is flakey
+ env:
+ GRADLE_OPTS: "-Dkotlin.compiler.execution.strategy=in-process"
run: ./scripts/build
test:
diff --git a/.release-please-manifest.json b/.release-please-manifest.json
index 3b4c2d4b..bd7f3844 100644
--- a/.release-please-manifest.json
+++ b/.release-please-manifest.json
@@ -1,3 +1,3 @@
{
- ".": "4.1.0"
+ ".": "4.2.0"
}
\ No newline at end of file
diff --git a/.stats.yml b/.stats.yml
index 4e40d470..f7aa916f 100644
--- a/.stats.yml
+++ b/.stats.yml
@@ -1,4 +1,4 @@
-configured_endpoints: 122
-openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/openai%2Fopenai-fadefdc7c7e30df47c09df323669b242ff90ee08e51f304175ace5274e0aab49.yml
-openapi_spec_hash: 6d20f639d9ff8a097a34962da6218231
-config_hash: 902654e60f5d659f2bfcfd903e17c46d
+configured_endpoints: 135
+openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/openai%2Fopenai-d64cf80d2ebddf175c5578f68226a3d5bbd3f7fd8d62ccac2205f3fc05a355ee.yml
+openapi_spec_hash: d51e0d60d0c536f210b597a211bc5af0
+config_hash: e7c42016df9c6bd7bd6ff15101b9bc9b
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 47456bf8..d4d3abe7 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,5 +1,13 @@
# Changelog
+## 4.2.0 (2025-10-06)
+
+Full Changelog: [v4.1.0...v4.2.0](https://github.com/openai/openai-java/compare/v4.1.0...v4.2.0)
+
+### Features
+
+* **api:** dev day 2025 launches ([d4f0999](https://github.com/openai/openai-java/commit/d4f09991051ca1554f2452dd014941b3e5b77f73))
+
## 4.1.0 (2025-10-02)
Full Changelog: [v4.0.1...v4.1.0](https://github.com/openai/openai-java/compare/v4.0.1...v4.1.0)
diff --git a/README.md b/README.md
index ed41afcf..afcb980a 100644
--- a/README.md
+++ b/README.md
@@ -2,8 +2,8 @@
-[](https://central.sonatype.com/artifact/com.openai/openai-java/4.1.0)
-[](https://javadoc.io/doc/com.openai/openai-java/4.1.0)
+[](https://central.sonatype.com/artifact/com.openai/openai-java/4.2.0)
+[](https://javadoc.io/doc/com.openai/openai-java/4.2.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.1.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.2.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.1.0")
+implementation("com.openai:openai-java:4.2.0")
```
### Maven
@@ -33,7 +33,7 @@ implementation("com.openai:openai-java:4.1.0")
com.openai
openai-java
- 4.1.0
+ 4.2.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.1.0")
+implementation("com.openai:openai-java-spring-boot-starter:4.2.0")
```
#### Maven
@@ -1351,7 +1351,7 @@ implementation("com.openai:openai-java-spring-boot-starter:4.1.0")
com.openai
openai-java-spring-boot-starter
- 4.1.0
+ 4.2.0
```
diff --git a/build.gradle.kts b/build.gradle.kts
index d0ccf1e9..efa3545e 100644
--- a/build.gradle.kts
+++ b/build.gradle.kts
@@ -8,7 +8,7 @@ repositories {
allprojects {
group = "com.openai"
- version = "4.1.0" // x-release-please-version
+ version = "4.2.0" // x-release-please-version
}
subprojects {
diff --git a/openai-java-core/src/main/kotlin/com/openai/client/OpenAIClient.kt b/openai-java-core/src/main/kotlin/com/openai/client/OpenAIClient.kt
index 8ae6b6e7..f0489a2f 100644
--- a/openai-java-core/src/main/kotlin/com/openai/client/OpenAIClient.kt
+++ b/openai-java-core/src/main/kotlin/com/openai/client/OpenAIClient.kt
@@ -22,6 +22,7 @@ import com.openai.services.blocking.RealtimeService
import com.openai.services.blocking.ResponseService
import com.openai.services.blocking.UploadService
import com.openai.services.blocking.VectorStoreService
+import com.openai.services.blocking.VideoService
import com.openai.services.blocking.WebhookService
import java.util.function.Consumer
@@ -101,6 +102,8 @@ interface OpenAIClient {
fun containers(): ContainerService
+ fun videos(): VideoService
+
/**
* Closes this client, relinquishing any underlying resources.
*
@@ -163,5 +166,7 @@ interface OpenAIClient {
fun evals(): EvalService.WithRawResponse
fun containers(): ContainerService.WithRawResponse
+
+ fun videos(): VideoService.WithRawResponse
}
}
diff --git a/openai-java-core/src/main/kotlin/com/openai/client/OpenAIClientAsync.kt b/openai-java-core/src/main/kotlin/com/openai/client/OpenAIClientAsync.kt
index 351b305b..a3074bc1 100644
--- a/openai-java-core/src/main/kotlin/com/openai/client/OpenAIClientAsync.kt
+++ b/openai-java-core/src/main/kotlin/com/openai/client/OpenAIClientAsync.kt
@@ -22,6 +22,7 @@ import com.openai.services.async.RealtimeServiceAsync
import com.openai.services.async.ResponseServiceAsync
import com.openai.services.async.UploadServiceAsync
import com.openai.services.async.VectorStoreServiceAsync
+import com.openai.services.async.VideoServiceAsync
import com.openai.services.async.WebhookServiceAsync
import java.util.function.Consumer
@@ -101,6 +102,8 @@ interface OpenAIClientAsync {
fun containers(): ContainerServiceAsync
+ fun videos(): VideoServiceAsync
+
/**
* Closes this client, relinquishing any underlying resources.
*
@@ -165,5 +168,7 @@ interface OpenAIClientAsync {
fun evals(): EvalServiceAsync.WithRawResponse
fun containers(): ContainerServiceAsync.WithRawResponse
+
+ fun videos(): VideoServiceAsync.WithRawResponse
}
}
diff --git a/openai-java-core/src/main/kotlin/com/openai/client/OpenAIClientAsyncImpl.kt b/openai-java-core/src/main/kotlin/com/openai/client/OpenAIClientAsyncImpl.kt
index 8d8a48b1..1424255b 100644
--- a/openai-java-core/src/main/kotlin/com/openai/client/OpenAIClientAsyncImpl.kt
+++ b/openai-java-core/src/main/kotlin/com/openai/client/OpenAIClientAsyncImpl.kt
@@ -42,6 +42,8 @@ import com.openai.services.async.UploadServiceAsync
import com.openai.services.async.UploadServiceAsyncImpl
import com.openai.services.async.VectorStoreServiceAsync
import com.openai.services.async.VectorStoreServiceAsyncImpl
+import com.openai.services.async.VideoServiceAsync
+import com.openai.services.async.VideoServiceAsyncImpl
import com.openai.services.async.WebhookServiceAsync
import com.openai.services.async.WebhookServiceAsyncImpl
import java.util.function.Consumer
@@ -135,6 +137,10 @@ class OpenAIClientAsyncImpl(private val clientOptions: ClientOptions) : OpenAICl
ContainerServiceAsyncImpl(clientOptionsWithUserAgent)
}
+ private val videos: VideoServiceAsync by lazy {
+ VideoServiceAsyncImpl(clientOptionsWithUserAgent)
+ }
+
override fun sync(): OpenAIClient = sync
override fun withRawResponse(): OpenAIClientAsync.WithRawResponse = withRawResponse
@@ -182,6 +188,8 @@ class OpenAIClientAsyncImpl(private val clientOptions: ClientOptions) : OpenAICl
override fun containers(): ContainerServiceAsync = containers
+ override fun videos(): VideoServiceAsync = videos
+
override fun close() = clientOptions.close()
class WithRawResponseImpl internal constructor(private val clientOptions: ClientOptions) :
@@ -267,6 +275,10 @@ class OpenAIClientAsyncImpl(private val clientOptions: ClientOptions) : OpenAICl
ContainerServiceAsyncImpl.WithRawResponseImpl(clientOptions)
}
+ private val videos: VideoServiceAsync.WithRawResponse by lazy {
+ VideoServiceAsyncImpl.WithRawResponseImpl(clientOptions)
+ }
+
override fun withOptions(
modifier: Consumer
): OpenAIClientAsync.WithRawResponse =
@@ -313,5 +325,7 @@ class OpenAIClientAsyncImpl(private val clientOptions: ClientOptions) : OpenAICl
override fun evals(): EvalServiceAsync.WithRawResponse = evals
override fun containers(): ContainerServiceAsync.WithRawResponse = containers
+
+ override fun videos(): VideoServiceAsync.WithRawResponse = videos
}
}
diff --git a/openai-java-core/src/main/kotlin/com/openai/client/OpenAIClientImpl.kt b/openai-java-core/src/main/kotlin/com/openai/client/OpenAIClientImpl.kt
index 436680a9..22fa8afd 100644
--- a/openai-java-core/src/main/kotlin/com/openai/client/OpenAIClientImpl.kt
+++ b/openai-java-core/src/main/kotlin/com/openai/client/OpenAIClientImpl.kt
@@ -42,6 +42,8 @@ import com.openai.services.blocking.UploadService
import com.openai.services.blocking.UploadServiceImpl
import com.openai.services.blocking.VectorStoreService
import com.openai.services.blocking.VectorStoreServiceImpl
+import com.openai.services.blocking.VideoService
+import com.openai.services.blocking.VideoServiceImpl
import com.openai.services.blocking.WebhookService
import com.openai.services.blocking.WebhookServiceImpl
import java.util.function.Consumer
@@ -121,6 +123,8 @@ class OpenAIClientImpl(private val clientOptions: ClientOptions) : OpenAIClient
ContainerServiceImpl(clientOptionsWithUserAgent)
}
+ private val videos: VideoService by lazy { VideoServiceImpl(clientOptionsWithUserAgent) }
+
override fun async(): OpenAIClientAsync = async
override fun withRawResponse(): OpenAIClient.WithRawResponse = withRawResponse
@@ -168,6 +172,8 @@ class OpenAIClientImpl(private val clientOptions: ClientOptions) : OpenAIClient
override fun containers(): ContainerService = containers
+ override fun videos(): VideoService = videos
+
override fun close() = clientOptions.close()
class WithRawResponseImpl internal constructor(private val clientOptions: ClientOptions) :
@@ -253,6 +259,10 @@ class OpenAIClientImpl(private val clientOptions: ClientOptions) : OpenAIClient
ContainerServiceImpl.WithRawResponseImpl(clientOptions)
}
+ private val videos: VideoService.WithRawResponse by lazy {
+ VideoServiceImpl.WithRawResponseImpl(clientOptions)
+ }
+
override fun withOptions(
modifier: Consumer
): OpenAIClient.WithRawResponse =
@@ -299,5 +309,7 @@ class OpenAIClientImpl(private val clientOptions: ClientOptions) : OpenAIClient
override fun evals(): EvalService.WithRawResponse = evals
override fun containers(): ContainerService.WithRawResponse = containers
+
+ override fun videos(): VideoService.WithRawResponse = videos
}
}
diff --git a/openai-java-core/src/main/kotlin/com/openai/models/AllModels.kt b/openai-java-core/src/main/kotlin/com/openai/models/AllModels.kt
index eae7234a..8862a6c6 100644
--- a/openai-java-core/src/main/kotlin/com/openai/models/AllModels.kt
+++ b/openai-java-core/src/main/kotlin/com/openai/models/AllModels.kt
@@ -254,6 +254,10 @@ private constructor(
@JvmField val GPT_5_CODEX = of("gpt-5-codex")
+ @JvmField val GPT_5_PRO = of("gpt-5-pro")
+
+ @JvmField val GPT_5_PRO_2025_10_06 = of("gpt-5-pro-2025-10-06")
+
@JvmStatic fun of(value: String) = ResponsesOnlyModel(JsonField.of(value))
}
@@ -270,6 +274,8 @@ private constructor(
COMPUTER_USE_PREVIEW,
COMPUTER_USE_PREVIEW_2025_03_11,
GPT_5_CODEX,
+ GPT_5_PRO,
+ GPT_5_PRO_2025_10_06,
}
/**
@@ -293,6 +299,8 @@ private constructor(
COMPUTER_USE_PREVIEW,
COMPUTER_USE_PREVIEW_2025_03_11,
GPT_5_CODEX,
+ GPT_5_PRO,
+ GPT_5_PRO_2025_10_06,
/**
* An enum member indicating that [ResponsesOnlyModel] was instantiated with an unknown
* value.
@@ -320,6 +328,8 @@ private constructor(
COMPUTER_USE_PREVIEW -> Value.COMPUTER_USE_PREVIEW
COMPUTER_USE_PREVIEW_2025_03_11 -> Value.COMPUTER_USE_PREVIEW_2025_03_11
GPT_5_CODEX -> Value.GPT_5_CODEX
+ GPT_5_PRO -> Value.GPT_5_PRO
+ GPT_5_PRO_2025_10_06 -> Value.GPT_5_PRO_2025_10_06
else -> Value._UNKNOWN
}
@@ -345,6 +355,8 @@ private constructor(
COMPUTER_USE_PREVIEW -> Known.COMPUTER_USE_PREVIEW
COMPUTER_USE_PREVIEW_2025_03_11 -> Known.COMPUTER_USE_PREVIEW_2025_03_11
GPT_5_CODEX -> Known.GPT_5_CODEX
+ GPT_5_PRO -> Known.GPT_5_PRO
+ GPT_5_PRO_2025_10_06 -> Known.GPT_5_PRO_2025_10_06
else -> throw OpenAIInvalidDataException("Unknown ResponsesOnlyModel: $value")
}
diff --git a/openai-java-core/src/main/kotlin/com/openai/models/ResponsesModel.kt b/openai-java-core/src/main/kotlin/com/openai/models/ResponsesModel.kt
index 412519c4..bbf0eee4 100644
--- a/openai-java-core/src/main/kotlin/com/openai/models/ResponsesModel.kt
+++ b/openai-java-core/src/main/kotlin/com/openai/models/ResponsesModel.kt
@@ -253,6 +253,10 @@ private constructor(
@JvmField val GPT_5_CODEX = of("gpt-5-codex")
+ @JvmField val GPT_5_PRO = of("gpt-5-pro")
+
+ @JvmField val GPT_5_PRO_2025_10_06 = of("gpt-5-pro-2025-10-06")
+
@JvmStatic fun of(value: String) = ResponsesOnlyModel(JsonField.of(value))
}
@@ -269,6 +273,8 @@ private constructor(
COMPUTER_USE_PREVIEW,
COMPUTER_USE_PREVIEW_2025_03_11,
GPT_5_CODEX,
+ GPT_5_PRO,
+ GPT_5_PRO_2025_10_06,
}
/**
@@ -292,6 +298,8 @@ private constructor(
COMPUTER_USE_PREVIEW,
COMPUTER_USE_PREVIEW_2025_03_11,
GPT_5_CODEX,
+ GPT_5_PRO,
+ GPT_5_PRO_2025_10_06,
/**
* An enum member indicating that [ResponsesOnlyModel] was instantiated with an unknown
* value.
@@ -319,6 +327,8 @@ private constructor(
COMPUTER_USE_PREVIEW -> Value.COMPUTER_USE_PREVIEW
COMPUTER_USE_PREVIEW_2025_03_11 -> Value.COMPUTER_USE_PREVIEW_2025_03_11
GPT_5_CODEX -> Value.GPT_5_CODEX
+ GPT_5_PRO -> Value.GPT_5_PRO
+ GPT_5_PRO_2025_10_06 -> Value.GPT_5_PRO_2025_10_06
else -> Value._UNKNOWN
}
@@ -344,6 +354,8 @@ private constructor(
COMPUTER_USE_PREVIEW -> Known.COMPUTER_USE_PREVIEW
COMPUTER_USE_PREVIEW_2025_03_11 -> Known.COMPUTER_USE_PREVIEW_2025_03_11
GPT_5_CODEX -> Known.GPT_5_CODEX
+ GPT_5_PRO -> Known.GPT_5_PRO
+ GPT_5_PRO_2025_10_06 -> Known.GPT_5_PRO_2025_10_06
else -> throw OpenAIInvalidDataException("Unknown ResponsesOnlyModel: $value")
}
diff --git a/openai-java-core/src/main/kotlin/com/openai/models/beta/chatkit/ChatKitUploadFileParams.kt b/openai-java-core/src/main/kotlin/com/openai/models/beta/chatkit/ChatKitUploadFileParams.kt
new file mode 100644
index 00000000..c1f77347
--- /dev/null
+++ b/openai-java-core/src/main/kotlin/com/openai/models/beta/chatkit/ChatKitUploadFileParams.kt
@@ -0,0 +1,446 @@
+// File generated from our OpenAPI spec by Stainless.
+
+package com.openai.models.beta.chatkit
+
+import com.fasterxml.jackson.annotation.JsonAnyGetter
+import com.fasterxml.jackson.annotation.JsonAnySetter
+import com.fasterxml.jackson.annotation.JsonProperty
+import com.openai.core.ExcludeMissing
+import com.openai.core.JsonValue
+import com.openai.core.MultipartField
+import com.openai.core.Params
+import com.openai.core.checkRequired
+import com.openai.core.http.Headers
+import com.openai.core.http.QueryParams
+import com.openai.core.toImmutable
+import com.openai.errors.OpenAIInvalidDataException
+import java.io.InputStream
+import java.nio.file.Path
+import java.util.Collections
+import java.util.Objects
+import kotlin.io.path.inputStream
+import kotlin.io.path.name
+
+/** Upload a ChatKit file */
+class ChatKitUploadFileParams
+private constructor(
+ private val body: Body,
+ private val additionalHeaders: Headers,
+ private val additionalQueryParams: QueryParams,
+) : Params {
+
+ /**
+ * Binary file contents to store with the ChatKit session. Supports PDFs and PNG, JPG, JPEG,
+ * GIF, or WEBP images.
+ *
+ * @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 file(): InputStream = body.file()
+
+ /**
+ * Returns the raw multipart value of [file].
+ *
+ * Unlike [file], this method doesn't throw if the multipart field has an unexpected type.
+ */
+ fun _file(): MultipartField = body._file()
+
+ fun _additionalBodyProperties(): Map = body._additionalProperties()
+
+ /** Additional headers to send with the request. */
+ fun _additionalHeaders(): Headers = additionalHeaders
+
+ /** Additional query param to send with the request. */
+ fun _additionalQueryParams(): QueryParams = additionalQueryParams
+
+ fun toBuilder() = Builder().from(this)
+
+ companion object {
+
+ /**
+ * Returns a mutable builder for constructing an instance of [ChatKitUploadFileParams].
+ *
+ * The following fields are required:
+ * ```java
+ * .file()
+ * ```
+ */
+ @JvmStatic fun builder() = Builder()
+ }
+
+ /** A builder for [ChatKitUploadFileParams]. */
+ class Builder internal constructor() {
+
+ private var body: Body.Builder = Body.builder()
+ private var additionalHeaders: Headers.Builder = Headers.builder()
+ private var additionalQueryParams: QueryParams.Builder = QueryParams.builder()
+
+ @JvmSynthetic
+ internal fun from(chatkitUploadFileParams: ChatKitUploadFileParams) = apply {
+ body = chatkitUploadFileParams.body.toBuilder()
+ additionalHeaders = chatkitUploadFileParams.additionalHeaders.toBuilder()
+ additionalQueryParams = chatkitUploadFileParams.additionalQueryParams.toBuilder()
+ }
+
+ /**
+ * Sets the entire request body.
+ *
+ * This is generally only useful if you are already constructing the body separately.
+ * Otherwise, it's more convenient to use the top-level setters instead:
+ * - [file]
+ */
+ fun body(body: Body) = apply { this.body = body.toBuilder() }
+
+ /**
+ * Binary file contents to store with the ChatKit session. Supports PDFs and PNG, JPG, JPEG,
+ * GIF, or WEBP images.
+ */
+ fun file(file: InputStream) = apply { body.file(file) }
+
+ /**
+ * Sets [Builder.file] to an arbitrary multipart value.
+ *
+ * You should usually call [Builder.file] with a well-typed [InputStream] value instead.
+ * This method is primarily for setting the field to an undocumented or not yet supported
+ * value.
+ */
+ fun file(file: MultipartField) = apply { body.file(file) }
+
+ /**
+ * Binary file contents to store with the ChatKit session. Supports PDFs and PNG, JPG, JPEG,
+ * GIF, or WEBP images.
+ */
+ fun file(file: ByteArray) = apply { body.file(file) }
+
+ /**
+ * Binary file contents to store with the ChatKit session. Supports PDFs and PNG, JPG, JPEG,
+ * GIF, or WEBP images.
+ */
+ fun file(path: Path) = apply { body.file(path) }
+
+ fun additionalBodyProperties(additionalBodyProperties: Map) = apply {
+ body.additionalProperties(additionalBodyProperties)
+ }
+
+ fun putAdditionalBodyProperty(key: String, value: JsonValue) = apply {
+ body.putAdditionalProperty(key, value)
+ }
+
+ fun putAllAdditionalBodyProperties(additionalBodyProperties: Map) =
+ apply {
+ body.putAllAdditionalProperties(additionalBodyProperties)
+ }
+
+ fun removeAdditionalBodyProperty(key: String) = apply { body.removeAdditionalProperty(key) }
+
+ fun removeAllAdditionalBodyProperties(keys: Set) = apply {
+ body.removeAllAdditionalProperties(keys)
+ }
+
+ fun additionalHeaders(additionalHeaders: Headers) = apply {
+ this.additionalHeaders.clear()
+ putAllAdditionalHeaders(additionalHeaders)
+ }
+
+ fun additionalHeaders(additionalHeaders: Map>) = apply {
+ this.additionalHeaders.clear()
+ putAllAdditionalHeaders(additionalHeaders)
+ }
+
+ fun putAdditionalHeader(name: String, value: String) = apply {
+ additionalHeaders.put(name, value)
+ }
+
+ fun putAdditionalHeaders(name: String, values: Iterable) = apply {
+ additionalHeaders.put(name, values)
+ }
+
+ fun putAllAdditionalHeaders(additionalHeaders: Headers) = apply {
+ this.additionalHeaders.putAll(additionalHeaders)
+ }
+
+ fun putAllAdditionalHeaders(additionalHeaders: Map>) = apply {
+ this.additionalHeaders.putAll(additionalHeaders)
+ }
+
+ fun replaceAdditionalHeaders(name: String, value: String) = apply {
+ additionalHeaders.replace(name, value)
+ }
+
+ fun replaceAdditionalHeaders(name: String, values: Iterable) = apply {
+ additionalHeaders.replace(name, values)
+ }
+
+ fun replaceAllAdditionalHeaders(additionalHeaders: Headers) = apply {
+ this.additionalHeaders.replaceAll(additionalHeaders)
+ }
+
+ fun replaceAllAdditionalHeaders(additionalHeaders: Map>) = apply {
+ this.additionalHeaders.replaceAll(additionalHeaders)
+ }
+
+ fun removeAdditionalHeaders(name: String) = apply { additionalHeaders.remove(name) }
+
+ fun removeAllAdditionalHeaders(names: Set) = apply {
+ additionalHeaders.removeAll(names)
+ }
+
+ fun additionalQueryParams(additionalQueryParams: QueryParams) = apply {
+ this.additionalQueryParams.clear()
+ putAllAdditionalQueryParams(additionalQueryParams)
+ }
+
+ fun additionalQueryParams(additionalQueryParams: Map>) = apply {
+ this.additionalQueryParams.clear()
+ putAllAdditionalQueryParams(additionalQueryParams)
+ }
+
+ fun putAdditionalQueryParam(key: String, value: String) = apply {
+ additionalQueryParams.put(key, value)
+ }
+
+ fun putAdditionalQueryParams(key: String, values: Iterable) = apply {
+ additionalQueryParams.put(key, values)
+ }
+
+ fun putAllAdditionalQueryParams(additionalQueryParams: QueryParams) = apply {
+ this.additionalQueryParams.putAll(additionalQueryParams)
+ }
+
+ fun putAllAdditionalQueryParams(additionalQueryParams: Map>) =
+ apply {
+ this.additionalQueryParams.putAll(additionalQueryParams)
+ }
+
+ fun replaceAdditionalQueryParams(key: String, value: String) = apply {
+ additionalQueryParams.replace(key, value)
+ }
+
+ fun replaceAdditionalQueryParams(key: String, values: Iterable) = apply {
+ additionalQueryParams.replace(key, values)
+ }
+
+ fun replaceAllAdditionalQueryParams(additionalQueryParams: QueryParams) = apply {
+ this.additionalQueryParams.replaceAll(additionalQueryParams)
+ }
+
+ fun replaceAllAdditionalQueryParams(additionalQueryParams: Map>) =
+ apply {
+ this.additionalQueryParams.replaceAll(additionalQueryParams)
+ }
+
+ fun removeAdditionalQueryParams(key: String) = apply { additionalQueryParams.remove(key) }
+
+ fun removeAllAdditionalQueryParams(keys: Set) = apply {
+ additionalQueryParams.removeAll(keys)
+ }
+
+ /**
+ * Returns an immutable instance of [ChatKitUploadFileParams].
+ *
+ * Further updates to this [Builder] will not mutate the returned instance.
+ *
+ * The following fields are required:
+ * ```java
+ * .file()
+ * ```
+ *
+ * @throws IllegalStateException if any required field is unset.
+ */
+ fun build(): ChatKitUploadFileParams =
+ ChatKitUploadFileParams(
+ body.build(),
+ additionalHeaders.build(),
+ additionalQueryParams.build(),
+ )
+ }
+
+ fun _body(): Map> =
+ (mapOf("file" to _file()) +
+ _additionalBodyProperties().mapValues { (_, value) -> MultipartField.of(value) })
+ .toImmutable()
+
+ override fun _headers(): Headers = additionalHeaders
+
+ override fun _queryParams(): QueryParams = additionalQueryParams
+
+ /** Parameters for uploading an attachment to the active ChatKit session. */
+ class Body
+ private constructor(
+ private val file: MultipartField,
+ private val additionalProperties: MutableMap,
+ ) {
+
+ /**
+ * Binary file contents to store with the ChatKit session. Supports PDFs and PNG, JPG, JPEG,
+ * GIF, or WEBP images.
+ *
+ * @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 file(): InputStream = file.value.getRequired("file")
+
+ /**
+ * Returns the raw multipart value of [file].
+ *
+ * Unlike [file], this method doesn't throw if the multipart field has an unexpected type.
+ */
+ @JsonProperty("file") @ExcludeMissing fun _file(): MultipartField = file
+
+ @JsonAnySetter
+ private fun putAdditionalProperty(key: String, value: JsonValue) {
+ additionalProperties.put(key, value)
+ }
+
+ @JsonAnyGetter
+ @ExcludeMissing
+ fun _additionalProperties(): Map =
+ Collections.unmodifiableMap(additionalProperties)
+
+ fun toBuilder() = Builder().from(this)
+
+ companion object {
+
+ /**
+ * Returns a mutable builder for constructing an instance of [Body].
+ *
+ * The following fields are required:
+ * ```java
+ * .file()
+ * ```
+ */
+ @JvmStatic fun builder() = Builder()
+ }
+
+ /** A builder for [Body]. */
+ class Builder internal constructor() {
+
+ private var file: MultipartField? = null
+ private var additionalProperties: MutableMap = mutableMapOf()
+
+ @JvmSynthetic
+ internal fun from(body: Body) = apply {
+ file = body.file
+ additionalProperties = body.additionalProperties.toMutableMap()
+ }
+
+ /**
+ * Binary file contents to store with the ChatKit session. Supports PDFs and PNG, JPG,
+ * JPEG, GIF, or WEBP images.
+ */
+ fun file(file: InputStream) = file(MultipartField.of(file))
+
+ /**
+ * Sets [Builder.file] to an arbitrary multipart value.
+ *
+ * You should usually call [Builder.file] with a well-typed [InputStream] value instead.
+ * This method is primarily for setting the field to an undocumented or not yet
+ * supported value.
+ */
+ fun file(file: MultipartField) = apply { this.file = file }
+
+ /**
+ * Binary file contents to store with the ChatKit session. Supports PDFs and PNG, JPG,
+ * JPEG, GIF, or WEBP images.
+ */
+ fun file(file: ByteArray) = file(file.inputStream())
+
+ /**
+ * Binary file contents to store with the ChatKit session. Supports PDFs and PNG, JPG,
+ * JPEG, GIF, or WEBP images.
+ */
+ fun file(path: Path) =
+ file(
+ MultipartField.builder()
+ .value(path.inputStream())
+ .filename(path.name)
+ .build()
+ )
+
+ fun additionalProperties(additionalProperties: Map) = apply {
+ this.additionalProperties.clear()
+ putAllAdditionalProperties(additionalProperties)
+ }
+
+ fun putAdditionalProperty(key: String, value: JsonValue) = apply {
+ additionalProperties.put(key, value)
+ }
+
+ fun putAllAdditionalProperties(additionalProperties: Map) = apply {
+ this.additionalProperties.putAll(additionalProperties)
+ }
+
+ fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) }
+
+ fun removeAllAdditionalProperties(keys: Set) = apply {
+ keys.forEach(::removeAdditionalProperty)
+ }
+
+ /**
+ * Returns an immutable instance of [Body].
+ *
+ * Further updates to this [Builder] will not mutate the returned instance.
+ *
+ * The following fields are required:
+ * ```java
+ * .file()
+ * ```
+ *
+ * @throws IllegalStateException if any required field is unset.
+ */
+ fun build(): Body =
+ Body(checkRequired("file", file), additionalProperties.toMutableMap())
+ }
+
+ private var validated: Boolean = false
+
+ fun validate(): Body = apply {
+ if (validated) {
+ return@apply
+ }
+
+ file()
+ validated = true
+ }
+
+ fun isValid(): Boolean =
+ try {
+ validate()
+ true
+ } catch (e: OpenAIInvalidDataException) {
+ false
+ }
+
+ override fun equals(other: Any?): Boolean {
+ if (this === other) {
+ return true
+ }
+
+ return other is Body &&
+ file == other.file &&
+ additionalProperties == other.additionalProperties
+ }
+
+ private val hashCode: Int by lazy { Objects.hash(file, additionalProperties) }
+
+ override fun hashCode(): Int = hashCode
+
+ override fun toString() = "Body{file=$file, additionalProperties=$additionalProperties}"
+ }
+
+ override fun equals(other: Any?): Boolean {
+ if (this === other) {
+ return true
+ }
+
+ return other is ChatKitUploadFileParams &&
+ body == other.body &&
+ additionalHeaders == other.additionalHeaders &&
+ additionalQueryParams == other.additionalQueryParams
+ }
+
+ override fun hashCode(): Int = Objects.hash(body, additionalHeaders, additionalQueryParams)
+
+ override fun toString() =
+ "ChatKitUploadFileParams{body=$body, additionalHeaders=$additionalHeaders, additionalQueryParams=$additionalQueryParams}"
+}
diff --git a/openai-java-core/src/main/kotlin/com/openai/models/beta/chatkit/ChatKitUploadFileResponse.kt b/openai-java-core/src/main/kotlin/com/openai/models/beta/chatkit/ChatKitUploadFileResponse.kt
new file mode 100644
index 00000000..9f38aedc
--- /dev/null
+++ b/openai-java-core/src/main/kotlin/com/openai/models/beta/chatkit/ChatKitUploadFileResponse.kt
@@ -0,0 +1,196 @@
+// File generated from our OpenAPI spec by Stainless.
+
+package com.openai.models.beta.chatkit
+
+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.JsonValue
+import com.openai.core.getOrThrow
+import com.openai.errors.OpenAIInvalidDataException
+import java.util.Objects
+import java.util.Optional
+import kotlin.jvm.optionals.getOrNull
+
+/** Represents either a file or image attachment. */
+@JsonDeserialize(using = ChatKitUploadFileResponse.Deserializer::class)
+@JsonSerialize(using = ChatKitUploadFileResponse.Serializer::class)
+class ChatKitUploadFileResponse
+private constructor(
+ private val file: FilePart? = null,
+ private val image: ImagePart? = null,
+ private val _json: JsonValue? = null,
+) {
+
+ /** Metadata for a non-image file uploaded through ChatKit. */
+ fun file(): Optional = Optional.ofNullable(file)
+
+ /** Metadata for an image uploaded through ChatKit. */
+ fun image(): Optional = Optional.ofNullable(image)
+
+ fun isFile(): Boolean = file != null
+
+ fun isImage(): Boolean = image != null
+
+ /** Metadata for a non-image file uploaded through ChatKit. */
+ fun asFile(): FilePart = file.getOrThrow("file")
+
+ /** Metadata for an image uploaded through ChatKit. */
+ fun asImage(): ImagePart = image.getOrThrow("image")
+
+ fun _json(): Optional = Optional.ofNullable(_json)
+
+ fun accept(visitor: Visitor): T =
+ when {
+ file != null -> visitor.visitFile(file)
+ image != null -> visitor.visitImage(image)
+ else -> visitor.unknown(_json)
+ }
+
+ private var validated: Boolean = false
+
+ fun validate(): ChatKitUploadFileResponse = apply {
+ if (validated) {
+ return@apply
+ }
+
+ accept(
+ object : Visitor {
+ override fun visitFile(file: FilePart) {
+ file.validate()
+ }
+
+ override fun visitImage(image: ImagePart) {
+ image.validate()
+ }
+ }
+ )
+ 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 visitFile(file: FilePart) = file.validity()
+
+ override fun visitImage(image: ImagePart) = image.validity()
+
+ override fun unknown(json: JsonValue?) = 0
+ }
+ )
+
+ override fun equals(other: Any?): Boolean {
+ if (this === other) {
+ return true
+ }
+
+ return other is ChatKitUploadFileResponse && file == other.file && image == other.image
+ }
+
+ override fun hashCode(): Int = Objects.hash(file, image)
+
+ override fun toString(): String =
+ when {
+ file != null -> "ChatKitUploadFileResponse{file=$file}"
+ image != null -> "ChatKitUploadFileResponse{image=$image}"
+ _json != null -> "ChatKitUploadFileResponse{_unknown=$_json}"
+ else -> throw IllegalStateException("Invalid ChatKitUploadFileResponse")
+ }
+
+ companion object {
+
+ /** Metadata for a non-image file uploaded through ChatKit. */
+ @JvmStatic fun ofFile(file: FilePart) = ChatKitUploadFileResponse(file = file)
+
+ /** Metadata for an image uploaded through ChatKit. */
+ @JvmStatic fun ofImage(image: ImagePart) = ChatKitUploadFileResponse(image = image)
+ }
+
+ /**
+ * An interface that defines how to map each variant of [ChatKitUploadFileResponse] to a value
+ * of type [T].
+ */
+ interface Visitor {
+
+ /** Metadata for a non-image file uploaded through ChatKit. */
+ fun visitFile(file: FilePart): T
+
+ /** Metadata for an image uploaded through ChatKit. */
+ fun visitImage(image: ImagePart): T
+
+ /**
+ * Maps an unknown variant of [ChatKitUploadFileResponse] to a value of type [T].
+ *
+ * An instance of [ChatKitUploadFileResponse] 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 ChatKitUploadFileResponse: $json")
+ }
+ }
+
+ internal class Deserializer :
+ BaseDeserializer(ChatKitUploadFileResponse::class) {
+
+ override fun ObjectCodec.deserialize(node: JsonNode): ChatKitUploadFileResponse {
+ val json = JsonValue.fromJsonNode(node)
+ val type = json.asObject().getOrNull()?.get("type")?.asString()?.getOrNull()
+
+ when (type) {
+ "file" -> {
+ return tryDeserialize(node, jacksonTypeRef())?.let {
+ ChatKitUploadFileResponse(file = it, _json = json)
+ } ?: ChatKitUploadFileResponse(_json = json)
+ }
+ "image" -> {
+ return tryDeserialize(node, jacksonTypeRef())?.let {
+ ChatKitUploadFileResponse(image = it, _json = json)
+ } ?: ChatKitUploadFileResponse(_json = json)
+ }
+ }
+
+ return ChatKitUploadFileResponse(_json = json)
+ }
+ }
+
+ internal class Serializer :
+ BaseSerializer(ChatKitUploadFileResponse::class) {
+
+ override fun serialize(
+ value: ChatKitUploadFileResponse,
+ generator: JsonGenerator,
+ provider: SerializerProvider,
+ ) {
+ when {
+ value.file != null -> generator.writeObject(value.file)
+ value.image != null -> generator.writeObject(value.image)
+ value._json != null -> generator.writeObject(value._json)
+ else -> throw IllegalStateException("Invalid ChatKitUploadFileResponse")
+ }
+ }
+ }
+}
diff --git a/openai-java-core/src/main/kotlin/com/openai/models/beta/chatkit/ChatKitWorkflow.kt b/openai-java-core/src/main/kotlin/com/openai/models/beta/chatkit/ChatKitWorkflow.kt
new file mode 100644
index 00000000..972434f9
--- /dev/null
+++ b/openai-java-core/src/main/kotlin/com/openai/models/beta/chatkit/ChatKitWorkflow.kt
@@ -0,0 +1,572 @@
+// File generated from our OpenAPI spec by Stainless.
+
+package com.openai.models.beta.chatkit
+
+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.ExcludeMissing
+import com.openai.core.JsonField
+import com.openai.core.JsonMissing
+import com.openai.core.JsonValue
+import com.openai.core.checkRequired
+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
+
+/** Workflow metadata and state returned for the session. */
+class ChatKitWorkflow
+@JsonCreator(mode = JsonCreator.Mode.DISABLED)
+private constructor(
+ private val id: JsonField,
+ private val stateVariables: JsonField,
+ private val tracing: JsonField,
+ private val version: JsonField,
+ private val additionalProperties: MutableMap,
+) {
+
+ @JsonCreator
+ private constructor(
+ @JsonProperty("id") @ExcludeMissing id: JsonField = JsonMissing.of(),
+ @JsonProperty("state_variables")
+ @ExcludeMissing
+ stateVariables: JsonField = JsonMissing.of(),
+ @JsonProperty("tracing") @ExcludeMissing tracing: JsonField = JsonMissing.of(),
+ @JsonProperty("version") @ExcludeMissing version: JsonField = JsonMissing.of(),
+ ) : this(id, stateVariables, tracing, version, mutableMapOf())
+
+ /**
+ * Identifier of the workflow backing the session.
+ *
+ * @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 id(): String = id.getRequired("id")
+
+ /**
+ * State variable key-value pairs applied when invoking the workflow. Defaults to null when no
+ * overrides were provided.
+ *
+ * @throws OpenAIInvalidDataException if the JSON field has an unexpected type (e.g. if the
+ * server responded with an unexpected value).
+ */
+ fun stateVariables(): Optional = stateVariables.getOptional("state_variables")
+
+ /**
+ * Tracing settings applied to the workflow.
+ *
+ * @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 tracing(): Tracing = tracing.getRequired("tracing")
+
+ /**
+ * Specific workflow version used for the session. Defaults to null when using the latest
+ * deployment.
+ *
+ * @throws OpenAIInvalidDataException if the JSON field has an unexpected type (e.g. if the
+ * server responded with an unexpected value).
+ */
+ fun version(): Optional = version.getOptional("version")
+
+ /**
+ * Returns the raw JSON value of [id].
+ *
+ * Unlike [id], this method doesn't throw if the JSON field has an unexpected type.
+ */
+ @JsonProperty("id") @ExcludeMissing fun _id(): JsonField = id
+
+ /**
+ * Returns the raw JSON value of [stateVariables].
+ *
+ * Unlike [stateVariables], this method doesn't throw if the JSON field has an unexpected type.
+ */
+ @JsonProperty("state_variables")
+ @ExcludeMissing
+ fun _stateVariables(): JsonField = stateVariables
+
+ /**
+ * Returns the raw JSON value of [tracing].
+ *
+ * Unlike [tracing], this method doesn't throw if the JSON field has an unexpected type.
+ */
+ @JsonProperty("tracing") @ExcludeMissing fun _tracing(): JsonField = tracing
+
+ /**
+ * Returns the raw JSON value of [version].
+ *
+ * Unlike [version], this method doesn't throw if the JSON field has an unexpected type.
+ */
+ @JsonProperty("version") @ExcludeMissing fun _version(): JsonField = version
+
+ @JsonAnySetter
+ private fun putAdditionalProperty(key: String, value: JsonValue) {
+ additionalProperties.put(key, value)
+ }
+
+ @JsonAnyGetter
+ @ExcludeMissing
+ fun _additionalProperties(): Map =
+ Collections.unmodifiableMap(additionalProperties)
+
+ fun toBuilder() = Builder().from(this)
+
+ companion object {
+
+ /**
+ * Returns a mutable builder for constructing an instance of [ChatKitWorkflow].
+ *
+ * The following fields are required:
+ * ```java
+ * .id()
+ * .stateVariables()
+ * .tracing()
+ * .version()
+ * ```
+ */
+ @JvmStatic fun builder() = Builder()
+ }
+
+ /** A builder for [ChatKitWorkflow]. */
+ class Builder internal constructor() {
+
+ private var id: JsonField? = null
+ private var stateVariables: JsonField? = null
+ private var tracing: JsonField? = null
+ private var version: JsonField? = null
+ private var additionalProperties: MutableMap = mutableMapOf()
+
+ @JvmSynthetic
+ internal fun from(chatkitWorkflow: ChatKitWorkflow) = apply {
+ id = chatkitWorkflow.id
+ stateVariables = chatkitWorkflow.stateVariables
+ tracing = chatkitWorkflow.tracing
+ version = chatkitWorkflow.version
+ additionalProperties = chatkitWorkflow.additionalProperties.toMutableMap()
+ }
+
+ /** Identifier of the workflow backing the session. */
+ fun id(id: String) = id(JsonField.of(id))
+
+ /**
+ * Sets [Builder.id] to an arbitrary JSON value.
+ *
+ * You should usually call [Builder.id] with a well-typed [String] value instead. This
+ * method is primarily for setting the field to an undocumented or not yet supported value.
+ */
+ fun id(id: JsonField) = apply { this.id = id }
+
+ /**
+ * State variable key-value pairs applied when invoking the workflow. Defaults to null when
+ * no overrides were provided.
+ */
+ fun stateVariables(stateVariables: StateVariables?) =
+ stateVariables(JsonField.ofNullable(stateVariables))
+
+ /** Alias for calling [Builder.stateVariables] with `stateVariables.orElse(null)`. */
+ fun stateVariables(stateVariables: Optional) =
+ stateVariables(stateVariables.getOrNull())
+
+ /**
+ * Sets [Builder.stateVariables] to an arbitrary JSON value.
+ *
+ * You should usually call [Builder.stateVariables] with a well-typed [StateVariables] value
+ * instead. This method is primarily for setting the field to an undocumented or not yet
+ * supported value.
+ */
+ fun stateVariables(stateVariables: JsonField) = apply {
+ this.stateVariables = stateVariables
+ }
+
+ /** Tracing settings applied to the workflow. */
+ fun tracing(tracing: Tracing) = tracing(JsonField.of(tracing))
+
+ /**
+ * Sets [Builder.tracing] to an arbitrary JSON value.
+ *
+ * You should usually call [Builder.tracing] with a well-typed [Tracing] value instead. This
+ * method is primarily for setting the field to an undocumented or not yet supported value.
+ */
+ fun tracing(tracing: JsonField) = apply { this.tracing = tracing }
+
+ /**
+ * Specific workflow version used for the session. Defaults to null when using the latest
+ * deployment.
+ */
+ fun version(version: String?) = version(JsonField.ofNullable(version))
+
+ /** Alias for calling [Builder.version] with `version.orElse(null)`. */
+ fun version(version: Optional) = version(version.getOrNull())
+
+ /**
+ * Sets [Builder.version] to an arbitrary JSON value.
+ *
+ * You should usually call [Builder.version] with a well-typed [String] value instead. This
+ * method is primarily for setting the field to an undocumented or not yet supported value.
+ */
+ fun version(version: JsonField) = apply { this.version = version }
+
+ fun additionalProperties(additionalProperties: Map) = apply {
+ this.additionalProperties.clear()
+ putAllAdditionalProperties(additionalProperties)
+ }
+
+ fun putAdditionalProperty(key: String, value: JsonValue) = apply {
+ additionalProperties.put(key, value)
+ }
+
+ fun putAllAdditionalProperties(additionalProperties: Map) = apply {
+ this.additionalProperties.putAll(additionalProperties)
+ }
+
+ fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) }
+
+ fun removeAllAdditionalProperties(keys: Set) = apply {
+ keys.forEach(::removeAdditionalProperty)
+ }
+
+ /**
+ * Returns an immutable instance of [ChatKitWorkflow].
+ *
+ * Further updates to this [Builder] will not mutate the returned instance.
+ *
+ * The following fields are required:
+ * ```java
+ * .id()
+ * .stateVariables()
+ * .tracing()
+ * .version()
+ * ```
+ *
+ * @throws IllegalStateException if any required field is unset.
+ */
+ fun build(): ChatKitWorkflow =
+ ChatKitWorkflow(
+ checkRequired("id", id),
+ checkRequired("stateVariables", stateVariables),
+ checkRequired("tracing", tracing),
+ checkRequired("version", version),
+ additionalProperties.toMutableMap(),
+ )
+ }
+
+ private var validated: Boolean = false
+
+ fun validate(): ChatKitWorkflow = apply {
+ if (validated) {
+ return@apply
+ }
+
+ id()
+ stateVariables().ifPresent { it.validate() }
+ tracing().validate()
+ version()
+ 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 (id.asKnown().isPresent) 1 else 0) +
+ (stateVariables.asKnown().getOrNull()?.validity() ?: 0) +
+ (tracing.asKnown().getOrNull()?.validity() ?: 0) +
+ (if (version.asKnown().isPresent) 1 else 0)
+
+ /**
+ * State variable key-value pairs applied when invoking the workflow. Defaults to null when no
+ * overrides were provided.
+ */
+ class StateVariables
+ @JsonCreator
+ private constructor(
+ @com.fasterxml.jackson.annotation.JsonValue
+ private val additionalProperties: Map
+ ) {
+
+ @JsonAnyGetter
+ @ExcludeMissing
+ fun _additionalProperties(): Map = additionalProperties
+
+ fun toBuilder() = Builder().from(this)
+
+ companion object {
+
+ /** Returns a mutable builder for constructing an instance of [StateVariables]. */
+ @JvmStatic fun builder() = Builder()
+ }
+
+ /** A builder for [StateVariables]. */
+ class Builder internal constructor() {
+
+ private var additionalProperties: MutableMap = mutableMapOf()
+
+ @JvmSynthetic
+ internal fun from(stateVariables: StateVariables) = apply {
+ additionalProperties = stateVariables.additionalProperties.toMutableMap()
+ }
+
+ fun additionalProperties(additionalProperties: Map) = apply {
+ this.additionalProperties.clear()
+ putAllAdditionalProperties(additionalProperties)
+ }
+
+ fun putAdditionalProperty(key: String, value: JsonValue) = apply {
+ additionalProperties.put(key, value)
+ }
+
+ fun putAllAdditionalProperties(additionalProperties: Map) = apply {
+ this.additionalProperties.putAll(additionalProperties)
+ }
+
+ fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) }
+
+ fun removeAllAdditionalProperties(keys: Set) = apply {
+ keys.forEach(::removeAdditionalProperty)
+ }
+
+ /**
+ * Returns an immutable instance of [StateVariables].
+ *
+ * Further updates to this [Builder] will not mutate the returned instance.
+ */
+ fun build(): StateVariables = StateVariables(additionalProperties.toImmutable())
+ }
+
+ private var validated: Boolean = false
+
+ fun validate(): StateVariables = apply {
+ if (validated) {
+ return@apply
+ }
+
+ 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 =
+ additionalProperties.count { (_, value) -> !value.isNull() && !value.isMissing() }
+
+ override fun equals(other: Any?): Boolean {
+ if (this === other) {
+ return true
+ }
+
+ return other is StateVariables && additionalProperties == other.additionalProperties
+ }
+
+ private val hashCode: Int by lazy { Objects.hash(additionalProperties) }
+
+ override fun hashCode(): Int = hashCode
+
+ override fun toString() = "StateVariables{additionalProperties=$additionalProperties}"
+ }
+
+ /** Tracing settings applied to the workflow. */
+ class Tracing
+ @JsonCreator(mode = JsonCreator.Mode.DISABLED)
+ private constructor(
+ private val enabled: JsonField,
+ private val additionalProperties: MutableMap,
+ ) {
+
+ @JsonCreator
+ private constructor(
+ @JsonProperty("enabled") @ExcludeMissing enabled: JsonField = JsonMissing.of()
+ ) : this(enabled, mutableMapOf())
+
+ /**
+ * Indicates whether tracing is enabled.
+ *
+ * @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 enabled(): Boolean = enabled.getRequired("enabled")
+
+ /**
+ * Returns the raw JSON value of [enabled].
+ *
+ * Unlike [enabled], this method doesn't throw if the JSON field has an unexpected type.
+ */
+ @JsonProperty("enabled") @ExcludeMissing fun _enabled(): JsonField = enabled
+
+ @JsonAnySetter
+ private fun putAdditionalProperty(key: String, value: JsonValue) {
+ additionalProperties.put(key, value)
+ }
+
+ @JsonAnyGetter
+ @ExcludeMissing
+ fun _additionalProperties(): Map =
+ Collections.unmodifiableMap(additionalProperties)
+
+ fun toBuilder() = Builder().from(this)
+
+ companion object {
+
+ /**
+ * Returns a mutable builder for constructing an instance of [Tracing].
+ *
+ * The following fields are required:
+ * ```java
+ * .enabled()
+ * ```
+ */
+ @JvmStatic fun builder() = Builder()
+ }
+
+ /** A builder for [Tracing]. */
+ class Builder internal constructor() {
+
+ private var enabled: JsonField? = null
+ private var additionalProperties: MutableMap = mutableMapOf()
+
+ @JvmSynthetic
+ internal fun from(tracing: Tracing) = apply {
+ enabled = tracing.enabled
+ additionalProperties = tracing.additionalProperties.toMutableMap()
+ }
+
+ /** Indicates whether tracing is enabled. */
+ fun enabled(enabled: Boolean) = enabled(JsonField.of(enabled))
+
+ /**
+ * Sets [Builder.enabled] to an arbitrary JSON value.
+ *
+ * You should usually call [Builder.enabled] with a well-typed [Boolean] value instead.
+ * This method is primarily for setting the field to an undocumented or not yet
+ * supported value.
+ */
+ fun enabled(enabled: JsonField) = apply { this.enabled = enabled }
+
+ fun additionalProperties(additionalProperties: Map) = apply {
+ this.additionalProperties.clear()
+ putAllAdditionalProperties(additionalProperties)
+ }
+
+ fun putAdditionalProperty(key: String, value: JsonValue) = apply {
+ additionalProperties.put(key, value)
+ }
+
+ fun putAllAdditionalProperties(additionalProperties: Map) = apply {
+ this.additionalProperties.putAll(additionalProperties)
+ }
+
+ fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) }
+
+ fun removeAllAdditionalProperties(keys: Set) = apply {
+ keys.forEach(::removeAdditionalProperty)
+ }
+
+ /**
+ * Returns an immutable instance of [Tracing].
+ *
+ * Further updates to this [Builder] will not mutate the returned instance.
+ *
+ * The following fields are required:
+ * ```java
+ * .enabled()
+ * ```
+ *
+ * @throws IllegalStateException if any required field is unset.
+ */
+ fun build(): Tracing =
+ Tracing(checkRequired("enabled", enabled), additionalProperties.toMutableMap())
+ }
+
+ private var validated: Boolean = false
+
+ fun validate(): Tracing = apply {
+ if (validated) {
+ return@apply
+ }
+
+ enabled()
+ 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 (enabled.asKnown().isPresent) 1 else 0)
+
+ override fun equals(other: Any?): Boolean {
+ if (this === other) {
+ return true
+ }
+
+ return other is Tracing &&
+ enabled == other.enabled &&
+ additionalProperties == other.additionalProperties
+ }
+
+ private val hashCode: Int by lazy { Objects.hash(enabled, additionalProperties) }
+
+ override fun hashCode(): Int = hashCode
+
+ override fun toString() =
+ "Tracing{enabled=$enabled, additionalProperties=$additionalProperties}"
+ }
+
+ override fun equals(other: Any?): Boolean {
+ if (this === other) {
+ return true
+ }
+
+ return other is ChatKitWorkflow &&
+ id == other.id &&
+ stateVariables == other.stateVariables &&
+ tracing == other.tracing &&
+ version == other.version &&
+ additionalProperties == other.additionalProperties
+ }
+
+ private val hashCode: Int by lazy {
+ Objects.hash(id, stateVariables, tracing, version, additionalProperties)
+ }
+
+ override fun hashCode(): Int = hashCode
+
+ override fun toString() =
+ "ChatKitWorkflow{id=$id, stateVariables=$stateVariables, tracing=$tracing, version=$version, additionalProperties=$additionalProperties}"
+}
diff --git a/openai-java-core/src/main/kotlin/com/openai/models/beta/chatkit/FilePart.kt b/openai-java-core/src/main/kotlin/com/openai/models/beta/chatkit/FilePart.kt
new file mode 100644
index 00000000..02fd2a27
--- /dev/null
+++ b/openai-java-core/src/main/kotlin/com/openai/models/beta/chatkit/FilePart.kt
@@ -0,0 +1,341 @@
+// File generated from our OpenAPI spec by Stainless.
+
+package com.openai.models.beta.chatkit
+
+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.ExcludeMissing
+import com.openai.core.JsonField
+import com.openai.core.JsonMissing
+import com.openai.core.JsonValue
+import com.openai.core.checkRequired
+import com.openai.errors.OpenAIInvalidDataException
+import java.util.Collections
+import java.util.Objects
+import java.util.Optional
+import kotlin.jvm.optionals.getOrNull
+
+/** Metadata for a non-image file uploaded through ChatKit. */
+class FilePart
+@JsonCreator(mode = JsonCreator.Mode.DISABLED)
+private constructor(
+ private val id: JsonField,
+ private val mimeType: JsonField,
+ private val name: JsonField,
+ private val type: JsonValue,
+ private val uploadUrl: JsonField,
+ private val additionalProperties: MutableMap,
+) {
+
+ @JsonCreator
+ private constructor(
+ @JsonProperty("id") @ExcludeMissing id: JsonField = JsonMissing.of(),
+ @JsonProperty("mime_type") @ExcludeMissing mimeType: JsonField = JsonMissing.of(),
+ @JsonProperty("name") @ExcludeMissing name: JsonField = JsonMissing.of(),
+ @JsonProperty("type") @ExcludeMissing type: JsonValue = JsonMissing.of(),
+ @JsonProperty("upload_url") @ExcludeMissing uploadUrl: JsonField = JsonMissing.of(),
+ ) : this(id, mimeType, name, type, uploadUrl, mutableMapOf())
+
+ /**
+ * Unique identifier for the uploaded file.
+ *
+ * @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 id(): String = id.getRequired("id")
+
+ /**
+ * MIME type reported for the uploaded file. Defaults to null when unknown.
+ *
+ * @throws OpenAIInvalidDataException if the JSON field has an unexpected type (e.g. if the
+ * server responded with an unexpected value).
+ */
+ fun mimeType(): Optional = mimeType.getOptional("mime_type")
+
+ /**
+ * Original filename supplied by the uploader. Defaults to null when unnamed.
+ *
+ * @throws OpenAIInvalidDataException if the JSON field has an unexpected type (e.g. if the
+ * server responded with an unexpected value).
+ */
+ fun name(): Optional = name.getOptional("name")
+
+ /**
+ * Type discriminator that is always `file`.
+ *
+ * Expected to always return the following:
+ * ```java
+ * JsonValue.from("file")
+ * ```
+ *
+ * However, this method can be useful for debugging and logging (e.g. if the server responded
+ * with an unexpected value).
+ */
+ @JsonProperty("type") @ExcludeMissing fun _type(): JsonValue = type
+
+ /**
+ * Signed URL for downloading the uploaded file. Defaults to null when no download link is
+ * available.
+ *
+ * @throws OpenAIInvalidDataException if the JSON field has an unexpected type (e.g. if the
+ * server responded with an unexpected value).
+ */
+ fun uploadUrl(): Optional = uploadUrl.getOptional("upload_url")
+
+ /**
+ * Returns the raw JSON value of [id].
+ *
+ * Unlike [id], this method doesn't throw if the JSON field has an unexpected type.
+ */
+ @JsonProperty("id") @ExcludeMissing fun _id(): JsonField = id
+
+ /**
+ * Returns the raw JSON value of [mimeType].
+ *
+ * Unlike [mimeType], this method doesn't throw if the JSON field has an unexpected type.
+ */
+ @JsonProperty("mime_type") @ExcludeMissing fun _mimeType(): JsonField = mimeType
+
+ /**
+ * Returns the raw JSON value of [name].
+ *
+ * Unlike [name], this method doesn't throw if the JSON field has an unexpected type.
+ */
+ @JsonProperty("name") @ExcludeMissing fun _name(): JsonField = name
+
+ /**
+ * Returns the raw JSON value of [uploadUrl].
+ *
+ * Unlike [uploadUrl], this method doesn't throw if the JSON field has an unexpected type.
+ */
+ @JsonProperty("upload_url") @ExcludeMissing fun _uploadUrl(): JsonField = uploadUrl
+
+ @JsonAnySetter
+ private fun putAdditionalProperty(key: String, value: JsonValue) {
+ additionalProperties.put(key, value)
+ }
+
+ @JsonAnyGetter
+ @ExcludeMissing
+ fun _additionalProperties(): Map =
+ Collections.unmodifiableMap(additionalProperties)
+
+ fun toBuilder() = Builder().from(this)
+
+ companion object {
+
+ /**
+ * Returns a mutable builder for constructing an instance of [FilePart].
+ *
+ * The following fields are required:
+ * ```java
+ * .id()
+ * .mimeType()
+ * .name()
+ * .uploadUrl()
+ * ```
+ */
+ @JvmStatic fun builder() = Builder()
+ }
+
+ /** A builder for [FilePart]. */
+ class Builder internal constructor() {
+
+ private var id: JsonField? = null
+ private var mimeType: JsonField? = null
+ private var name: JsonField? = null
+ private var type: JsonValue = JsonValue.from("file")
+ private var uploadUrl: JsonField? = null
+ private var additionalProperties: MutableMap = mutableMapOf()
+
+ @JvmSynthetic
+ internal fun from(filePart: FilePart) = apply {
+ id = filePart.id
+ mimeType = filePart.mimeType
+ name = filePart.name
+ type = filePart.type
+ uploadUrl = filePart.uploadUrl
+ additionalProperties = filePart.additionalProperties.toMutableMap()
+ }
+
+ /** Unique identifier for the uploaded file. */
+ fun id(id: String) = id(JsonField.of(id))
+
+ /**
+ * Sets [Builder.id] to an arbitrary JSON value.
+ *
+ * You should usually call [Builder.id] with a well-typed [String] value instead. This
+ * method is primarily for setting the field to an undocumented or not yet supported value.
+ */
+ fun id(id: JsonField) = apply { this.id = id }
+
+ /** MIME type reported for the uploaded file. Defaults to null when unknown. */
+ fun mimeType(mimeType: String?) = mimeType(JsonField.ofNullable(mimeType))
+
+ /** Alias for calling [Builder.mimeType] with `mimeType.orElse(null)`. */
+ fun mimeType(mimeType: Optional) = mimeType(mimeType.getOrNull())
+
+ /**
+ * Sets [Builder.mimeType] to an arbitrary JSON value.
+ *
+ * You should usually call [Builder.mimeType] with a well-typed [String] value instead. This
+ * method is primarily for setting the field to an undocumented or not yet supported value.
+ */
+ fun mimeType(mimeType: JsonField) = apply { this.mimeType = mimeType }
+
+ /** Original filename supplied by the uploader. Defaults to null when unnamed. */
+ fun name(name: String?) = name(JsonField.ofNullable(name))
+
+ /** Alias for calling [Builder.name] with `name.orElse(null)`. */
+ fun name(name: Optional) = name(name.getOrNull())
+
+ /**
+ * Sets [Builder.name] to an arbitrary JSON value.
+ *
+ * You should usually call [Builder.name] with a well-typed [String] value instead. This
+ * method is primarily for setting the field to an undocumented or not yet supported value.
+ */
+ fun name(name: JsonField) = apply { this.name = name }
+
+ /**
+ * 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("file")
+ * ```
+ *
+ * This method is primarily for setting the field to an undocumented or not yet supported
+ * value.
+ */
+ fun type(type: JsonValue) = apply { this.type = type }
+
+ /**
+ * Signed URL for downloading the uploaded file. Defaults to null when no download link is
+ * available.
+ */
+ fun uploadUrl(uploadUrl: String?) = uploadUrl(JsonField.ofNullable(uploadUrl))
+
+ /** Alias for calling [Builder.uploadUrl] with `uploadUrl.orElse(null)`. */
+ fun uploadUrl(uploadUrl: Optional) = uploadUrl(uploadUrl.getOrNull())
+
+ /**
+ * Sets [Builder.uploadUrl] to an arbitrary JSON value.
+ *
+ * You should usually call [Builder.uploadUrl] with a well-typed [String] value instead.
+ * This method is primarily for setting the field to an undocumented or not yet supported
+ * value.
+ */
+ fun uploadUrl(uploadUrl: JsonField) = apply { this.uploadUrl = uploadUrl }
+
+ fun additionalProperties(additionalProperties: Map) = apply {
+ this.additionalProperties.clear()
+ putAllAdditionalProperties(additionalProperties)
+ }
+
+ fun putAdditionalProperty(key: String, value: JsonValue) = apply {
+ additionalProperties.put(key, value)
+ }
+
+ fun putAllAdditionalProperties(additionalProperties: Map) = apply {
+ this.additionalProperties.putAll(additionalProperties)
+ }
+
+ fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) }
+
+ fun removeAllAdditionalProperties(keys: Set) = apply {
+ keys.forEach(::removeAdditionalProperty)
+ }
+
+ /**
+ * Returns an immutable instance of [FilePart].
+ *
+ * Further updates to this [Builder] will not mutate the returned instance.
+ *
+ * The following fields are required:
+ * ```java
+ * .id()
+ * .mimeType()
+ * .name()
+ * .uploadUrl()
+ * ```
+ *
+ * @throws IllegalStateException if any required field is unset.
+ */
+ fun build(): FilePart =
+ FilePart(
+ checkRequired("id", id),
+ checkRequired("mimeType", mimeType),
+ checkRequired("name", name),
+ type,
+ checkRequired("uploadUrl", uploadUrl),
+ additionalProperties.toMutableMap(),
+ )
+ }
+
+ private var validated: Boolean = false
+
+ fun validate(): FilePart = apply {
+ if (validated) {
+ return@apply
+ }
+
+ id()
+ mimeType()
+ name()
+ _type().let {
+ if (it != JsonValue.from("file")) {
+ throw OpenAIInvalidDataException("'type' is invalid, received $it")
+ }
+ }
+ uploadUrl()
+ 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 (id.asKnown().isPresent) 1 else 0) +
+ (if (mimeType.asKnown().isPresent) 1 else 0) +
+ (if (name.asKnown().isPresent) 1 else 0) +
+ type.let { if (it == JsonValue.from("file")) 1 else 0 } +
+ (if (uploadUrl.asKnown().isPresent) 1 else 0)
+
+ override fun equals(other: Any?): Boolean {
+ if (this === other) {
+ return true
+ }
+
+ return other is FilePart &&
+ id == other.id &&
+ mimeType == other.mimeType &&
+ name == other.name &&
+ type == other.type &&
+ uploadUrl == other.uploadUrl &&
+ additionalProperties == other.additionalProperties
+ }
+
+ private val hashCode: Int by lazy {
+ Objects.hash(id, mimeType, name, type, uploadUrl, additionalProperties)
+ }
+
+ override fun hashCode(): Int = hashCode
+
+ override fun toString() =
+ "FilePart{id=$id, mimeType=$mimeType, name=$name, type=$type, uploadUrl=$uploadUrl, additionalProperties=$additionalProperties}"
+}
diff --git a/openai-java-core/src/main/kotlin/com/openai/models/beta/chatkit/ImagePart.kt b/openai-java-core/src/main/kotlin/com/openai/models/beta/chatkit/ImagePart.kt
new file mode 100644
index 00000000..148a7003
--- /dev/null
+++ b/openai-java-core/src/main/kotlin/com/openai/models/beta/chatkit/ImagePart.kt
@@ -0,0 +1,377 @@
+// File generated from our OpenAPI spec by Stainless.
+
+package com.openai.models.beta.chatkit
+
+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.ExcludeMissing
+import com.openai.core.JsonField
+import com.openai.core.JsonMissing
+import com.openai.core.JsonValue
+import com.openai.core.checkRequired
+import com.openai.errors.OpenAIInvalidDataException
+import java.util.Collections
+import java.util.Objects
+import java.util.Optional
+import kotlin.jvm.optionals.getOrNull
+
+/** Metadata for an image uploaded through ChatKit. */
+class ImagePart
+@JsonCreator(mode = JsonCreator.Mode.DISABLED)
+private constructor(
+ private val id: JsonField,
+ private val mimeType: JsonField,
+ private val name: JsonField,
+ private val previewUrl: JsonField,
+ private val type: JsonValue,
+ private val uploadUrl: JsonField,
+ private val additionalProperties: MutableMap,
+) {
+
+ @JsonCreator
+ private constructor(
+ @JsonProperty("id") @ExcludeMissing id: JsonField = JsonMissing.of(),
+ @JsonProperty("mime_type") @ExcludeMissing mimeType: JsonField = JsonMissing.of(),
+ @JsonProperty("name") @ExcludeMissing name: JsonField = JsonMissing.of(),
+ @JsonProperty("preview_url")
+ @ExcludeMissing
+ previewUrl: JsonField = JsonMissing.of(),
+ @JsonProperty("type") @ExcludeMissing type: JsonValue = JsonMissing.of(),
+ @JsonProperty("upload_url") @ExcludeMissing uploadUrl: JsonField = JsonMissing.of(),
+ ) : this(id, mimeType, name, previewUrl, type, uploadUrl, mutableMapOf())
+
+ /**
+ * Unique identifier for the uploaded image.
+ *
+ * @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 id(): String = id.getRequired("id")
+
+ /**
+ * MIME type of the uploaded image.
+ *
+ * @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 mimeType(): String = mimeType.getRequired("mime_type")
+
+ /**
+ * Original filename for the uploaded image. Defaults to null when unnamed.
+ *
+ * @throws OpenAIInvalidDataException if the JSON field has an unexpected type (e.g. if the
+ * server responded with an unexpected value).
+ */
+ fun name(): Optional = name.getOptional("name")
+
+ /**
+ * Preview URL that can be rendered inline for the image.
+ *
+ * @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 previewUrl(): String = previewUrl.getRequired("preview_url")
+
+ /**
+ * Type discriminator that is always `image`.
+ *
+ * Expected to always return the following:
+ * ```java
+ * JsonValue.from("image")
+ * ```
+ *
+ * However, this method can be useful for debugging and logging (e.g. if the server responded
+ * with an unexpected value).
+ */
+ @JsonProperty("type") @ExcludeMissing fun _type(): JsonValue = type
+
+ /**
+ * Signed URL for downloading the uploaded image. Defaults to null when no download link is
+ * available.
+ *
+ * @throws OpenAIInvalidDataException if the JSON field has an unexpected type (e.g. if the
+ * server responded with an unexpected value).
+ */
+ fun uploadUrl(): Optional = uploadUrl.getOptional("upload_url")
+
+ /**
+ * Returns the raw JSON value of [id].
+ *
+ * Unlike [id], this method doesn't throw if the JSON field has an unexpected type.
+ */
+ @JsonProperty("id") @ExcludeMissing fun _id(): JsonField = id
+
+ /**
+ * Returns the raw JSON value of [mimeType].
+ *
+ * Unlike [mimeType], this method doesn't throw if the JSON field has an unexpected type.
+ */
+ @JsonProperty("mime_type") @ExcludeMissing fun _mimeType(): JsonField = mimeType
+
+ /**
+ * Returns the raw JSON value of [name].
+ *
+ * Unlike [name], this method doesn't throw if the JSON field has an unexpected type.
+ */
+ @JsonProperty("name") @ExcludeMissing fun _name(): JsonField = name
+
+ /**
+ * Returns the raw JSON value of [previewUrl].
+ *
+ * Unlike [previewUrl], this method doesn't throw if the JSON field has an unexpected type.
+ */
+ @JsonProperty("preview_url") @ExcludeMissing fun _previewUrl(): JsonField = previewUrl
+
+ /**
+ * Returns the raw JSON value of [uploadUrl].
+ *
+ * Unlike [uploadUrl], this method doesn't throw if the JSON field has an unexpected type.
+ */
+ @JsonProperty("upload_url") @ExcludeMissing fun _uploadUrl(): JsonField = uploadUrl
+
+ @JsonAnySetter
+ private fun putAdditionalProperty(key: String, value: JsonValue) {
+ additionalProperties.put(key, value)
+ }
+
+ @JsonAnyGetter
+ @ExcludeMissing
+ fun _additionalProperties(): Map =
+ Collections.unmodifiableMap(additionalProperties)
+
+ fun toBuilder() = Builder().from(this)
+
+ companion object {
+
+ /**
+ * Returns a mutable builder for constructing an instance of [ImagePart].
+ *
+ * The following fields are required:
+ * ```java
+ * .id()
+ * .mimeType()
+ * .name()
+ * .previewUrl()
+ * .uploadUrl()
+ * ```
+ */
+ @JvmStatic fun builder() = Builder()
+ }
+
+ /** A builder for [ImagePart]. */
+ class Builder internal constructor() {
+
+ private var id: JsonField? = null
+ private var mimeType: JsonField? = null
+ private var name: JsonField? = null
+ private var previewUrl: JsonField? = null
+ private var type: JsonValue = JsonValue.from("image")
+ private var uploadUrl: JsonField? = null
+ private var additionalProperties: MutableMap = mutableMapOf()
+
+ @JvmSynthetic
+ internal fun from(imagePart: ImagePart) = apply {
+ id = imagePart.id
+ mimeType = imagePart.mimeType
+ name = imagePart.name
+ previewUrl = imagePart.previewUrl
+ type = imagePart.type
+ uploadUrl = imagePart.uploadUrl
+ additionalProperties = imagePart.additionalProperties.toMutableMap()
+ }
+
+ /** Unique identifier for the uploaded image. */
+ fun id(id: String) = id(JsonField.of(id))
+
+ /**
+ * Sets [Builder.id] to an arbitrary JSON value.
+ *
+ * You should usually call [Builder.id] with a well-typed [String] value instead. This
+ * method is primarily for setting the field to an undocumented or not yet supported value.
+ */
+ fun id(id: JsonField) = apply { this.id = id }
+
+ /** MIME type of the uploaded image. */
+ fun mimeType(mimeType: String) = mimeType(JsonField.of(mimeType))
+
+ /**
+ * Sets [Builder.mimeType] to an arbitrary JSON value.
+ *
+ * You should usually call [Builder.mimeType] with a well-typed [String] value instead. This
+ * method is primarily for setting the field to an undocumented or not yet supported value.
+ */
+ fun mimeType(mimeType: JsonField) = apply { this.mimeType = mimeType }
+
+ /** Original filename for the uploaded image. Defaults to null when unnamed. */
+ fun name(name: String?) = name(JsonField.ofNullable(name))
+
+ /** Alias for calling [Builder.name] with `name.orElse(null)`. */
+ fun name(name: Optional) = name(name.getOrNull())
+
+ /**
+ * Sets [Builder.name] to an arbitrary JSON value.
+ *
+ * You should usually call [Builder.name] with a well-typed [String] value instead. This
+ * method is primarily for setting the field to an undocumented or not yet supported value.
+ */
+ fun name(name: JsonField) = apply { this.name = name }
+
+ /** Preview URL that can be rendered inline for the image. */
+ fun previewUrl(previewUrl: String) = previewUrl(JsonField.of(previewUrl))
+
+ /**
+ * Sets [Builder.previewUrl] to an arbitrary JSON value.
+ *
+ * You should usually call [Builder.previewUrl] with a well-typed [String] value instead.
+ * This method is primarily for setting the field to an undocumented or not yet supported
+ * value.
+ */
+ fun previewUrl(previewUrl: JsonField) = apply { this.previewUrl = previewUrl }
+
+ /**
+ * 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("image")
+ * ```
+ *
+ * This method is primarily for setting the field to an undocumented or not yet supported
+ * value.
+ */
+ fun type(type: JsonValue) = apply { this.type = type }
+
+ /**
+ * Signed URL for downloading the uploaded image. Defaults to null when no download link is
+ * available.
+ */
+ fun uploadUrl(uploadUrl: String?) = uploadUrl(JsonField.ofNullable(uploadUrl))
+
+ /** Alias for calling [Builder.uploadUrl] with `uploadUrl.orElse(null)`. */
+ fun uploadUrl(uploadUrl: Optional) = uploadUrl(uploadUrl.getOrNull())
+
+ /**
+ * Sets [Builder.uploadUrl] to an arbitrary JSON value.
+ *
+ * You should usually call [Builder.uploadUrl] with a well-typed [String] value instead.
+ * This method is primarily for setting the field to an undocumented or not yet supported
+ * value.
+ */
+ fun uploadUrl(uploadUrl: JsonField) = apply { this.uploadUrl = uploadUrl }
+
+ fun additionalProperties(additionalProperties: Map) = apply {
+ this.additionalProperties.clear()
+ putAllAdditionalProperties(additionalProperties)
+ }
+
+ fun putAdditionalProperty(key: String, value: JsonValue) = apply {
+ additionalProperties.put(key, value)
+ }
+
+ fun putAllAdditionalProperties(additionalProperties: Map) = apply {
+ this.additionalProperties.putAll(additionalProperties)
+ }
+
+ fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) }
+
+ fun removeAllAdditionalProperties(keys: Set) = apply {
+ keys.forEach(::removeAdditionalProperty)
+ }
+
+ /**
+ * Returns an immutable instance of [ImagePart].
+ *
+ * Further updates to this [Builder] will not mutate the returned instance.
+ *
+ * The following fields are required:
+ * ```java
+ * .id()
+ * .mimeType()
+ * .name()
+ * .previewUrl()
+ * .uploadUrl()
+ * ```
+ *
+ * @throws IllegalStateException if any required field is unset.
+ */
+ fun build(): ImagePart =
+ ImagePart(
+ checkRequired("id", id),
+ checkRequired("mimeType", mimeType),
+ checkRequired("name", name),
+ checkRequired("previewUrl", previewUrl),
+ type,
+ checkRequired("uploadUrl", uploadUrl),
+ additionalProperties.toMutableMap(),
+ )
+ }
+
+ private var validated: Boolean = false
+
+ fun validate(): ImagePart = apply {
+ if (validated) {
+ return@apply
+ }
+
+ id()
+ mimeType()
+ name()
+ previewUrl()
+ _type().let {
+ if (it != JsonValue.from("image")) {
+ throw OpenAIInvalidDataException("'type' is invalid, received $it")
+ }
+ }
+ uploadUrl()
+ 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 (id.asKnown().isPresent) 1 else 0) +
+ (if (mimeType.asKnown().isPresent) 1 else 0) +
+ (if (name.asKnown().isPresent) 1 else 0) +
+ (if (previewUrl.asKnown().isPresent) 1 else 0) +
+ type.let { if (it == JsonValue.from("image")) 1 else 0 } +
+ (if (uploadUrl.asKnown().isPresent) 1 else 0)
+
+ override fun equals(other: Any?): Boolean {
+ if (this === other) {
+ return true
+ }
+
+ return other is ImagePart &&
+ id == other.id &&
+ mimeType == other.mimeType &&
+ name == other.name &&
+ previewUrl == other.previewUrl &&
+ type == other.type &&
+ uploadUrl == other.uploadUrl &&
+ additionalProperties == other.additionalProperties
+ }
+
+ private val hashCode: Int by lazy {
+ Objects.hash(id, mimeType, name, previewUrl, type, uploadUrl, additionalProperties)
+ }
+
+ override fun hashCode(): Int = hashCode
+
+ override fun toString() =
+ "ImagePart{id=$id, mimeType=$mimeType, name=$name, previewUrl=$previewUrl, type=$type, uploadUrl=$uploadUrl, additionalProperties=$additionalProperties}"
+}
diff --git a/openai-java-core/src/main/kotlin/com/openai/models/beta/chatkit/sessions/SessionCancelParams.kt b/openai-java-core/src/main/kotlin/com/openai/models/beta/chatkit/sessions/SessionCancelParams.kt
new file mode 100644
index 00000000..d5cadea1
--- /dev/null
+++ b/openai-java-core/src/main/kotlin/com/openai/models/beta/chatkit/sessions/SessionCancelParams.kt
@@ -0,0 +1,229 @@
+// File generated from our OpenAPI spec by Stainless.
+
+package com.openai.models.beta.chatkit.sessions
+
+import com.openai.core.JsonValue
+import com.openai.core.Params
+import com.openai.core.http.Headers
+import com.openai.core.http.QueryParams
+import com.openai.core.toImmutable
+import java.util.Objects
+import java.util.Optional
+import kotlin.jvm.optionals.getOrNull
+
+/** Cancel a ChatKit session */
+class SessionCancelParams
+private constructor(
+ private val sessionId: String?,
+ private val additionalHeaders: Headers,
+ private val additionalQueryParams: QueryParams,
+ private val additionalBodyProperties: Map,
+) : Params {
+
+ fun sessionId(): Optional = Optional.ofNullable(sessionId)
+
+ /** Additional body properties to send with the request. */
+ fun _additionalBodyProperties(): Map = additionalBodyProperties
+
+ /** Additional headers to send with the request. */
+ fun _additionalHeaders(): Headers = additionalHeaders
+
+ /** Additional query param to send with the request. */
+ fun _additionalQueryParams(): QueryParams = additionalQueryParams
+
+ fun toBuilder() = Builder().from(this)
+
+ companion object {
+
+ @JvmStatic fun none(): SessionCancelParams = builder().build()
+
+ /** Returns a mutable builder for constructing an instance of [SessionCancelParams]. */
+ @JvmStatic fun builder() = Builder()
+ }
+
+ /** A builder for [SessionCancelParams]. */
+ class Builder internal constructor() {
+
+ private var sessionId: String? = null
+ private var additionalHeaders: Headers.Builder = Headers.builder()
+ private var additionalQueryParams: QueryParams.Builder = QueryParams.builder()
+ private var additionalBodyProperties: MutableMap = mutableMapOf()
+
+ @JvmSynthetic
+ internal fun from(sessionCancelParams: SessionCancelParams) = apply {
+ sessionId = sessionCancelParams.sessionId
+ additionalHeaders = sessionCancelParams.additionalHeaders.toBuilder()
+ additionalQueryParams = sessionCancelParams.additionalQueryParams.toBuilder()
+ additionalBodyProperties = sessionCancelParams.additionalBodyProperties.toMutableMap()
+ }
+
+ fun sessionId(sessionId: String?) = apply { this.sessionId = sessionId }
+
+ /** Alias for calling [Builder.sessionId] with `sessionId.orElse(null)`. */
+ fun sessionId(sessionId: Optional) = sessionId(sessionId.getOrNull())
+
+ fun additionalHeaders(additionalHeaders: Headers) = apply {
+ this.additionalHeaders.clear()
+ putAllAdditionalHeaders(additionalHeaders)
+ }
+
+ fun additionalHeaders(additionalHeaders: Map>) = apply {
+ this.additionalHeaders.clear()
+ putAllAdditionalHeaders(additionalHeaders)
+ }
+
+ fun putAdditionalHeader(name: String, value: String) = apply {
+ additionalHeaders.put(name, value)
+ }
+
+ fun putAdditionalHeaders(name: String, values: Iterable) = apply {
+ additionalHeaders.put(name, values)
+ }
+
+ fun putAllAdditionalHeaders(additionalHeaders: Headers) = apply {
+ this.additionalHeaders.putAll(additionalHeaders)
+ }
+
+ fun putAllAdditionalHeaders(additionalHeaders: Map>) = apply {
+ this.additionalHeaders.putAll(additionalHeaders)
+ }
+
+ fun replaceAdditionalHeaders(name: String, value: String) = apply {
+ additionalHeaders.replace(name, value)
+ }
+
+ fun replaceAdditionalHeaders(name: String, values: Iterable) = apply {
+ additionalHeaders.replace(name, values)
+ }
+
+ fun replaceAllAdditionalHeaders(additionalHeaders: Headers) = apply {
+ this.additionalHeaders.replaceAll(additionalHeaders)
+ }
+
+ fun replaceAllAdditionalHeaders(additionalHeaders: Map>) = apply {
+ this.additionalHeaders.replaceAll(additionalHeaders)
+ }
+
+ fun removeAdditionalHeaders(name: String) = apply { additionalHeaders.remove(name) }
+
+ fun removeAllAdditionalHeaders(names: Set) = apply {
+ additionalHeaders.removeAll(names)
+ }
+
+ fun additionalQueryParams(additionalQueryParams: QueryParams) = apply {
+ this.additionalQueryParams.clear()
+ putAllAdditionalQueryParams(additionalQueryParams)
+ }
+
+ fun additionalQueryParams(additionalQueryParams: Map>) = apply {
+ this.additionalQueryParams.clear()
+ putAllAdditionalQueryParams(additionalQueryParams)
+ }
+
+ fun putAdditionalQueryParam(key: String, value: String) = apply {
+ additionalQueryParams.put(key, value)
+ }
+
+ fun putAdditionalQueryParams(key: String, values: Iterable) = apply {
+ additionalQueryParams.put(key, values)
+ }
+
+ fun putAllAdditionalQueryParams(additionalQueryParams: QueryParams) = apply {
+ this.additionalQueryParams.putAll(additionalQueryParams)
+ }
+
+ fun putAllAdditionalQueryParams(additionalQueryParams: Map>) =
+ apply {
+ this.additionalQueryParams.putAll(additionalQueryParams)
+ }
+
+ fun replaceAdditionalQueryParams(key: String, value: String) = apply {
+ additionalQueryParams.replace(key, value)
+ }
+
+ fun replaceAdditionalQueryParams(key: String, values: Iterable) = apply {
+ additionalQueryParams.replace(key, values)
+ }
+
+ fun replaceAllAdditionalQueryParams(additionalQueryParams: QueryParams) = apply {
+ this.additionalQueryParams.replaceAll(additionalQueryParams)
+ }
+
+ fun replaceAllAdditionalQueryParams(additionalQueryParams: Map>) =
+ apply {
+ this.additionalQueryParams.replaceAll(additionalQueryParams)
+ }
+
+ fun removeAdditionalQueryParams(key: String) = apply { additionalQueryParams.remove(key) }
+
+ fun removeAllAdditionalQueryParams(keys: Set) = apply {
+ additionalQueryParams.removeAll(keys)
+ }
+
+ fun additionalBodyProperties(additionalBodyProperties: Map) = apply {
+ this.additionalBodyProperties.clear()
+ putAllAdditionalBodyProperties(additionalBodyProperties)
+ }
+
+ fun putAdditionalBodyProperty(key: String, value: JsonValue) = apply {
+ additionalBodyProperties.put(key, value)
+ }
+
+ fun putAllAdditionalBodyProperties(additionalBodyProperties: Map) =
+ apply {
+ this.additionalBodyProperties.putAll(additionalBodyProperties)
+ }
+
+ fun removeAdditionalBodyProperty(key: String) = apply {
+ additionalBodyProperties.remove(key)
+ }
+
+ fun removeAllAdditionalBodyProperties(keys: Set) = apply {
+ keys.forEach(::removeAdditionalBodyProperty)
+ }
+
+ /**
+ * Returns an immutable instance of [SessionCancelParams].
+ *
+ * Further updates to this [Builder] will not mutate the returned instance.
+ */
+ fun build(): SessionCancelParams =
+ SessionCancelParams(
+ sessionId,
+ additionalHeaders.build(),
+ additionalQueryParams.build(),
+ additionalBodyProperties.toImmutable(),
+ )
+ }
+
+ fun _body(): Optional