diff --git a/.release-please-manifest.json b/.release-please-manifest.json
index 647ed9ca..88e4c443 100644
--- a/.release-please-manifest.json
+++ b/.release-please-manifest.json
@@ -1,3 +1,3 @@
{
- ".": "4.19.0"
+ ".": "4.20.0"
}
\ No newline at end of file
diff --git a/.stats.yml b/.stats.yml
index 10450956..03d2cca2 100644
--- a/.stats.yml
+++ b/.stats.yml
@@ -1,4 +1,4 @@
-configured_endpoints: 136
-openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/openai%2Fopenai-bff810f46da56eff8d5e189b0d1f56ac07a8289723666138549d4239cad7c2ea.yml
-openapi_spec_hash: 7532ce5a6f490c8f5d1e079c76c70535
-config_hash: a1454ffd9612dee11f9d5a98e55eac9e
+configured_endpoints: 147
+openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/openai%2Fopenai-47ef7e0aaa2f2052404041650c9b4d7d8c9c51c45ef2cb081548f329c3f81a6a.yml
+openapi_spec_hash: 0207b30cf74121a12c1647e25463cee9
+config_hash: 8dca0f2dc2706c07cf2f8d0ed4dc062e
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 78ee6002..fb30ec13 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,5 +1,14 @@
# Changelog
+## 4.20.0 (2026-02-10)
+
+Full Changelog: [v4.19.0...v4.20.0](https://github.com/openai/openai-java/compare/v4.19.0...v4.20.0)
+
+### Features
+
+* **api:** skills and hosted shell ([fcd724d](https://github.com/openai/openai-java/commit/fcd724d2822b755ef44b9de8f9b5573d82271ce7))
+* **api:** support for images in batch api ([c73908a](https://github.com/openai/openai-java/commit/c73908a19f26fa12350f7a5880401bd260420216))
+
## 4.19.0 (2026-02-09)
Full Changelog: [v4.18.0...v4.19.0](https://github.com/openai/openai-java/compare/v4.18.0...v4.19.0)
diff --git a/README.md b/README.md
index bad6ed44..fd9f5aff 100644
--- a/README.md
+++ b/README.md
@@ -2,8 +2,8 @@
-[](https://central.sonatype.com/artifact/com.openai/openai-java/4.19.0)
-[](https://javadoc.io/doc/com.openai/openai-java/4.19.0)
+[](https://central.sonatype.com/artifact/com.openai/openai-java/4.20.0)
+[](https://javadoc.io/doc/com.openai/openai-java/4.20.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.19.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.20.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.19.0")
+implementation("com.openai:openai-java:4.20.0")
```
### Maven
@@ -33,7 +33,7 @@ implementation("com.openai:openai-java:4.19.0")
com.openai
openai-java
- 4.19.0
+ 4.20.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.19.0")
+implementation("com.openai:openai-java-spring-boot-starter:4.20.0")
```
#### Maven
@@ -1351,7 +1351,7 @@ implementation("com.openai:openai-java-spring-boot-starter:4.19.0")
com.openai
openai-java-spring-boot-starter
- 4.19.0
+ 4.20.0
```
diff --git a/build.gradle.kts b/build.gradle.kts
index 1a7dcb63..5849b5ef 100644
--- a/build.gradle.kts
+++ b/build.gradle.kts
@@ -8,7 +8,7 @@ repositories {
allprojects {
group = "com.openai"
- version = "4.19.0" // x-release-please-version
+ version = "4.20.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 f0489a2f..0cfaa4aa 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
@@ -20,6 +20,7 @@ import com.openai.services.blocking.ModelService
import com.openai.services.blocking.ModerationService
import com.openai.services.blocking.RealtimeService
import com.openai.services.blocking.ResponseService
+import com.openai.services.blocking.SkillService
import com.openai.services.blocking.UploadService
import com.openai.services.blocking.VectorStoreService
import com.openai.services.blocking.VideoService
@@ -102,6 +103,8 @@ interface OpenAIClient {
fun containers(): ContainerService
+ fun skills(): SkillService
+
fun videos(): VideoService
/**
@@ -167,6 +170,8 @@ interface OpenAIClient {
fun containers(): ContainerService.WithRawResponse
+ fun skills(): SkillService.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 a3074bc1..13bf29f2 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
@@ -20,6 +20,7 @@ import com.openai.services.async.ModelServiceAsync
import com.openai.services.async.ModerationServiceAsync
import com.openai.services.async.RealtimeServiceAsync
import com.openai.services.async.ResponseServiceAsync
+import com.openai.services.async.SkillServiceAsync
import com.openai.services.async.UploadServiceAsync
import com.openai.services.async.VectorStoreServiceAsync
import com.openai.services.async.VideoServiceAsync
@@ -102,6 +103,8 @@ interface OpenAIClientAsync {
fun containers(): ContainerServiceAsync
+ fun skills(): SkillServiceAsync
+
fun videos(): VideoServiceAsync
/**
@@ -169,6 +172,8 @@ interface OpenAIClientAsync {
fun containers(): ContainerServiceAsync.WithRawResponse
+ fun skills(): SkillServiceAsync.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 1424255b..74035353 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
@@ -38,6 +38,8 @@ import com.openai.services.async.RealtimeServiceAsync
import com.openai.services.async.RealtimeServiceAsyncImpl
import com.openai.services.async.ResponseServiceAsync
import com.openai.services.async.ResponseServiceAsyncImpl
+import com.openai.services.async.SkillServiceAsync
+import com.openai.services.async.SkillServiceAsyncImpl
import com.openai.services.async.UploadServiceAsync
import com.openai.services.async.UploadServiceAsyncImpl
import com.openai.services.async.VectorStoreServiceAsync
@@ -137,6 +139,10 @@ class OpenAIClientAsyncImpl(private val clientOptions: ClientOptions) : OpenAICl
ContainerServiceAsyncImpl(clientOptionsWithUserAgent)
}
+ private val skills: SkillServiceAsync by lazy {
+ SkillServiceAsyncImpl(clientOptionsWithUserAgent)
+ }
+
private val videos: VideoServiceAsync by lazy {
VideoServiceAsyncImpl(clientOptionsWithUserAgent)
}
@@ -188,6 +194,8 @@ class OpenAIClientAsyncImpl(private val clientOptions: ClientOptions) : OpenAICl
override fun containers(): ContainerServiceAsync = containers
+ override fun skills(): SkillServiceAsync = skills
+
override fun videos(): VideoServiceAsync = videos
override fun close() = clientOptions.close()
@@ -275,6 +283,10 @@ class OpenAIClientAsyncImpl(private val clientOptions: ClientOptions) : OpenAICl
ContainerServiceAsyncImpl.WithRawResponseImpl(clientOptions)
}
+ private val skills: SkillServiceAsync.WithRawResponse by lazy {
+ SkillServiceAsyncImpl.WithRawResponseImpl(clientOptions)
+ }
+
private val videos: VideoServiceAsync.WithRawResponse by lazy {
VideoServiceAsyncImpl.WithRawResponseImpl(clientOptions)
}
@@ -326,6 +338,8 @@ class OpenAIClientAsyncImpl(private val clientOptions: ClientOptions) : OpenAICl
override fun containers(): ContainerServiceAsync.WithRawResponse = containers
+ override fun skills(): SkillServiceAsync.WithRawResponse = skills
+
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 22fa8afd..112a694d 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
@@ -38,6 +38,8 @@ import com.openai.services.blocking.RealtimeService
import com.openai.services.blocking.RealtimeServiceImpl
import com.openai.services.blocking.ResponseService
import com.openai.services.blocking.ResponseServiceImpl
+import com.openai.services.blocking.SkillService
+import com.openai.services.blocking.SkillServiceImpl
import com.openai.services.blocking.UploadService
import com.openai.services.blocking.UploadServiceImpl
import com.openai.services.blocking.VectorStoreService
@@ -123,6 +125,8 @@ class OpenAIClientImpl(private val clientOptions: ClientOptions) : OpenAIClient
ContainerServiceImpl(clientOptionsWithUserAgent)
}
+ private val skills: SkillService by lazy { SkillServiceImpl(clientOptionsWithUserAgent) }
+
private val videos: VideoService by lazy { VideoServiceImpl(clientOptionsWithUserAgent) }
override fun async(): OpenAIClientAsync = async
@@ -172,6 +176,8 @@ class OpenAIClientImpl(private val clientOptions: ClientOptions) : OpenAIClient
override fun containers(): ContainerService = containers
+ override fun skills(): SkillService = skills
+
override fun videos(): VideoService = videos
override fun close() = clientOptions.close()
@@ -259,6 +265,10 @@ class OpenAIClientImpl(private val clientOptions: ClientOptions) : OpenAIClient
ContainerServiceImpl.WithRawResponseImpl(clientOptions)
}
+ private val skills: SkillService.WithRawResponse by lazy {
+ SkillServiceImpl.WithRawResponseImpl(clientOptions)
+ }
+
private val videos: VideoService.WithRawResponse by lazy {
VideoServiceImpl.WithRawResponseImpl(clientOptions)
}
@@ -310,6 +320,8 @@ class OpenAIClientImpl(private val clientOptions: ClientOptions) : OpenAIClient
override fun containers(): ContainerService.WithRawResponse = containers
+ override fun skills(): SkillService.WithRawResponse = skills
+
override fun videos(): VideoService.WithRawResponse = videos
}
}
diff --git a/openai-java-core/src/main/kotlin/com/openai/models/batches/BatchCreateParams.kt b/openai-java-core/src/main/kotlin/com/openai/models/batches/BatchCreateParams.kt
index 6c4be6fa..6968e467 100644
--- a/openai-java-core/src/main/kotlin/com/openai/models/batches/BatchCreateParams.kt
+++ b/openai-java-core/src/main/kotlin/com/openai/models/batches/BatchCreateParams.kt
@@ -40,9 +40,10 @@ private constructor(
/**
* The endpoint to be used for all requests in the batch. Currently `/v1/responses`,
- * `/v1/chat/completions`, `/v1/embeddings`, `/v1/completions`, and `/v1/moderations` are
- * supported. Note that `/v1/embeddings` batches are also restricted to a maximum of 50,000
- * embedding inputs across all requests in the batch.
+ * `/v1/chat/completions`, `/v1/embeddings`, `/v1/completions`, `/v1/moderations`,
+ * `/v1/images/generations`, and `/v1/images/edits` are supported. Note that `/v1/embeddings`
+ * batches are also restricted to a maximum of 50,000 embedding inputs across all requests in
+ * the batch.
*
* @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).
@@ -197,9 +198,10 @@ private constructor(
/**
* The endpoint to be used for all requests in the batch. Currently `/v1/responses`,
- * `/v1/chat/completions`, `/v1/embeddings`, `/v1/completions`, and `/v1/moderations` are
- * supported. Note that `/v1/embeddings` batches are also restricted to a maximum of 50,000
- * embedding inputs across all requests in the batch.
+ * `/v1/chat/completions`, `/v1/embeddings`, `/v1/completions`, `/v1/moderations`,
+ * `/v1/images/generations`, and `/v1/images/edits` are supported. Note that
+ * `/v1/embeddings` batches are also restricted to a maximum of 50,000 embedding inputs
+ * across all requests in the batch.
*/
fun endpoint(endpoint: Endpoint) = apply { body.endpoint(endpoint) }
@@ -467,9 +469,10 @@ private constructor(
/**
* The endpoint to be used for all requests in the batch. Currently `/v1/responses`,
- * `/v1/chat/completions`, `/v1/embeddings`, `/v1/completions`, and `/v1/moderations` are
- * supported. Note that `/v1/embeddings` batches are also restricted to a maximum of 50,000
- * embedding inputs across all requests in the batch.
+ * `/v1/chat/completions`, `/v1/embeddings`, `/v1/completions`, `/v1/moderations`,
+ * `/v1/images/generations`, and `/v1/images/edits` are supported. Note that
+ * `/v1/embeddings` batches are also restricted to a maximum of 50,000 embedding inputs
+ * across all requests in the batch.
*
* @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).
@@ -624,9 +627,10 @@ private constructor(
/**
* The endpoint to be used for all requests in the batch. Currently `/v1/responses`,
- * `/v1/chat/completions`, `/v1/embeddings`, `/v1/completions`, and `/v1/moderations`
- * are supported. Note that `/v1/embeddings` batches are also restricted to a maximum of
- * 50,000 embedding inputs across all requests in the batch.
+ * `/v1/chat/completions`, `/v1/embeddings`, `/v1/completions`, `/v1/moderations`,
+ * `/v1/images/generations`, and `/v1/images/edits` are supported. Note that
+ * `/v1/embeddings` batches are also restricted to a maximum of 50,000 embedding inputs
+ * across all requests in the batch.
*/
fun endpoint(endpoint: Endpoint) = endpoint(JsonField.of(endpoint))
@@ -943,9 +947,10 @@ private constructor(
/**
* The endpoint to be used for all requests in the batch. Currently `/v1/responses`,
- * `/v1/chat/completions`, `/v1/embeddings`, `/v1/completions`, and `/v1/moderations` are
- * supported. Note that `/v1/embeddings` batches are also restricted to a maximum of 50,000
- * embedding inputs across all requests in the batch.
+ * `/v1/chat/completions`, `/v1/embeddings`, `/v1/completions`, `/v1/moderations`,
+ * `/v1/images/generations`, and `/v1/images/edits` are supported. Note that `/v1/embeddings`
+ * batches are also restricted to a maximum of 50,000 embedding inputs across all requests in
+ * the batch.
*/
class Endpoint @JsonCreator private constructor(private val value: JsonField) : Enum {
@@ -971,6 +976,10 @@ private constructor(
@JvmField val V1_MODERATIONS = of("/v1/moderations")
+ @JvmField val V1_IMAGES_GENERATIONS = of("/v1/images/generations")
+
+ @JvmField val V1_IMAGES_EDITS = of("/v1/images/edits")
+
@JvmStatic fun of(value: String) = Endpoint(JsonField.of(value))
}
@@ -981,6 +990,8 @@ private constructor(
V1_EMBEDDINGS,
V1_COMPLETIONS,
V1_MODERATIONS,
+ V1_IMAGES_GENERATIONS,
+ V1_IMAGES_EDITS,
}
/**
@@ -998,6 +1009,8 @@ private constructor(
V1_EMBEDDINGS,
V1_COMPLETIONS,
V1_MODERATIONS,
+ V1_IMAGES_GENERATIONS,
+ V1_IMAGES_EDITS,
/** An enum member indicating that [Endpoint] was instantiated with an unknown value. */
_UNKNOWN,
}
@@ -1016,6 +1029,8 @@ private constructor(
V1_EMBEDDINGS -> Value.V1_EMBEDDINGS
V1_COMPLETIONS -> Value.V1_COMPLETIONS
V1_MODERATIONS -> Value.V1_MODERATIONS
+ V1_IMAGES_GENERATIONS -> Value.V1_IMAGES_GENERATIONS
+ V1_IMAGES_EDITS -> Value.V1_IMAGES_EDITS
else -> Value._UNKNOWN
}
@@ -1035,6 +1050,8 @@ private constructor(
V1_EMBEDDINGS -> Known.V1_EMBEDDINGS
V1_COMPLETIONS -> Known.V1_COMPLETIONS
V1_MODERATIONS -> Known.V1_MODERATIONS
+ V1_IMAGES_GENERATIONS -> Known.V1_IMAGES_GENERATIONS
+ V1_IMAGES_EDITS -> Known.V1_IMAGES_EDITS
else -> throw OpenAIInvalidDataException("Unknown Endpoint: $value")
}
diff --git a/openai-java-core/src/main/kotlin/com/openai/models/images/ImageEditParams.kt b/openai-java-core/src/main/kotlin/com/openai/models/images/ImageEditParams.kt
index e836c56b..c4b54c3a 100644
--- a/openai-java-core/src/main/kotlin/com/openai/models/images/ImageEditParams.kt
+++ b/openai-java-core/src/main/kotlin/com/openai/models/images/ImageEditParams.kt
@@ -33,8 +33,8 @@ import kotlin.jvm.optionals.getOrNull
/**
* Creates an edited or extended image given one or more source images and a prompt. This endpoint
- * supports GPT Image models (`gpt-image-1.5`, `gpt-image-1`, and `gpt-image-1-mini`) and
- * `dall-e-2`.
+ * supports GPT Image models (`gpt-image-1.5`, `gpt-image-1`, `gpt-image-1-mini`, and
+ * `chatgpt-image-latest`) and `dall-e-2`.
*/
class ImageEditParams
private constructor(
@@ -48,6 +48,7 @@ private constructor(
*
* For the GPT image models (`gpt-image-1`, `gpt-image-1-mini`, and `gpt-image-1.5`), each image
* should be a `png`, `webp`, or `jpg` file less than 50MB. You can provide up to 16 images.
+ * `chatgpt-image-latest` follows the same input constraints as GPT image models.
*
* For `dall-e-2`, you can only provide one image, and it should be a square `png` file less
* than 4MB.
@@ -103,9 +104,7 @@ private constructor(
fun mask(): Optional = body.mask()
/**
- * The model to use for image generation. Only `dall-e-2` and the GPT image models are
- * supported. Defaults to `dall-e-2` unless a parameter specific to the GPT image models is
- * used.
+ * The model to use for image generation. Defaults to `gpt-image-1.5`.
*
* @throws OpenAIInvalidDataException if the JSON field has an unexpected type (e.g. if the
* server responded with an unexpected value).
@@ -152,9 +151,7 @@ private constructor(
fun partialImages(): Optional = body.partialImages()
/**
- * The quality of the image that will be generated. `high`, `medium` and `low` are only
- * supported for the GPT image models. `dall-e-2` only supports `standard` quality. Defaults to
- * `auto`.
+ * The quality of the image that will be generated for GPT image models. Defaults to `auto`.
*
* @throws OpenAIInvalidDataException if the JSON field has an unexpected type (e.g. if the
* server responded with an unexpected value).
@@ -164,7 +161,8 @@ private constructor(
/**
* The format in which the generated images are returned. Must be one of `url` or `b64_json`.
* URLs are only valid for 60 minutes after the image has been generated. This parameter is only
- * supported for `dall-e-2`, as the GPT image models always return base64-encoded images.
+ * supported for `dall-e-2` (default is `url` for `dall-e-2`), as GPT image models always return
+ * base64-encoded images.
*
* @throws OpenAIInvalidDataException if the JSON field has an unexpected type (e.g. if the
* server responded with an unexpected value).
@@ -351,7 +349,7 @@ private constructor(
*
* For the GPT image models (`gpt-image-1`, `gpt-image-1-mini`, and `gpt-image-1.5`), each
* image should be a `png`, `webp`, or `jpg` file less than 50MB. You can provide up to 16
- * images.
+ * images. `chatgpt-image-latest` follows the same input constraints as GPT image models.
*
* For `dall-e-2`, you can only provide one image, and it should be a square `png` file less
* than 4MB.
@@ -374,7 +372,7 @@ private constructor(
*
* For the GPT image models (`gpt-image-1`, `gpt-image-1-mini`, and `gpt-image-1.5`), each
* image should be a `png`, `webp`, or `jpg` file less than 50MB. You can provide up to 16
- * images.
+ * images. `chatgpt-image-latest` follows the same input constraints as GPT image models.
*
* For `dall-e-2`, you can only provide one image, and it should be a square `png` file less
* than 4MB.
@@ -386,7 +384,7 @@ private constructor(
*
* For the GPT image models (`gpt-image-1`, `gpt-image-1-mini`, and `gpt-image-1.5`), each
* image should be a `png`, `webp`, or `jpg` file less than 50MB. You can provide up to 16
- * images.
+ * images. `chatgpt-image-latest` follows the same input constraints as GPT image models.
*
* For `dall-e-2`, you can only provide one image, and it should be a square `png` file less
* than 4MB.
@@ -495,11 +493,7 @@ private constructor(
*/
fun mask(path: Path) = apply { body.mask(path) }
- /**
- * The model to use for image generation. Only `dall-e-2` and the GPT image models are
- * supported. Defaults to `dall-e-2` unless a parameter specific to the GPT image models is
- * used.
- */
+ /** The model to use for image generation. Defaults to `gpt-image-1.5`. */
fun model(model: ImageModel?) = apply { body.model(model) }
/** Alias for calling [Builder.model] with `model.orElse(null)`. */
@@ -628,9 +622,7 @@ private constructor(
}
/**
- * The quality of the image that will be generated. `high`, `medium` and `low` are only
- * supported for the GPT image models. `dall-e-2` only supports `standard` quality. Defaults
- * to `auto`.
+ * The quality of the image that will be generated for GPT image models. Defaults to `auto`.
*/
fun quality(quality: Quality?) = apply { body.quality(quality) }
@@ -648,8 +640,8 @@ private constructor(
/**
* The format in which the generated images are returned. Must be one of `url` or
* `b64_json`. URLs are only valid for 60 minutes after the image has been generated. This
- * parameter is only supported for `dall-e-2`, as the GPT image models always return
- * base64-encoded images.
+ * parameter is only supported for `dall-e-2` (default is `url` for `dall-e-2`), as GPT
+ * image models always return base64-encoded images.
*/
fun responseFormat(responseFormat: ResponseFormat?) = apply {
body.responseFormat(responseFormat)
@@ -884,7 +876,7 @@ private constructor(
*
* For the GPT image models (`gpt-image-1`, `gpt-image-1-mini`, and `gpt-image-1.5`), each
* image should be a `png`, `webp`, or `jpg` file less than 50MB. You can provide up to 16
- * images.
+ * images. `chatgpt-image-latest` follows the same input constraints as GPT image models.
*
* For `dall-e-2`, you can only provide one image, and it should be a square `png` file less
* than 4MB.
@@ -941,9 +933,7 @@ private constructor(
fun mask(): Optional = mask.value.getOptional("mask")
/**
- * The model to use for image generation. Only `dall-e-2` and the GPT image models are
- * supported. Defaults to `dall-e-2` unless a parameter specific to the GPT image models is
- * used.
+ * The model to use for image generation. Defaults to `gpt-image-1.5`.
*
* @throws OpenAIInvalidDataException if the JSON field has an unexpected type (e.g. if the
* server responded with an unexpected value).
@@ -992,9 +982,7 @@ private constructor(
fun partialImages(): Optional = partialImages.value.getOptional("partial_images")
/**
- * The quality of the image that will be generated. `high`, `medium` and `low` are only
- * supported for the GPT image models. `dall-e-2` only supports `standard` quality. Defaults
- * to `auto`.
+ * The quality of the image that will be generated for GPT image models. Defaults to `auto`.
*
* @throws OpenAIInvalidDataException if the JSON field has an unexpected type (e.g. if the
* server responded with an unexpected value).
@@ -1004,8 +992,8 @@ private constructor(
/**
* The format in which the generated images are returned. Must be one of `url` or
* `b64_json`. URLs are only valid for 60 minutes after the image has been generated. This
- * parameter is only supported for `dall-e-2`, as the GPT image models always return
- * base64-encoded images.
+ * parameter is only supported for `dall-e-2` (default is `url` for `dall-e-2`), as GPT
+ * image models always return base64-encoded images.
*
* @throws OpenAIInvalidDataException if the JSON field has an unexpected type (e.g. if the
* server responded with an unexpected value).
@@ -1219,7 +1207,8 @@ private constructor(
*
* For the GPT image models (`gpt-image-1`, `gpt-image-1-mini`, and `gpt-image-1.5`),
* each image should be a `png`, `webp`, or `jpg` file less than 50MB. You can provide
- * up to 16 images.
+ * up to 16 images. `chatgpt-image-latest` follows the same input constraints as GPT
+ * image models.
*
* For `dall-e-2`, you can only provide one image, and it should be a square `png` file
* less than 4MB.
@@ -1249,7 +1238,8 @@ private constructor(
*
* For the GPT image models (`gpt-image-1`, `gpt-image-1-mini`, and `gpt-image-1.5`),
* each image should be a `png`, `webp`, or `jpg` file less than 50MB. You can provide
- * up to 16 images.
+ * up to 16 images. `chatgpt-image-latest` follows the same input constraints as GPT
+ * image models.
*
* For `dall-e-2`, you can only provide one image, and it should be a square `png` file
* less than 4MB.
@@ -1261,7 +1251,8 @@ private constructor(
*
* For the GPT image models (`gpt-image-1`, `gpt-image-1-mini`, and `gpt-image-1.5`),
* each image should be a `png`, `webp`, or `jpg` file less than 50MB. You can provide
- * up to 16 images.
+ * up to 16 images. `chatgpt-image-latest` follows the same input constraints as GPT
+ * image models.
*
* For `dall-e-2`, you can only provide one image, and it should be a square `png` file
* less than 4MB.
@@ -1382,11 +1373,7 @@ private constructor(
.build()
)
- /**
- * The model to use for image generation. Only `dall-e-2` and the GPT image models are
- * supported. Defaults to `dall-e-2` unless a parameter specific to the GPT image models
- * is used.
- */
+ /** The model to use for image generation. Defaults to `gpt-image-1.5`. */
fun model(model: ImageModel?) = model(MultipartField.of(model))
/** Alias for calling [Builder.model] with `model.orElse(null)`. */
@@ -1522,9 +1509,8 @@ private constructor(
}
/**
- * The quality of the image that will be generated. `high`, `medium` and `low` are only
- * supported for the GPT image models. `dall-e-2` only supports `standard` quality.
- * Defaults to `auto`.
+ * The quality of the image that will be generated for GPT image models. Defaults to
+ * `auto`.
*/
fun quality(quality: Quality?) = quality(MultipartField.of(quality))
@@ -1543,8 +1529,8 @@ private constructor(
/**
* The format in which the generated images are returned. Must be one of `url` or
* `b64_json`. URLs are only valid for 60 minutes after the image has been generated.
- * This parameter is only supported for `dall-e-2`, as the GPT image models always
- * return base64-encoded images.
+ * This parameter is only supported for `dall-e-2` (default is `url` for `dall-e-2`), as
+ * GPT image models always return base64-encoded images.
*/
fun responseFormat(responseFormat: ResponseFormat?) =
responseFormat(MultipartField.of(responseFormat))
@@ -1737,6 +1723,7 @@ private constructor(
*
* For the GPT image models (`gpt-image-1`, `gpt-image-1-mini`, and `gpt-image-1.5`), each image
* should be a `png`, `webp`, or `jpg` file less than 50MB. You can provide up to 16 images.
+ * `chatgpt-image-latest` follows the same input constraints as GPT image models.
*
* For `dall-e-2`, you can only provide one image, and it should be a square `png` file less
* than 4MB.
@@ -2279,11 +2266,7 @@ private constructor(
override fun toString() = value.toString()
}
- /**
- * The quality of the image that will be generated. `high`, `medium` and `low` are only
- * supported for the GPT image models. `dall-e-2` only supports `standard` quality. Defaults to
- * `auto`.
- */
+ /** The quality of the image that will be generated for GPT image models. Defaults to `auto`. */
class Quality @JsonCreator private constructor(private val value: JsonField) : Enum {
/**
@@ -2430,7 +2413,8 @@ private constructor(
/**
* The format in which the generated images are returned. Must be one of `url` or `b64_json`.
* URLs are only valid for 60 minutes after the image has been generated. This parameter is only
- * supported for `dall-e-2`, as the GPT image models always return base64-encoded images.
+ * supported for `dall-e-2` (default is `url` for `dall-e-2`), as GPT image models always return
+ * base64-encoded images.
*/
class ResponseFormat @JsonCreator private constructor(private val value: JsonField) :
Enum {
diff --git a/openai-java-core/src/main/kotlin/com/openai/models/responses/ContainerAuto.kt b/openai-java-core/src/main/kotlin/com/openai/models/responses/ContainerAuto.kt
new file mode 100644
index 00000000..4810d0b1
--- /dev/null
+++ b/openai-java-core/src/main/kotlin/com/openai/models/responses/ContainerAuto.kt
@@ -0,0 +1,892 @@
+// 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.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
+
+class ContainerAuto
+@JsonCreator(mode = JsonCreator.Mode.DISABLED)
+private constructor(
+ private val type: JsonValue,
+ private val fileIds: JsonField>,
+ private val memoryLimit: JsonField,
+ private val networkPolicy: JsonField,
+ private val skills: JsonField>,
+ private val additionalProperties: MutableMap,
+) {
+
+ @JsonCreator
+ private constructor(
+ @JsonProperty("type") @ExcludeMissing type: JsonValue = JsonMissing.of(),
+ @JsonProperty("file_ids")
+ @ExcludeMissing
+ fileIds: JsonField> = JsonMissing.of(),
+ @JsonProperty("memory_limit")
+ @ExcludeMissing
+ memoryLimit: JsonField = JsonMissing.of(),
+ @JsonProperty("network_policy")
+ @ExcludeMissing
+ networkPolicy: JsonField = JsonMissing.of(),
+ @JsonProperty("skills") @ExcludeMissing skills: JsonField> = JsonMissing.of(),
+ ) : this(type, fileIds, memoryLimit, networkPolicy, skills, mutableMapOf())
+
+ /**
+ * Automatically creates a container for this request
+ *
+ * Expected to always return the following:
+ * ```java
+ * JsonValue.from("container_auto")
+ * ```
+ *
+ * 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
+
+ /**
+ * An optional list of uploaded files to make available to your code.
+ *
+ * @throws OpenAIInvalidDataException if the JSON field has an unexpected type (e.g. if the
+ * server responded with an unexpected value).
+ */
+ fun fileIds(): Optional> = fileIds.getOptional("file_ids")
+
+ /**
+ * The memory limit for the container.
+ *
+ * @throws OpenAIInvalidDataException if the JSON field has an unexpected type (e.g. if the
+ * server responded with an unexpected value).
+ */
+ fun memoryLimit(): Optional = memoryLimit.getOptional("memory_limit")
+
+ /**
+ * Network access policy for the container.
+ *
+ * @throws OpenAIInvalidDataException if the JSON field has an unexpected type (e.g. if the
+ * server responded with an unexpected value).
+ */
+ fun networkPolicy(): Optional = networkPolicy.getOptional("network_policy")
+
+ /**
+ * An optional list of skills referenced by id or inline data.
+ *
+ * @throws OpenAIInvalidDataException if the JSON field has an unexpected type (e.g. if the
+ * server responded with an unexpected value).
+ */
+ fun skills(): Optional> = skills.getOptional("skills")
+
+ /**
+ * Returns the raw JSON value of [fileIds].
+ *
+ * Unlike [fileIds], this method doesn't throw if the JSON field has an unexpected type.
+ */
+ @JsonProperty("file_ids") @ExcludeMissing fun _fileIds(): JsonField> = fileIds
+
+ /**
+ * Returns the raw JSON value of [memoryLimit].
+ *
+ * Unlike [memoryLimit], this method doesn't throw if the JSON field has an unexpected type.
+ */
+ @JsonProperty("memory_limit")
+ @ExcludeMissing
+ fun _memoryLimit(): JsonField = memoryLimit
+
+ /**
+ * Returns the raw JSON value of [networkPolicy].
+ *
+ * Unlike [networkPolicy], this method doesn't throw if the JSON field has an unexpected type.
+ */
+ @JsonProperty("network_policy")
+ @ExcludeMissing
+ fun _networkPolicy(): JsonField = networkPolicy
+
+ /**
+ * Returns the raw JSON value of [skills].
+ *
+ * Unlike [skills], this method doesn't throw if the JSON field has an unexpected type.
+ */
+ @JsonProperty("skills") @ExcludeMissing fun _skills(): JsonField> = skills
+
+ @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 [ContainerAuto]. */
+ @JvmStatic fun builder() = Builder()
+ }
+
+ /** A builder for [ContainerAuto]. */
+ class Builder internal constructor() {
+
+ private var type: JsonValue = JsonValue.from("container_auto")
+ private var fileIds: JsonField>? = null
+ private var memoryLimit: JsonField = JsonMissing.of()
+ private var networkPolicy: JsonField = JsonMissing.of()
+ private var skills: JsonField>? = null
+ private var additionalProperties: MutableMap = mutableMapOf()
+
+ @JvmSynthetic
+ internal fun from(containerAuto: ContainerAuto) = apply {
+ type = containerAuto.type
+ fileIds = containerAuto.fileIds.map { it.toMutableList() }
+ memoryLimit = containerAuto.memoryLimit
+ networkPolicy = containerAuto.networkPolicy
+ skills = containerAuto.skills.map { it.toMutableList() }
+ additionalProperties = containerAuto.additionalProperties.toMutableMap()
+ }
+
+ /**
+ * 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("container_auto")
+ * ```
+ *
+ * This method is primarily for setting the field to an undocumented or not yet supported
+ * value.
+ */
+ fun type(type: JsonValue) = apply { this.type = type }
+
+ /** An optional list of uploaded files to make available to your code. */
+ fun fileIds(fileIds: List) = fileIds(JsonField.of(fileIds))
+
+ /**
+ * Sets [Builder.fileIds] to an arbitrary JSON value.
+ *
+ * You should usually call [Builder.fileIds] with a well-typed `List` value instead.
+ * This method is primarily for setting the field to an undocumented or not yet supported
+ * value.
+ */
+ fun fileIds(fileIds: JsonField>) = apply {
+ this.fileIds = fileIds.map { it.toMutableList() }
+ }
+
+ /**
+ * Adds a single [String] to [fileIds].
+ *
+ * @throws IllegalStateException if the field was previously set to a non-list.
+ */
+ fun addFileId(fileId: String) = apply {
+ fileIds =
+ (fileIds ?: JsonField.of(mutableListOf())).also {
+ checkKnown("fileIds", it).add(fileId)
+ }
+ }
+
+ /** The memory limit for the container. */
+ fun memoryLimit(memoryLimit: MemoryLimit?) = memoryLimit(JsonField.ofNullable(memoryLimit))
+
+ /** Alias for calling [Builder.memoryLimit] with `memoryLimit.orElse(null)`. */
+ fun memoryLimit(memoryLimit: Optional) = memoryLimit(memoryLimit.getOrNull())
+
+ /**
+ * Sets [Builder.memoryLimit] to an arbitrary JSON value.
+ *
+ * You should usually call [Builder.memoryLimit] with a well-typed [MemoryLimit] value
+ * instead. This method is primarily for setting the field to an undocumented or not yet
+ * supported value.
+ */
+ fun memoryLimit(memoryLimit: JsonField) = apply {
+ this.memoryLimit = memoryLimit
+ }
+
+ /** Network access policy for the container. */
+ fun networkPolicy(networkPolicy: NetworkPolicy) = networkPolicy(JsonField.of(networkPolicy))
+
+ /**
+ * Sets [Builder.networkPolicy] to an arbitrary JSON value.
+ *
+ * You should usually call [Builder.networkPolicy] with a well-typed [NetworkPolicy] value
+ * instead. This method is primarily for setting the field to an undocumented or not yet
+ * supported value.
+ */
+ fun networkPolicy(networkPolicy: JsonField) = apply {
+ this.networkPolicy = networkPolicy
+ }
+
+ /** Alias for calling [networkPolicy] with `NetworkPolicy.ofDisabled(disabled)`. */
+ fun networkPolicy(disabled: ContainerNetworkPolicyDisabled) =
+ networkPolicy(NetworkPolicy.ofDisabled(disabled))
+
+ /** Alias for calling [networkPolicy] with `NetworkPolicy.ofAllowlist(allowlist)`. */
+ fun networkPolicy(allowlist: ContainerNetworkPolicyAllowlist) =
+ networkPolicy(NetworkPolicy.ofAllowlist(allowlist))
+
+ /**
+ * Alias for calling [networkPolicy] with the following:
+ * ```java
+ * ContainerNetworkPolicyAllowlist.builder()
+ * .allowedDomains(allowedDomains)
+ * .build()
+ * ```
+ */
+ fun allowlistNetworkPolicy(allowedDomains: List) =
+ networkPolicy(
+ ContainerNetworkPolicyAllowlist.builder().allowedDomains(allowedDomains).build()
+ )
+
+ /** An optional list of skills referenced by id or inline data. */
+ fun skills(skills: List) = skills(JsonField.of(skills))
+
+ /**
+ * Sets [Builder.skills] to an arbitrary JSON value.
+ *
+ * You should usually call [Builder.skills] with a well-typed `List` value instead.
+ * This method is primarily for setting the field to an undocumented or not yet supported
+ * value.
+ */
+ fun skills(skills: JsonField>) = apply {
+ this.skills = skills.map { it.toMutableList() }
+ }
+
+ /**
+ * Adds a single [Skill] to [skills].
+ *
+ * @throws IllegalStateException if the field was previously set to a non-list.
+ */
+ fun addSkill(skill: Skill) = apply {
+ skills =
+ (skills ?: JsonField.of(mutableListOf())).also {
+ checkKnown("skills", it).add(skill)
+ }
+ }
+
+ /** Alias for calling [addSkill] with `Skill.ofReference(reference)`. */
+ fun addSkill(reference: SkillReference) = addSkill(Skill.ofReference(reference))
+
+ /**
+ * Alias for calling [addSkill] with the following:
+ * ```java
+ * SkillReference.builder()
+ * .skillId(skillId)
+ * .build()
+ * ```
+ */
+ fun addReferenceSkill(skillId: String) =
+ addSkill(SkillReference.builder().skillId(skillId).build())
+
+ /** Alias for calling [addSkill] with `Skill.ofInline(inline)`. */
+ fun addSkill(inline: InlineSkill) = addSkill(Skill.ofInline(inline))
+
+ 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 [ContainerAuto].
+ *
+ * Further updates to this [Builder] will not mutate the returned instance.
+ */
+ fun build(): ContainerAuto =
+ ContainerAuto(
+ type,
+ (fileIds ?: JsonMissing.of()).map { it.toImmutable() },
+ memoryLimit,
+ networkPolicy,
+ (skills ?: JsonMissing.of()).map { it.toImmutable() },
+ additionalProperties.toMutableMap(),
+ )
+ }
+
+ private var validated: Boolean = false
+
+ fun validate(): ContainerAuto = apply {
+ if (validated) {
+ return@apply
+ }
+
+ _type().let {
+ if (it != JsonValue.from("container_auto")) {
+ throw OpenAIInvalidDataException("'type' is invalid, received $it")
+ }
+ }
+ fileIds()
+ memoryLimit().ifPresent { it.validate() }
+ networkPolicy().ifPresent { it.validate() }
+ skills().ifPresent { it.forEach { it.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 =
+ type.let { if (it == JsonValue.from("container_auto")) 1 else 0 } +
+ (fileIds.asKnown().getOrNull()?.size ?: 0) +
+ (memoryLimit.asKnown().getOrNull()?.validity() ?: 0) +
+ (networkPolicy.asKnown().getOrNull()?.validity() ?: 0) +
+ (skills.asKnown().getOrNull()?.sumOf { it.validity().toInt() } ?: 0)
+
+ /** The memory limit for the container. */
+ class MemoryLimit @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 _1G = of("1g")
+
+ @JvmField val _4G = of("4g")
+
+ @JvmField val _16G = of("16g")
+
+ @JvmField val _64G = of("64g")
+
+ @JvmStatic fun of(value: String) = MemoryLimit(JsonField.of(value))
+ }
+
+ /** An enum containing [MemoryLimit]'s known values. */
+ enum class Known {
+ _1G,
+ _4G,
+ _16G,
+ _64G,
+ }
+
+ /**
+ * An enum containing [MemoryLimit]'s known values, as well as an [_UNKNOWN] member.
+ *
+ * An instance of [MemoryLimit] 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 {
+ _1G,
+ _4G,
+ _16G,
+ _64G,
+ /**
+ * An enum member indicating that [MemoryLimit] 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) {
+ _1G -> Value._1G
+ _4G -> Value._4G
+ _16G -> Value._16G
+ _64G -> Value._64G
+ 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) {
+ _1G -> Known._1G
+ _4G -> Known._4G
+ _16G -> Known._16G
+ _64G -> Known._64G
+ else -> throw OpenAIInvalidDataException("Unknown MemoryLimit: $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(): MemoryLimit = 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 MemoryLimit && value == other.value
+ }
+
+ override fun hashCode() = value.hashCode()
+
+ override fun toString() = value.toString()
+ }
+
+ /** Network access policy for the container. */
+ @JsonDeserialize(using = NetworkPolicy.Deserializer::class)
+ @JsonSerialize(using = NetworkPolicy.Serializer::class)
+ class NetworkPolicy
+ private constructor(
+ private val disabled: ContainerNetworkPolicyDisabled? = null,
+ private val allowlist: ContainerNetworkPolicyAllowlist? = null,
+ private val _json: JsonValue? = null,
+ ) {
+
+ fun disabled(): Optional = Optional.ofNullable(disabled)
+
+ fun allowlist(): Optional = Optional.ofNullable(allowlist)
+
+ fun isDisabled(): Boolean = disabled != null
+
+ fun isAllowlist(): Boolean = allowlist != null
+
+ fun asDisabled(): ContainerNetworkPolicyDisabled = disabled.getOrThrow("disabled")
+
+ fun asAllowlist(): ContainerNetworkPolicyAllowlist = allowlist.getOrThrow("allowlist")
+
+ fun _json(): Optional = Optional.ofNullable(_json)
+
+ fun accept(visitor: Visitor): T =
+ when {
+ disabled != null -> visitor.visitDisabled(disabled)
+ allowlist != null -> visitor.visitAllowlist(allowlist)
+ else -> visitor.unknown(_json)
+ }
+
+ private var validated: Boolean = false
+
+ fun validate(): NetworkPolicy = apply {
+ if (validated) {
+ return@apply
+ }
+
+ accept(
+ object : Visitor {
+ override fun visitDisabled(disabled: ContainerNetworkPolicyDisabled) {
+ disabled.validate()
+ }
+
+ override fun visitAllowlist(allowlist: ContainerNetworkPolicyAllowlist) {
+ allowlist.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 visitDisabled(disabled: ContainerNetworkPolicyDisabled) =
+ disabled.validity()
+
+ override fun visitAllowlist(allowlist: ContainerNetworkPolicyAllowlist) =
+ allowlist.validity()
+
+ override fun unknown(json: JsonValue?) = 0
+ }
+ )
+
+ override fun equals(other: Any?): Boolean {
+ if (this === other) {
+ return true
+ }
+
+ return other is NetworkPolicy &&
+ disabled == other.disabled &&
+ allowlist == other.allowlist
+ }
+
+ override fun hashCode(): Int = Objects.hash(disabled, allowlist)
+
+ override fun toString(): String =
+ when {
+ disabled != null -> "NetworkPolicy{disabled=$disabled}"
+ allowlist != null -> "NetworkPolicy{allowlist=$allowlist}"
+ _json != null -> "NetworkPolicy{_unknown=$_json}"
+ else -> throw IllegalStateException("Invalid NetworkPolicy")
+ }
+
+ companion object {
+
+ @JvmStatic
+ fun ofDisabled(disabled: ContainerNetworkPolicyDisabled) =
+ NetworkPolicy(disabled = disabled)
+
+ @JvmStatic
+ fun ofAllowlist(allowlist: ContainerNetworkPolicyAllowlist) =
+ NetworkPolicy(allowlist = allowlist)
+ }
+
+ /**
+ * An interface that defines how to map each variant of [NetworkPolicy] to a value of type
+ * [T].
+ */
+ interface Visitor {
+
+ fun visitDisabled(disabled: ContainerNetworkPolicyDisabled): T
+
+ fun visitAllowlist(allowlist: ContainerNetworkPolicyAllowlist): T
+
+ /**
+ * Maps an unknown variant of [NetworkPolicy] to a value of type [T].
+ *
+ * An instance of [NetworkPolicy] 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 NetworkPolicy: $json")
+ }
+ }
+
+ internal class Deserializer : BaseDeserializer(NetworkPolicy::class) {
+
+ override fun ObjectCodec.deserialize(node: JsonNode): NetworkPolicy {
+ val json = JsonValue.fromJsonNode(node)
+ val type = json.asObject().getOrNull()?.get("type")?.asString()?.getOrNull()
+
+ when (type) {
+ "disabled" -> {
+ return tryDeserialize(
+ node,
+ jacksonTypeRef(),
+ )
+ ?.let { NetworkPolicy(disabled = it, _json = json) }
+ ?: NetworkPolicy(_json = json)
+ }
+ "allowlist" -> {
+ return tryDeserialize(
+ node,
+ jacksonTypeRef(),
+ )
+ ?.let { NetworkPolicy(allowlist = it, _json = json) }
+ ?: NetworkPolicy(_json = json)
+ }
+ }
+
+ return NetworkPolicy(_json = json)
+ }
+ }
+
+ internal class Serializer : BaseSerializer(NetworkPolicy::class) {
+
+ override fun serialize(
+ value: NetworkPolicy,
+ generator: JsonGenerator,
+ provider: SerializerProvider,
+ ) {
+ when {
+ value.disabled != null -> generator.writeObject(value.disabled)
+ value.allowlist != null -> generator.writeObject(value.allowlist)
+ value._json != null -> generator.writeObject(value._json)
+ else -> throw IllegalStateException("Invalid NetworkPolicy")
+ }
+ }
+ }
+ }
+
+ @JsonDeserialize(using = Skill.Deserializer::class)
+ @JsonSerialize(using = Skill.Serializer::class)
+ class Skill
+ private constructor(
+ private val reference: SkillReference? = null,
+ private val inline: InlineSkill? = null,
+ private val _json: JsonValue? = null,
+ ) {
+
+ fun reference(): Optional = Optional.ofNullable(reference)
+
+ fun inline(): Optional = Optional.ofNullable(inline)
+
+ fun isReference(): Boolean = reference != null
+
+ fun isInline(): Boolean = inline != null
+
+ fun asReference(): SkillReference = reference.getOrThrow("reference")
+
+ fun asInline(): InlineSkill = inline.getOrThrow("inline")
+
+ fun _json(): Optional = Optional.ofNullable(_json)
+
+ fun accept(visitor: Visitor): T =
+ when {
+ reference != null -> visitor.visitReference(reference)
+ inline != null -> visitor.visitInline(inline)
+ else -> visitor.unknown(_json)
+ }
+
+ private var validated: Boolean = false
+
+ fun validate(): Skill = apply {
+ if (validated) {
+ return@apply
+ }
+
+ accept(
+ object : Visitor {
+ override fun visitReference(reference: SkillReference) {
+ reference.validate()
+ }
+
+ override fun visitInline(inline: InlineSkill) {
+ inline.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 visitReference(reference: SkillReference) = reference.validity()
+
+ override fun visitInline(inline: InlineSkill) = inline.validity()
+
+ override fun unknown(json: JsonValue?) = 0
+ }
+ )
+
+ override fun equals(other: Any?): Boolean {
+ if (this === other) {
+ return true
+ }
+
+ return other is Skill && reference == other.reference && inline == other.inline
+ }
+
+ override fun hashCode(): Int = Objects.hash(reference, inline)
+
+ override fun toString(): String =
+ when {
+ reference != null -> "Skill{reference=$reference}"
+ inline != null -> "Skill{inline=$inline}"
+ _json != null -> "Skill{_unknown=$_json}"
+ else -> throw IllegalStateException("Invalid Skill")
+ }
+
+ companion object {
+
+ @JvmStatic fun ofReference(reference: SkillReference) = Skill(reference = reference)
+
+ @JvmStatic fun ofInline(inline: InlineSkill) = Skill(inline = inline)
+ }
+
+ /** An interface that defines how to map each variant of [Skill] to a value of type [T]. */
+ interface Visitor {
+
+ fun visitReference(reference: SkillReference): T
+
+ fun visitInline(inline: InlineSkill): T
+
+ /**
+ * Maps an unknown variant of [Skill] to a value of type [T].
+ *
+ * An instance of [Skill] 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 Skill: $json")
+ }
+ }
+
+ internal class Deserializer : BaseDeserializer(Skill::class) {
+
+ override fun ObjectCodec.deserialize(node: JsonNode): Skill {
+ val json = JsonValue.fromJsonNode(node)
+ val type = json.asObject().getOrNull()?.get("type")?.asString()?.getOrNull()
+
+ when (type) {
+ "skill_reference" -> {
+ return tryDeserialize(node, jacksonTypeRef())?.let {
+ Skill(reference = it, _json = json)
+ } ?: Skill(_json = json)
+ }
+ "inline" -> {
+ return tryDeserialize(node, jacksonTypeRef())?.let {
+ Skill(inline = it, _json = json)
+ } ?: Skill(_json = json)
+ }
+ }
+
+ return Skill(_json = json)
+ }
+ }
+
+ internal class Serializer : BaseSerializer(Skill::class) {
+
+ override fun serialize(
+ value: Skill,
+ generator: JsonGenerator,
+ provider: SerializerProvider,
+ ) {
+ when {
+ value.reference != null -> generator.writeObject(value.reference)
+ value.inline != null -> generator.writeObject(value.inline)
+ value._json != null -> generator.writeObject(value._json)
+ else -> throw IllegalStateException("Invalid Skill")
+ }
+ }
+ }
+ }
+
+ override fun equals(other: Any?): Boolean {
+ if (this === other) {
+ return true
+ }
+
+ return other is ContainerAuto &&
+ type == other.type &&
+ fileIds == other.fileIds &&
+ memoryLimit == other.memoryLimit &&
+ networkPolicy == other.networkPolicy &&
+ skills == other.skills &&
+ additionalProperties == other.additionalProperties
+ }
+
+ private val hashCode: Int by lazy {
+ Objects.hash(type, fileIds, memoryLimit, networkPolicy, skills, additionalProperties)
+ }
+
+ override fun hashCode(): Int = hashCode
+
+ override fun toString() =
+ "ContainerAuto{type=$type, fileIds=$fileIds, memoryLimit=$memoryLimit, networkPolicy=$networkPolicy, skills=$skills, additionalProperties=$additionalProperties}"
+}
diff --git a/openai-java-core/src/main/kotlin/com/openai/models/responses/ContainerNetworkPolicyAllowlist.kt b/openai-java-core/src/main/kotlin/com/openai/models/responses/ContainerNetworkPolicyAllowlist.kt
new file mode 100644
index 00000000..da688261
--- /dev/null
+++ b/openai-java-core/src/main/kotlin/com/openai/models/responses/ContainerNetworkPolicyAllowlist.kt
@@ -0,0 +1,302 @@
+// 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.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.toImmutable
+import com.openai.errors.OpenAIInvalidDataException
+import java.util.Collections
+import java.util.Objects
+import java.util.Optional
+import kotlin.jvm.optionals.getOrNull
+
+class ContainerNetworkPolicyAllowlist
+@JsonCreator(mode = JsonCreator.Mode.DISABLED)
+private constructor(
+ private val allowedDomains: JsonField>,
+ private val type: JsonValue,
+ private val domainSecrets: JsonField>,
+ private val additionalProperties: MutableMap,
+) {
+
+ @JsonCreator
+ private constructor(
+ @JsonProperty("allowed_domains")
+ @ExcludeMissing
+ allowedDomains: JsonField> = JsonMissing.of(),
+ @JsonProperty("type") @ExcludeMissing type: JsonValue = JsonMissing.of(),
+ @JsonProperty("domain_secrets")
+ @ExcludeMissing
+ domainSecrets: JsonField> = JsonMissing.of(),
+ ) : this(allowedDomains, type, domainSecrets, mutableMapOf())
+
+ /**
+ * A list of allowed domains when type is `allowlist`.
+ *
+ * @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 allowedDomains(): List = allowedDomains.getRequired("allowed_domains")
+
+ /**
+ * Allow outbound network access only to specified domains. Always `allowlist`.
+ *
+ * Expected to always return the following:
+ * ```java
+ * JsonValue.from("allowlist")
+ * ```
+ *
+ * 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
+
+ /**
+ * Optional domain-scoped secrets for allowlisted domains.
+ *
+ * @throws OpenAIInvalidDataException if the JSON field has an unexpected type (e.g. if the
+ * server responded with an unexpected value).
+ */
+ fun domainSecrets(): Optional> =
+ domainSecrets.getOptional("domain_secrets")
+
+ /**
+ * Returns the raw JSON value of [allowedDomains].
+ *
+ * Unlike [allowedDomains], this method doesn't throw if the JSON field has an unexpected type.
+ */
+ @JsonProperty("allowed_domains")
+ @ExcludeMissing
+ fun _allowedDomains(): JsonField> = allowedDomains
+
+ /**
+ * Returns the raw JSON value of [domainSecrets].
+ *
+ * Unlike [domainSecrets], this method doesn't throw if the JSON field has an unexpected type.
+ */
+ @JsonProperty("domain_secrets")
+ @ExcludeMissing
+ fun _domainSecrets(): JsonField> = domainSecrets
+
+ @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
+ * [ContainerNetworkPolicyAllowlist].
+ *
+ * The following fields are required:
+ * ```java
+ * .allowedDomains()
+ * ```
+ */
+ @JvmStatic fun builder() = Builder()
+ }
+
+ /** A builder for [ContainerNetworkPolicyAllowlist]. */
+ class Builder internal constructor() {
+
+ private var allowedDomains: JsonField>? = null
+ private var type: JsonValue = JsonValue.from("allowlist")
+ private var domainSecrets: JsonField>? =
+ null
+ private var additionalProperties: MutableMap = mutableMapOf()
+
+ @JvmSynthetic
+ internal fun from(containerNetworkPolicyAllowlist: ContainerNetworkPolicyAllowlist) =
+ apply {
+ allowedDomains =
+ containerNetworkPolicyAllowlist.allowedDomains.map { it.toMutableList() }
+ type = containerNetworkPolicyAllowlist.type
+ domainSecrets =
+ containerNetworkPolicyAllowlist.domainSecrets.map { it.toMutableList() }
+ additionalProperties =
+ containerNetworkPolicyAllowlist.additionalProperties.toMutableMap()
+ }
+
+ /** A list of allowed domains when type is `allowlist`. */
+ fun allowedDomains(allowedDomains: List) =
+ allowedDomains(JsonField.of(allowedDomains))
+
+ /**
+ * Sets [Builder.allowedDomains] to an arbitrary JSON value.
+ *
+ * You should usually call [Builder.allowedDomains] with a well-typed `List` value
+ * instead. This method is primarily for setting the field to an undocumented or not yet
+ * supported value.
+ */
+ fun allowedDomains(allowedDomains: JsonField>) = apply {
+ this.allowedDomains = allowedDomains.map { it.toMutableList() }
+ }
+
+ /**
+ * Adds a single [String] to [allowedDomains].
+ *
+ * @throws IllegalStateException if the field was previously set to a non-list.
+ */
+ fun addAllowedDomain(allowedDomain: String) = apply {
+ allowedDomains =
+ (allowedDomains ?: JsonField.of(mutableListOf())).also {
+ checkKnown("allowedDomains", it).add(allowedDomain)
+ }
+ }
+
+ /**
+ * 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("allowlist")
+ * ```
+ *
+ * This method is primarily for setting the field to an undocumented or not yet supported
+ * value.
+ */
+ fun type(type: JsonValue) = apply { this.type = type }
+
+ /** Optional domain-scoped secrets for allowlisted domains. */
+ fun domainSecrets(domainSecrets: List) =
+ domainSecrets(JsonField.of(domainSecrets))
+
+ /**
+ * Sets [Builder.domainSecrets] to an arbitrary JSON value.
+ *
+ * You should usually call [Builder.domainSecrets] with a well-typed
+ * `List` value instead. This method is primarily for
+ * setting the field to an undocumented or not yet supported value.
+ */
+ fun domainSecrets(domainSecrets: JsonField>) =
+ apply {
+ this.domainSecrets = domainSecrets.map { it.toMutableList() }
+ }
+
+ /**
+ * Adds a single [ContainerNetworkPolicyDomainSecret] to [domainSecrets].
+ *
+ * @throws IllegalStateException if the field was previously set to a non-list.
+ */
+ fun addDomainSecret(domainSecret: ContainerNetworkPolicyDomainSecret) = apply {
+ domainSecrets =
+ (domainSecrets ?: JsonField.of(mutableListOf())).also {
+ checkKnown("domainSecrets", it).add(domainSecret)
+ }
+ }
+
+ 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 [ContainerNetworkPolicyAllowlist].
+ *
+ * Further updates to this [Builder] will not mutate the returned instance.
+ *
+ * The following fields are required:
+ * ```java
+ * .allowedDomains()
+ * ```
+ *
+ * @throws IllegalStateException if any required field is unset.
+ */
+ fun build(): ContainerNetworkPolicyAllowlist =
+ ContainerNetworkPolicyAllowlist(
+ checkRequired("allowedDomains", allowedDomains).map { it.toImmutable() },
+ type,
+ (domainSecrets ?: JsonMissing.of()).map { it.toImmutable() },
+ additionalProperties.toMutableMap(),
+ )
+ }
+
+ private var validated: Boolean = false
+
+ fun validate(): ContainerNetworkPolicyAllowlist = apply {
+ if (validated) {
+ return@apply
+ }
+
+ allowedDomains()
+ _type().let {
+ if (it != JsonValue.from("allowlist")) {
+ throw OpenAIInvalidDataException("'type' is invalid, received $it")
+ }
+ }
+ domainSecrets().ifPresent { it.forEach { it.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 =
+ (allowedDomains.asKnown().getOrNull()?.size ?: 0) +
+ type.let { if (it == JsonValue.from("allowlist")) 1 else 0 } +
+ (domainSecrets.asKnown().getOrNull()?.sumOf { it.validity().toInt() } ?: 0)
+
+ override fun equals(other: Any?): Boolean {
+ if (this === other) {
+ return true
+ }
+
+ return other is ContainerNetworkPolicyAllowlist &&
+ allowedDomains == other.allowedDomains &&
+ type == other.type &&
+ domainSecrets == other.domainSecrets &&
+ additionalProperties == other.additionalProperties
+ }
+
+ private val hashCode: Int by lazy {
+ Objects.hash(allowedDomains, type, domainSecrets, additionalProperties)
+ }
+
+ override fun hashCode(): Int = hashCode
+
+ override fun toString() =
+ "ContainerNetworkPolicyAllowlist{allowedDomains=$allowedDomains, type=$type, domainSecrets=$domainSecrets, additionalProperties=$additionalProperties}"
+}
diff --git a/openai-java-core/src/main/kotlin/com/openai/models/responses/ContainerNetworkPolicyDisabled.kt b/openai-java-core/src/main/kotlin/com/openai/models/responses/ContainerNetworkPolicyDisabled.kt
new file mode 100644
index 00000000..04d163f6
--- /dev/null
+++ b/openai-java-core/src/main/kotlin/com/openai/models/responses/ContainerNetworkPolicyDisabled.kt
@@ -0,0 +1,164 @@
+// 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.openai.core.ExcludeMissing
+import com.openai.core.JsonMissing
+import com.openai.core.JsonValue
+import com.openai.errors.OpenAIInvalidDataException
+import java.util.Collections
+import java.util.Objects
+
+class ContainerNetworkPolicyDisabled
+@JsonCreator(mode = JsonCreator.Mode.DISABLED)
+private constructor(
+ private val type: JsonValue,
+ private val additionalProperties: MutableMap,
+) {
+
+ @JsonCreator
+ private constructor(
+ @JsonProperty("type") @ExcludeMissing type: JsonValue = JsonMissing.of()
+ ) : this(type, mutableMapOf())
+
+ /**
+ * Disable outbound network access. Always `disabled`.
+ *
+ * Expected to always return the following:
+ * ```java
+ * JsonValue.from("disabled")
+ * ```
+ *
+ * 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
+
+ @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
+ * [ContainerNetworkPolicyDisabled].
+ */
+ @JvmStatic fun builder() = Builder()
+ }
+
+ /** A builder for [ContainerNetworkPolicyDisabled]. */
+ class Builder internal constructor() {
+
+ private var type: JsonValue = JsonValue.from("disabled")
+ private var additionalProperties: MutableMap = mutableMapOf()
+
+ @JvmSynthetic
+ internal fun from(containerNetworkPolicyDisabled: ContainerNetworkPolicyDisabled) = apply {
+ type = containerNetworkPolicyDisabled.type
+ additionalProperties =
+ containerNetworkPolicyDisabled.additionalProperties.toMutableMap()
+ }
+
+ /**
+ * 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("disabled")
+ * ```
+ *
+ * This method is primarily for setting the field to an undocumented or not yet supported
+ * value.
+ */
+ fun type(type: JsonValue) = apply { this.type = type }
+
+ 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 [ContainerNetworkPolicyDisabled].
+ *
+ * Further updates to this [Builder] will not mutate the returned instance.
+ */
+ fun build(): ContainerNetworkPolicyDisabled =
+ ContainerNetworkPolicyDisabled(type, additionalProperties.toMutableMap())
+ }
+
+ private var validated: Boolean = false
+
+ fun validate(): ContainerNetworkPolicyDisabled = apply {
+ if (validated) {
+ return@apply
+ }
+
+ _type().let {
+ if (it != JsonValue.from("disabled")) {
+ throw OpenAIInvalidDataException("'type' 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 = type.let { if (it == JsonValue.from("disabled")) 1 else 0 }
+
+ override fun equals(other: Any?): Boolean {
+ if (this === other) {
+ return true
+ }
+
+ return other is ContainerNetworkPolicyDisabled &&
+ type == other.type &&
+ additionalProperties == other.additionalProperties
+ }
+
+ private val hashCode: Int by lazy { Objects.hash(type, additionalProperties) }
+
+ override fun hashCode(): Int = hashCode
+
+ override fun toString() =
+ "ContainerNetworkPolicyDisabled{type=$type, additionalProperties=$additionalProperties}"
+}
diff --git a/openai-java-core/src/main/kotlin/com/openai/models/responses/ContainerNetworkPolicyDomainSecret.kt b/openai-java-core/src/main/kotlin/com/openai/models/responses/ContainerNetworkPolicyDomainSecret.kt
new file mode 100644
index 00000000..b0a646c7
--- /dev/null
+++ b/openai-java-core/src/main/kotlin/com/openai/models/responses/ContainerNetworkPolicyDomainSecret.kt
@@ -0,0 +1,250 @@
+// 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.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
+
+class ContainerNetworkPolicyDomainSecret
+@JsonCreator(mode = JsonCreator.Mode.DISABLED)
+private constructor(
+ private val domain: JsonField,
+ private val name: JsonField,
+ private val value: JsonField,
+ private val additionalProperties: MutableMap,
+) {
+
+ @JsonCreator
+ private constructor(
+ @JsonProperty("domain") @ExcludeMissing domain: JsonField = JsonMissing.of(),
+ @JsonProperty("name") @ExcludeMissing name: JsonField = JsonMissing.of(),
+ @JsonProperty("value") @ExcludeMissing value: JsonField = JsonMissing.of(),
+ ) : this(domain, name, value, mutableMapOf())
+
+ /**
+ * The domain associated with the secret.
+ *
+ * @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 domain(): String = domain.getRequired("domain")
+
+ /**
+ * The name of the secret to inject for the domain.
+ *
+ * @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 name(): String = name.getRequired("name")
+
+ /**
+ * The secret value to inject for the domain.
+ *
+ * @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 value(): String = value.getRequired("value")
+
+ /**
+ * Returns the raw JSON value of [domain].
+ *
+ * Unlike [domain], this method doesn't throw if the JSON field has an unexpected type.
+ */
+ @JsonProperty("domain") @ExcludeMissing fun _domain(): JsonField = domain
+
+ /**
+ * 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 [value].
+ *
+ * Unlike [value], this method doesn't throw if the JSON field has an unexpected type.
+ */
+ @JsonProperty("value") @ExcludeMissing fun _value(): JsonField = value
+
+ @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
+ * [ContainerNetworkPolicyDomainSecret].
+ *
+ * The following fields are required:
+ * ```java
+ * .domain()
+ * .name()
+ * .value()
+ * ```
+ */
+ @JvmStatic fun builder() = Builder()
+ }
+
+ /** A builder for [ContainerNetworkPolicyDomainSecret]. */
+ class Builder internal constructor() {
+
+ private var domain: JsonField? = null
+ private var name: JsonField? = null
+ private var value: JsonField? = null
+ private var additionalProperties: MutableMap = mutableMapOf()
+
+ @JvmSynthetic
+ internal fun from(containerNetworkPolicyDomainSecret: ContainerNetworkPolicyDomainSecret) =
+ apply {
+ domain = containerNetworkPolicyDomainSecret.domain
+ name = containerNetworkPolicyDomainSecret.name
+ value = containerNetworkPolicyDomainSecret.value
+ additionalProperties =
+ containerNetworkPolicyDomainSecret.additionalProperties.toMutableMap()
+ }
+
+ /** The domain associated with the secret. */
+ fun domain(domain: String) = domain(JsonField.of(domain))
+
+ /**
+ * Sets [Builder.domain] to an arbitrary JSON value.
+ *
+ * You should usually call [Builder.domain] with a well-typed [String] value instead. This
+ * method is primarily for setting the field to an undocumented or not yet supported value.
+ */
+ fun domain(domain: JsonField) = apply { this.domain = domain }
+
+ /** The name of the secret to inject for the domain. */
+ fun name(name: String) = name(JsonField.of(name))
+
+ /**
+ * 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 }
+
+ /** The secret value to inject for the domain. */
+ fun value(value: String) = value(JsonField.of(value))
+
+ /**
+ * Sets [Builder.value] to an arbitrary JSON value.
+ *
+ * You should usually call [Builder.value] with a well-typed [String] value instead. This
+ * method is primarily for setting the field to an undocumented or not yet supported value.
+ */
+ fun value(value: JsonField) = apply { this.value = value }
+
+ 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 [ContainerNetworkPolicyDomainSecret].
+ *
+ * Further updates to this [Builder] will not mutate the returned instance.
+ *
+ * The following fields are required:
+ * ```java
+ * .domain()
+ * .name()
+ * .value()
+ * ```
+ *
+ * @throws IllegalStateException if any required field is unset.
+ */
+ fun build(): ContainerNetworkPolicyDomainSecret =
+ ContainerNetworkPolicyDomainSecret(
+ checkRequired("domain", domain),
+ checkRequired("name", name),
+ checkRequired("value", value),
+ additionalProperties.toMutableMap(),
+ )
+ }
+
+ private var validated: Boolean = false
+
+ fun validate(): ContainerNetworkPolicyDomainSecret = apply {
+ if (validated) {
+ return@apply
+ }
+
+ domain()
+ name()
+ value()
+ 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 (domain.asKnown().isPresent) 1 else 0) +
+ (if (name.asKnown().isPresent) 1 else 0) +
+ (if (value.asKnown().isPresent) 1 else 0)
+
+ override fun equals(other: Any?): Boolean {
+ if (this === other) {
+ return true
+ }
+
+ return other is ContainerNetworkPolicyDomainSecret &&
+ domain == other.domain &&
+ name == other.name &&
+ value == other.value &&
+ additionalProperties == other.additionalProperties
+ }
+
+ private val hashCode: Int by lazy { Objects.hash(domain, name, value, additionalProperties) }
+
+ override fun hashCode(): Int = hashCode
+
+ override fun toString() =
+ "ContainerNetworkPolicyDomainSecret{domain=$domain, name=$name, value=$value, additionalProperties=$additionalProperties}"
+}
diff --git a/openai-java-core/src/main/kotlin/com/openai/models/responses/ContainerReference.kt b/openai-java-core/src/main/kotlin/com/openai/models/responses/ContainerReference.kt
new file mode 100644
index 00000000..a4c48a57
--- /dev/null
+++ b/openai-java-core/src/main/kotlin/com/openai/models/responses/ContainerReference.kt
@@ -0,0 +1,219 @@
+// 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.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
+
+class ContainerReference
+@JsonCreator(mode = JsonCreator.Mode.DISABLED)
+private constructor(
+ private val containerId: JsonField,
+ private val type: JsonValue,
+ private val additionalProperties: MutableMap,
+) {
+
+ @JsonCreator
+ private constructor(
+ @JsonProperty("container_id")
+ @ExcludeMissing
+ containerId: JsonField = JsonMissing.of(),
+ @JsonProperty("type") @ExcludeMissing type: JsonValue = JsonMissing.of(),
+ ) : this(containerId, type, mutableMapOf())
+
+ /**
+ * The ID of the referenced container.
+ *
+ * @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 containerId(): String = containerId.getRequired("container_id")
+
+ /**
+ * References a container created with the /v1/containers endpoint
+ *
+ * Expected to always return the following:
+ * ```java
+ * JsonValue.from("container_reference")
+ * ```
+ *
+ * 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
+
+ /**
+ * Returns the raw JSON value of [containerId].
+ *
+ * Unlike [containerId], this method doesn't throw if the JSON field has an unexpected type.
+ */
+ @JsonProperty("container_id")
+ @ExcludeMissing
+ fun _containerId(): JsonField = containerId
+
+ @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 [ContainerReference].
+ *
+ * The following fields are required:
+ * ```java
+ * .containerId()
+ * ```
+ */
+ @JvmStatic fun builder() = Builder()
+ }
+
+ /** A builder for [ContainerReference]. */
+ class Builder internal constructor() {
+
+ private var containerId: JsonField? = null
+ private var type: JsonValue = JsonValue.from("container_reference")
+ private var additionalProperties: MutableMap = mutableMapOf()
+
+ @JvmSynthetic
+ internal fun from(containerReference: ContainerReference) = apply {
+ containerId = containerReference.containerId
+ type = containerReference.type
+ additionalProperties = containerReference.additionalProperties.toMutableMap()
+ }
+
+ /** The ID of the referenced container. */
+ fun containerId(containerId: String) = containerId(JsonField.of(containerId))
+
+ /**
+ * Sets [Builder.containerId] to an arbitrary JSON value.
+ *
+ * You should usually call [Builder.containerId] with a well-typed [String] value instead.
+ * This method is primarily for setting the field to an undocumented or not yet supported
+ * value.
+ */
+ fun containerId(containerId: JsonField) = apply { this.containerId = containerId }
+
+ /**
+ * 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("container_reference")
+ * ```
+ *
+ * This method is primarily for setting the field to an undocumented or not yet supported
+ * value.
+ */
+ fun type(type: JsonValue) = apply { this.type = type }
+
+ 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 [ContainerReference].
+ *
+ * Further updates to this [Builder] will not mutate the returned instance.
+ *
+ * The following fields are required:
+ * ```java
+ * .containerId()
+ * ```
+ *
+ * @throws IllegalStateException if any required field is unset.
+ */
+ fun build(): ContainerReference =
+ ContainerReference(
+ checkRequired("containerId", containerId),
+ type,
+ additionalProperties.toMutableMap(),
+ )
+ }
+
+ private var validated: Boolean = false
+
+ fun validate(): ContainerReference = apply {
+ if (validated) {
+ return@apply
+ }
+
+ containerId()
+ _type().let {
+ if (it != JsonValue.from("container_reference")) {
+ throw OpenAIInvalidDataException("'type' 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 =
+ (if (containerId.asKnown().isPresent) 1 else 0) +
+ type.let { if (it == JsonValue.from("container_reference")) 1 else 0 }
+
+ override fun equals(other: Any?): Boolean {
+ if (this === other) {
+ return true
+ }
+
+ return other is ContainerReference &&
+ containerId == other.containerId &&
+ type == other.type &&
+ additionalProperties == other.additionalProperties
+ }
+
+ private val hashCode: Int by lazy { Objects.hash(containerId, type, additionalProperties) }
+
+ override fun hashCode(): Int = hashCode
+
+ override fun toString() =
+ "ContainerReference{containerId=$containerId, type=$type, additionalProperties=$additionalProperties}"
+}
diff --git a/openai-java-core/src/main/kotlin/com/openai/models/responses/FunctionShellTool.kt b/openai-java-core/src/main/kotlin/com/openai/models/responses/FunctionShellTool.kt
index 3f08c0e7..e29d6357 100644
--- a/openai-java-core/src/main/kotlin/com/openai/models/responses/FunctionShellTool.kt
+++ b/openai-java-core/src/main/kotlin/com/openai/models/responses/FunctionShellTool.kt
@@ -6,25 +6,42 @@ 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.ExcludeMissing
+import com.openai.core.JsonField
import com.openai.core.JsonMissing
import com.openai.core.JsonValue
+import com.openai.core.getOrThrow
import com.openai.errors.OpenAIInvalidDataException
import java.util.Collections
import java.util.Objects
+import java.util.Optional
+import kotlin.jvm.optionals.getOrNull
/** A tool that allows the model to execute shell commands. */
class FunctionShellTool
@JsonCreator(mode = JsonCreator.Mode.DISABLED)
private constructor(
private val type: JsonValue,
+ private val environment: JsonField,
private val additionalProperties: MutableMap,
) {
@JsonCreator
private constructor(
- @JsonProperty("type") @ExcludeMissing type: JsonValue = JsonMissing.of()
- ) : this(type, mutableMapOf())
+ @JsonProperty("type") @ExcludeMissing type: JsonValue = JsonMissing.of(),
+ @JsonProperty("environment")
+ @ExcludeMissing
+ environment: JsonField = JsonMissing.of(),
+ ) : this(type, environment, mutableMapOf())
/**
* The type of the shell tool. Always `shell`.
@@ -39,6 +56,21 @@ private constructor(
*/
@JsonProperty("type") @ExcludeMissing fun _type(): JsonValue = type
+ /**
+ * @throws OpenAIInvalidDataException if the JSON field has an unexpected type (e.g. if the
+ * server responded with an unexpected value).
+ */
+ fun environment(): Optional = environment.getOptional("environment")
+
+ /**
+ * Returns the raw JSON value of [environment].
+ *
+ * Unlike [environment], this method doesn't throw if the JSON field has an unexpected type.
+ */
+ @JsonProperty("environment")
+ @ExcludeMissing
+ fun _environment(): JsonField = environment
+
@JsonAnySetter
private fun putAdditionalProperty(key: String, value: JsonValue) {
additionalProperties.put(key, value)
@@ -61,11 +93,13 @@ private constructor(
class Builder internal constructor() {
private var type: JsonValue = JsonValue.from("shell")
+ private var environment: JsonField = JsonMissing.of()
private var additionalProperties: MutableMap = mutableMapOf()
@JvmSynthetic
internal fun from(functionShellTool: FunctionShellTool) = apply {
type = functionShellTool.type
+ environment = functionShellTool.environment
additionalProperties = functionShellTool.additionalProperties.toMutableMap()
}
@@ -83,6 +117,47 @@ private constructor(
*/
fun type(type: JsonValue) = apply { this.type = type }
+ fun environment(environment: Environment?) = environment(JsonField.ofNullable(environment))
+
+ /** Alias for calling [Builder.environment] with `environment.orElse(null)`. */
+ fun environment(environment: Optional) = environment(environment.getOrNull())
+
+ /**
+ * Sets [Builder.environment] to an arbitrary JSON value.
+ *
+ * You should usually call [Builder.environment] with a well-typed [Environment] value
+ * instead. This method is primarily for setting the field to an undocumented or not yet
+ * supported value.
+ */
+ fun environment(environment: JsonField) = apply {
+ this.environment = environment
+ }
+
+ /** Alias for calling [environment] with `Environment.ofContainerAuto(containerAuto)`. */
+ fun environment(containerAuto: ContainerAuto) =
+ environment(Environment.ofContainerAuto(containerAuto))
+
+ /** Alias for calling [environment] with `Environment.ofLocal(local)`. */
+ fun environment(local: LocalEnvironment) = environment(Environment.ofLocal(local))
+
+ /**
+ * Alias for calling [environment] with
+ * `Environment.ofContainerReference(containerReference)`.
+ */
+ fun environment(containerReference: ContainerReference) =
+ environment(Environment.ofContainerReference(containerReference))
+
+ /**
+ * Alias for calling [environment] with the following:
+ * ```java
+ * ContainerReference.builder()
+ * .containerId(containerId)
+ * .build()
+ * ```
+ */
+ fun containerReferenceEnvironment(containerId: String) =
+ environment(ContainerReference.builder().containerId(containerId).build())
+
fun additionalProperties(additionalProperties: Map) = apply {
this.additionalProperties.clear()
putAllAdditionalProperties(additionalProperties)
@@ -108,7 +183,7 @@ private constructor(
* Further updates to this [Builder] will not mutate the returned instance.
*/
fun build(): FunctionShellTool =
- FunctionShellTool(type, additionalProperties.toMutableMap())
+ FunctionShellTool(type, environment, additionalProperties.toMutableMap())
}
private var validated: Boolean = false
@@ -123,6 +198,7 @@ private constructor(
throw OpenAIInvalidDataException("'type' is invalid, received $it")
}
}
+ environment().ifPresent { it.validate() }
validated = true
}
@@ -140,7 +216,213 @@ private constructor(
* Used for best match union deserialization.
*/
@JvmSynthetic
- internal fun validity(): Int = type.let { if (it == JsonValue.from("shell")) 1 else 0 }
+ internal fun validity(): Int =
+ type.let { if (it == JsonValue.from("shell")) 1 else 0 } +
+ (environment.asKnown().getOrNull()?.validity() ?: 0)
+
+ @JsonDeserialize(using = Environment.Deserializer::class)
+ @JsonSerialize(using = Environment.Serializer::class)
+ class Environment
+ private constructor(
+ private val containerAuto: ContainerAuto? = null,
+ private val local: LocalEnvironment? = null,
+ private val containerReference: ContainerReference? = null,
+ private val _json: JsonValue? = null,
+ ) {
+
+ fun containerAuto(): Optional = Optional.ofNullable(containerAuto)
+
+ fun local(): Optional = Optional.ofNullable(local)
+
+ fun containerReference(): Optional =
+ Optional.ofNullable(containerReference)
+
+ fun isContainerAuto(): Boolean = containerAuto != null
+
+ fun isLocal(): Boolean = local != null
+
+ fun isContainerReference(): Boolean = containerReference != null
+
+ fun asContainerAuto(): ContainerAuto = containerAuto.getOrThrow("containerAuto")
+
+ fun asLocal(): LocalEnvironment = local.getOrThrow("local")
+
+ fun asContainerReference(): ContainerReference =
+ containerReference.getOrThrow("containerReference")
+
+ fun _json(): Optional = Optional.ofNullable(_json)
+
+ fun accept(visitor: Visitor): T =
+ when {
+ containerAuto != null -> visitor.visitContainerAuto(containerAuto)
+ local != null -> visitor.visitLocal(local)
+ containerReference != null -> visitor.visitContainerReference(containerReference)
+ else -> visitor.unknown(_json)
+ }
+
+ private var validated: Boolean = false
+
+ fun validate(): Environment = apply {
+ if (validated) {
+ return@apply
+ }
+
+ accept(
+ object : Visitor {
+ override fun visitContainerAuto(containerAuto: ContainerAuto) {
+ containerAuto.validate()
+ }
+
+ override fun visitLocal(local: LocalEnvironment) {
+ local.validate()
+ }
+
+ override fun visitContainerReference(containerReference: ContainerReference) {
+ containerReference.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 visitContainerAuto(containerAuto: ContainerAuto) =
+ containerAuto.validity()
+
+ override fun visitLocal(local: LocalEnvironment) = local.validity()
+
+ override fun visitContainerReference(containerReference: ContainerReference) =
+ containerReference.validity()
+
+ override fun unknown(json: JsonValue?) = 0
+ }
+ )
+
+ override fun equals(other: Any?): Boolean {
+ if (this === other) {
+ return true
+ }
+
+ return other is Environment &&
+ containerAuto == other.containerAuto &&
+ local == other.local &&
+ containerReference == other.containerReference
+ }
+
+ override fun hashCode(): Int = Objects.hash(containerAuto, local, containerReference)
+
+ override fun toString(): String =
+ when {
+ containerAuto != null -> "Environment{containerAuto=$containerAuto}"
+ local != null -> "Environment{local=$local}"
+ containerReference != null -> "Environment{containerReference=$containerReference}"
+ _json != null -> "Environment{_unknown=$_json}"
+ else -> throw IllegalStateException("Invalid Environment")
+ }
+
+ companion object {
+
+ @JvmStatic
+ fun ofContainerAuto(containerAuto: ContainerAuto) =
+ Environment(containerAuto = containerAuto)
+
+ @JvmStatic fun ofLocal(local: LocalEnvironment) = Environment(local = local)
+
+ @JvmStatic
+ fun ofContainerReference(containerReference: ContainerReference) =
+ Environment(containerReference = containerReference)
+ }
+
+ /**
+ * An interface that defines how to map each variant of [Environment] to a value of type
+ * [T].
+ */
+ interface Visitor {
+
+ fun visitContainerAuto(containerAuto: ContainerAuto): T
+
+ fun visitLocal(local: LocalEnvironment): T
+
+ fun visitContainerReference(containerReference: ContainerReference): T
+
+ /**
+ * Maps an unknown variant of [Environment] to a value of type [T].
+ *
+ * An instance of [Environment] 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 Environment: $json")
+ }
+ }
+
+ internal class Deserializer : BaseDeserializer(Environment::class) {
+
+ override fun ObjectCodec.deserialize(node: JsonNode): Environment {
+ val json = JsonValue.fromJsonNode(node)
+ val type = json.asObject().getOrNull()?.get("type")?.asString()?.getOrNull()
+
+ when (type) {
+ "container_auto" -> {
+ return tryDeserialize(node, jacksonTypeRef())?.let {
+ Environment(containerAuto = it, _json = json)
+ } ?: Environment(_json = json)
+ }
+ "local" -> {
+ return tryDeserialize(node, jacksonTypeRef())?.let {
+ Environment(local = it, _json = json)
+ } ?: Environment(_json = json)
+ }
+ "container_reference" -> {
+ return tryDeserialize(node, jacksonTypeRef())?.let {
+ Environment(containerReference = it, _json = json)
+ } ?: Environment(_json = json)
+ }
+ }
+
+ return Environment(_json = json)
+ }
+ }
+
+ internal class Serializer : BaseSerializer(Environment::class) {
+
+ override fun serialize(
+ value: Environment,
+ generator: JsonGenerator,
+ provider: SerializerProvider,
+ ) {
+ when {
+ value.containerAuto != null -> generator.writeObject(value.containerAuto)
+ value.local != null -> generator.writeObject(value.local)
+ value.containerReference != null ->
+ generator.writeObject(value.containerReference)
+ value._json != null -> generator.writeObject(value._json)
+ else -> throw IllegalStateException("Invalid Environment")
+ }
+ }
+ }
+ }
override fun equals(other: Any?): Boolean {
if (this === other) {
@@ -149,13 +431,14 @@ private constructor(
return other is FunctionShellTool &&
type == other.type &&
+ environment == other.environment &&
additionalProperties == other.additionalProperties
}
- private val hashCode: Int by lazy { Objects.hash(type, additionalProperties) }
+ private val hashCode: Int by lazy { Objects.hash(type, environment, additionalProperties) }
override fun hashCode(): Int = hashCode
override fun toString() =
- "FunctionShellTool{type=$type, additionalProperties=$additionalProperties}"
+ "FunctionShellTool{type=$type, environment=$environment, additionalProperties=$additionalProperties}"
}
diff --git a/openai-java-core/src/main/kotlin/com/openai/models/responses/InlineSkill.kt b/openai-java-core/src/main/kotlin/com/openai/models/responses/InlineSkill.kt
new file mode 100644
index 00000000..dfb4b39a
--- /dev/null
+++ b/openai-java-core/src/main/kotlin/com/openai/models/responses/InlineSkill.kt
@@ -0,0 +1,295 @@
+// 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.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 kotlin.jvm.optionals.getOrNull
+
+class InlineSkill
+@JsonCreator(mode = JsonCreator.Mode.DISABLED)
+private constructor(
+ private val description: JsonField,
+ private val name: JsonField,
+ private val source: JsonField,
+ private val type: JsonValue,
+ private val additionalProperties: MutableMap,
+) {
+
+ @JsonCreator
+ private constructor(
+ @JsonProperty("description")
+ @ExcludeMissing
+ description: JsonField = JsonMissing.of(),
+ @JsonProperty("name") @ExcludeMissing name: JsonField = JsonMissing.of(),
+ @JsonProperty("source")
+ @ExcludeMissing
+ source: JsonField = JsonMissing.of(),
+ @JsonProperty("type") @ExcludeMissing type: JsonValue = JsonMissing.of(),
+ ) : this(description, name, source, type, mutableMapOf())
+
+ /**
+ * The description of the skill.
+ *
+ * @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 description(): String = description.getRequired("description")
+
+ /**
+ * The name of the skill.
+ *
+ * @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 name(): String = name.getRequired("name")
+
+ /**
+ * Inline skill payload
+ *
+ * @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 source(): InlineSkillSource = source.getRequired("source")
+
+ /**
+ * Defines an inline skill for this request.
+ *
+ * Expected to always return the following:
+ * ```java
+ * JsonValue.from("inline")
+ * ```
+ *
+ * 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
+
+ /**
+ * Returns the raw JSON value of [description].
+ *
+ * Unlike [description], this method doesn't throw if the JSON field has an unexpected type.
+ */
+ @JsonProperty("description") @ExcludeMissing fun _description(): JsonField = description
+
+ /**
+ * 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 [source].
+ *
+ * Unlike [source], this method doesn't throw if the JSON field has an unexpected type.
+ */
+ @JsonProperty("source") @ExcludeMissing fun _source(): JsonField = source
+
+ @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 [InlineSkill].
+ *
+ * The following fields are required:
+ * ```java
+ * .description()
+ * .name()
+ * .source()
+ * ```
+ */
+ @JvmStatic fun builder() = Builder()
+ }
+
+ /** A builder for [InlineSkill]. */
+ class Builder internal constructor() {
+
+ private var description: JsonField? = null
+ private var name: JsonField? = null
+ private var source: JsonField? = null
+ private var type: JsonValue = JsonValue.from("inline")
+ private var additionalProperties: MutableMap = mutableMapOf()
+
+ @JvmSynthetic
+ internal fun from(inlineSkill: InlineSkill) = apply {
+ description = inlineSkill.description
+ name = inlineSkill.name
+ source = inlineSkill.source
+ type = inlineSkill.type
+ additionalProperties = inlineSkill.additionalProperties.toMutableMap()
+ }
+
+ /** The description of the skill. */
+ fun description(description: String) = description(JsonField.of(description))
+
+ /**
+ * Sets [Builder.description] to an arbitrary JSON value.
+ *
+ * You should usually call [Builder.description] with a well-typed [String] value instead.
+ * This method is primarily for setting the field to an undocumented or not yet supported
+ * value.
+ */
+ fun description(description: JsonField) = apply { this.description = description }
+
+ /** The name of the skill. */
+ fun name(name: String) = name(JsonField.of(name))
+
+ /**
+ * 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 }
+
+ /** Inline skill payload */
+ fun source(source: InlineSkillSource) = source(JsonField.of(source))
+
+ /**
+ * Sets [Builder.source] to an arbitrary JSON value.
+ *
+ * You should usually call [Builder.source] with a well-typed [InlineSkillSource] value
+ * instead. This method is primarily for setting the field to an undocumented or not yet
+ * supported value.
+ */
+ fun source(source: JsonField) = apply { this.source = source }
+
+ /**
+ * 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("inline")
+ * ```
+ *
+ * This method is primarily for setting the field to an undocumented or not yet supported
+ * value.
+ */
+ fun type(type: JsonValue) = apply { this.type = type }
+
+ 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 [InlineSkill].
+ *
+ * Further updates to this [Builder] will not mutate the returned instance.
+ *
+ * The following fields are required:
+ * ```java
+ * .description()
+ * .name()
+ * .source()
+ * ```
+ *
+ * @throws IllegalStateException if any required field is unset.
+ */
+ fun build(): InlineSkill =
+ InlineSkill(
+ checkRequired("description", description),
+ checkRequired("name", name),
+ checkRequired("source", source),
+ type,
+ additionalProperties.toMutableMap(),
+ )
+ }
+
+ private var validated: Boolean = false
+
+ fun validate(): InlineSkill = apply {
+ if (validated) {
+ return@apply
+ }
+
+ description()
+ name()
+ source().validate()
+ _type().let {
+ if (it != JsonValue.from("inline")) {
+ throw OpenAIInvalidDataException("'type' 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 =
+ (if (description.asKnown().isPresent) 1 else 0) +
+ (if (name.asKnown().isPresent) 1 else 0) +
+ (source.asKnown().getOrNull()?.validity() ?: 0) +
+ type.let { if (it == JsonValue.from("inline")) 1 else 0 }
+
+ override fun equals(other: Any?): Boolean {
+ if (this === other) {
+ return true
+ }
+
+ return other is InlineSkill &&
+ description == other.description &&
+ name == other.name &&
+ source == other.source &&
+ type == other.type &&
+ additionalProperties == other.additionalProperties
+ }
+
+ private val hashCode: Int by lazy {
+ Objects.hash(description, name, source, type, additionalProperties)
+ }
+
+ override fun hashCode(): Int = hashCode
+
+ override fun toString() =
+ "InlineSkill{description=$description, name=$name, source=$source, type=$type, additionalProperties=$additionalProperties}"
+}
diff --git a/openai-java-core/src/main/kotlin/com/openai/models/responses/InlineSkillSource.kt b/openai-java-core/src/main/kotlin/com/openai/models/responses/InlineSkillSource.kt
new file mode 100644
index 00000000..bf1d7c49
--- /dev/null
+++ b/openai-java-core/src/main/kotlin/com/openai/models/responses/InlineSkillSource.kt
@@ -0,0 +1,254 @@
+// 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.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
+
+/** Inline skill payload */
+class InlineSkillSource
+@JsonCreator(mode = JsonCreator.Mode.DISABLED)
+private constructor(
+ private val data: JsonField,
+ private val mediaType: JsonValue,
+ private val type: JsonValue,
+ private val additionalProperties: MutableMap,
+) {
+
+ @JsonCreator
+ private constructor(
+ @JsonProperty("data") @ExcludeMissing data: JsonField = JsonMissing.of(),
+ @JsonProperty("media_type") @ExcludeMissing mediaType: JsonValue = JsonMissing.of(),
+ @JsonProperty("type") @ExcludeMissing type: JsonValue = JsonMissing.of(),
+ ) : this(data, mediaType, type, mutableMapOf())
+
+ /**
+ * Base64-encoded skill zip bundle.
+ *
+ * @throws OpenAIInvalidDataException if the JSON field has an unexpected type or is
+ * unexpectedly missing or null (e.g. if the server responded with an unexpected value).
+ */
+ fun data(): String = data.getRequired("data")
+
+ /**
+ * The media type of the inline skill payload. Must be `application/zip`.
+ *
+ * Expected to always return the following:
+ * ```java
+ * JsonValue.from("application/zip")
+ * ```
+ *
+ * However, this method can be useful for debugging and logging (e.g. if the server responded
+ * with an unexpected value).
+ */
+ @JsonProperty("media_type") @ExcludeMissing fun _mediaType(): JsonValue = mediaType
+
+ /**
+ * The type of the inline skill source. Must be `base64`.
+ *
+ * Expected to always return the following:
+ * ```java
+ * JsonValue.from("base64")
+ * ```
+ *
+ * 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
+
+ /**
+ * Returns the raw JSON value of [data].
+ *
+ * Unlike [data], this method doesn't throw if the JSON field has an unexpected type.
+ */
+ @JsonProperty("data") @ExcludeMissing fun _data(): JsonField = data
+
+ @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 [InlineSkillSource].
+ *
+ * The following fields are required:
+ * ```java
+ * .data()
+ * ```
+ */
+ @JvmStatic fun builder() = Builder()
+ }
+
+ /** A builder for [InlineSkillSource]. */
+ class Builder internal constructor() {
+
+ private var data: JsonField? = null
+ private var mediaType: JsonValue = JsonValue.from("application/zip")
+ private var type: JsonValue = JsonValue.from("base64")
+ private var additionalProperties: MutableMap = mutableMapOf()
+
+ @JvmSynthetic
+ internal fun from(inlineSkillSource: InlineSkillSource) = apply {
+ data = inlineSkillSource.data
+ mediaType = inlineSkillSource.mediaType
+ type = inlineSkillSource.type
+ additionalProperties = inlineSkillSource.additionalProperties.toMutableMap()
+ }
+
+ /** Base64-encoded skill zip bundle. */
+ fun data(data: String) = data(JsonField.of(data))
+
+ /**
+ * Sets [Builder.data] to an arbitrary JSON value.
+ *
+ * You should usually call [Builder.data] with a well-typed [String] value instead. This
+ * method is primarily for setting the field to an undocumented or not yet supported value.
+ */
+ fun data(data: JsonField) = apply { this.data = data }
+
+ /**
+ * 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("application/zip")
+ * ```
+ *
+ * This method is primarily for setting the field to an undocumented or not yet supported
+ * value.
+ */
+ fun mediaType(mediaType: JsonValue) = apply { this.mediaType = mediaType }
+
+ /**
+ * 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("base64")
+ * ```
+ *
+ * This method is primarily for setting the field to an undocumented or not yet supported
+ * value.
+ */
+ fun type(type: JsonValue) = apply { this.type = type }
+
+ 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 [InlineSkillSource].
+ *
+ * Further updates to this [Builder] will not mutate the returned instance.
+ *
+ * The following fields are required:
+ * ```java
+ * .data()
+ * ```
+ *
+ * @throws IllegalStateException if any required field is unset.
+ */
+ fun build(): InlineSkillSource =
+ InlineSkillSource(
+ checkRequired("data", data),
+ mediaType,
+ type,
+ additionalProperties.toMutableMap(),
+ )
+ }
+
+ private var validated: Boolean = false
+
+ fun validate(): InlineSkillSource = apply {
+ if (validated) {
+ return@apply
+ }
+
+ data()
+ _mediaType().let {
+ if (it != JsonValue.from("application/zip")) {
+ throw OpenAIInvalidDataException("'mediaType' is invalid, received $it")
+ }
+ }
+ _type().let {
+ if (it != JsonValue.from("base64")) {
+ throw OpenAIInvalidDataException("'type' 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 =
+ (if (data.asKnown().isPresent) 1 else 0) +
+ mediaType.let { if (it == JsonValue.from("application/zip")) 1 else 0 } +
+ type.let { if (it == JsonValue.from("base64")) 1 else 0 }
+
+ override fun equals(other: Any?): Boolean {
+ if (this === other) {
+ return true
+ }
+
+ return other is InlineSkillSource &&
+ data == other.data &&
+ mediaType == other.mediaType &&
+ type == other.type &&
+ additionalProperties == other.additionalProperties
+ }
+
+ private val hashCode: Int by lazy { Objects.hash(data, mediaType, type, additionalProperties) }
+
+ override fun hashCode(): Int = hashCode
+
+ override fun toString() =
+ "InlineSkillSource{data=$data, mediaType=$mediaType, type=$type, additionalProperties=$additionalProperties}"
+}
diff --git a/openai-java-core/src/main/kotlin/com/openai/models/responses/LocalEnvironment.kt b/openai-java-core/src/main/kotlin/com/openai/models/responses/LocalEnvironment.kt
new file mode 100644
index 00000000..8f475f83
--- /dev/null
+++ b/openai-java-core/src/main/kotlin/com/openai/models/responses/LocalEnvironment.kt
@@ -0,0 +1,220 @@
+// 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.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.toImmutable
+import com.openai.errors.OpenAIInvalidDataException
+import java.util.Collections
+import java.util.Objects
+import java.util.Optional
+import kotlin.jvm.optionals.getOrNull
+
+class LocalEnvironment
+@JsonCreator(mode = JsonCreator.Mode.DISABLED)
+private constructor(
+ private val type: JsonValue,
+ private val skills: JsonField>,
+ private val additionalProperties: MutableMap,
+) {
+
+ @JsonCreator
+ private constructor(
+ @JsonProperty("type") @ExcludeMissing type: JsonValue = JsonMissing.of(),
+ @JsonProperty("skills")
+ @ExcludeMissing
+ skills: JsonField> = JsonMissing.of(),
+ ) : this(type, skills, mutableMapOf())
+
+ /**
+ * Use a local computer environment.
+ *
+ * Expected to always return the following:
+ * ```java
+ * JsonValue.from("local")
+ * ```
+ *
+ * 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
+
+ /**
+ * An optional list of skills.
+ *
+ * @throws OpenAIInvalidDataException if the JSON field has an unexpected type (e.g. if the
+ * server responded with an unexpected value).
+ */
+ fun skills(): Optional> = skills.getOptional("skills")
+
+ /**
+ * Returns the raw JSON value of [skills].
+ *
+ * Unlike [skills], this method doesn't throw if the JSON field has an unexpected type.
+ */
+ @JsonProperty("skills") @ExcludeMissing fun _skills(): JsonField> = skills
+
+ @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 [LocalEnvironment]. */
+ @JvmStatic fun builder() = Builder()
+ }
+
+ /** A builder for [LocalEnvironment]. */
+ class Builder internal constructor() {
+
+ private var type: JsonValue = JsonValue.from("local")
+ private var skills: JsonField>? = null
+ private var additionalProperties: MutableMap = mutableMapOf()
+
+ @JvmSynthetic
+ internal fun from(localEnvironment: LocalEnvironment) = apply {
+ type = localEnvironment.type
+ skills = localEnvironment.skills.map { it.toMutableList() }
+ additionalProperties = localEnvironment.additionalProperties.toMutableMap()
+ }
+
+ /**
+ * 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("local")
+ * ```
+ *
+ * This method is primarily for setting the field to an undocumented or not yet supported
+ * value.
+ */
+ fun type(type: JsonValue) = apply { this.type = type }
+
+ /** An optional list of skills. */
+ fun skills(skills: List) = skills(JsonField.of(skills))
+
+ /**
+ * Sets [Builder.skills] to an arbitrary JSON value.
+ *
+ * You should usually call [Builder.skills] with a well-typed `List` value
+ * instead. This method is primarily for setting the field to an undocumented or not yet
+ * supported value.
+ */
+ fun skills(skills: JsonField>) = apply {
+ this.skills = skills.map { it.toMutableList() }
+ }
+
+ /**
+ * Adds a single [LocalSkill] to [skills].
+ *
+ * @throws IllegalStateException if the field was previously set to a non-list.
+ */
+ fun addSkill(skill: LocalSkill) = apply {
+ skills =
+ (skills ?: JsonField.of(mutableListOf())).also {
+ checkKnown("skills", it).add(skill)
+ }
+ }
+
+ 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 [LocalEnvironment].
+ *
+ * Further updates to this [Builder] will not mutate the returned instance.
+ */
+ fun build(): LocalEnvironment =
+ LocalEnvironment(
+ type,
+ (skills ?: JsonMissing.of()).map { it.toImmutable() },
+ additionalProperties.toMutableMap(),
+ )
+ }
+
+ private var validated: Boolean = false
+
+ fun validate(): LocalEnvironment = apply {
+ if (validated) {
+ return@apply
+ }
+
+ _type().let {
+ if (it != JsonValue.from("local")) {
+ throw OpenAIInvalidDataException("'type' is invalid, received $it")
+ }
+ }
+ skills().ifPresent { it.forEach { it.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 =
+ type.let { if (it == JsonValue.from("local")) 1 else 0 } +
+ (skills.asKnown().getOrNull()?.sumOf { it.validity().toInt() } ?: 0)
+
+ override fun equals(other: Any?): Boolean {
+ if (this === other) {
+ return true
+ }
+
+ return other is LocalEnvironment &&
+ type == other.type &&
+ skills == other.skills &&
+ additionalProperties == other.additionalProperties
+ }
+
+ private val hashCode: Int by lazy { Objects.hash(type, skills, additionalProperties) }
+
+ override fun hashCode(): Int = hashCode
+
+ override fun toString() =
+ "LocalEnvironment{type=$type, skills=$skills, additionalProperties=$additionalProperties}"
+}
diff --git a/openai-java-core/src/main/kotlin/com/openai/models/responses/LocalSkill.kt b/openai-java-core/src/main/kotlin/com/openai/models/responses/LocalSkill.kt
new file mode 100644
index 00000000..a63f9003
--- /dev/null
+++ b/openai-java-core/src/main/kotlin/com/openai/models/responses/LocalSkill.kt
@@ -0,0 +1,252 @@
+// 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.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
+
+class LocalSkill
+@JsonCreator(mode = JsonCreator.Mode.DISABLED)
+private constructor(
+ private val description: JsonField,
+ private val name: JsonField,
+ private val path: JsonField,
+ private val additionalProperties: MutableMap,
+) {
+
+ @JsonCreator
+ private constructor(
+ @JsonProperty("description")
+ @ExcludeMissing
+ description: JsonField = JsonMissing.of(),
+ @JsonProperty("name") @ExcludeMissing name: JsonField = JsonMissing.of(),
+ @JsonProperty("path") @ExcludeMissing path: JsonField = JsonMissing.of(),
+ ) : this(description, name, path, mutableMapOf())
+
+ /**
+ * The description of the skill.
+ *
+ * @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 description(): String = description.getRequired("description")
+
+ /**
+ * The name of the skill.
+ *
+ * @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 name(): String = name.getRequired("name")
+
+ /**
+ * The path to the directory containing the skill.
+ *
+ * @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 path(): String = path.getRequired("path")
+
+ /**
+ * Returns the raw JSON value of [description].
+ *
+ * Unlike [description], this method doesn't throw if the JSON field has an unexpected type.
+ */
+ @JsonProperty("description") @ExcludeMissing fun _description(): JsonField = description
+
+ /**
+ * 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 [path].
+ *
+ * Unlike [path], this method doesn't throw if the JSON field has an unexpected type.
+ */
+ @JsonProperty("path") @ExcludeMissing fun _path(): JsonField = path
+
+ @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 [LocalSkill].
+ *
+ * The following fields are required:
+ * ```java
+ * .description()
+ * .name()
+ * .path()
+ * ```
+ */
+ @JvmStatic fun builder() = Builder()
+ }
+
+ /** A builder for [LocalSkill]. */
+ class Builder internal constructor() {
+
+ private var description: JsonField? = null
+ private var name: JsonField? = null
+ private var path: JsonField? = null
+ private var additionalProperties: MutableMap = mutableMapOf()
+
+ @JvmSynthetic
+ internal fun from(localSkill: LocalSkill) = apply {
+ description = localSkill.description
+ name = localSkill.name
+ path = localSkill.path
+ additionalProperties = localSkill.additionalProperties.toMutableMap()
+ }
+
+ /** The description of the skill. */
+ fun description(description: String) = description(JsonField.of(description))
+
+ /**
+ * Sets [Builder.description] to an arbitrary JSON value.
+ *
+ * You should usually call [Builder.description] with a well-typed [String] value instead.
+ * This method is primarily for setting the field to an undocumented or not yet supported
+ * value.
+ */
+ fun description(description: JsonField) = apply { this.description = description }
+
+ /** The name of the skill. */
+ fun name(name: String) = name(JsonField.of(name))
+
+ /**
+ * 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 }
+
+ /** The path to the directory containing the skill. */
+ fun path(path: String) = path(JsonField.of(path))
+
+ /**
+ * Sets [Builder.path] to an arbitrary JSON value.
+ *
+ * You should usually call [Builder.path] with a well-typed [String] value instead. This
+ * method is primarily for setting the field to an undocumented or not yet supported value.
+ */
+ fun path(path: JsonField) = apply { this.path = path }
+
+ 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 [LocalSkill].
+ *
+ * Further updates to this [Builder] will not mutate the returned instance.
+ *
+ * The following fields are required:
+ * ```java
+ * .description()
+ * .name()
+ * .path()
+ * ```
+ *
+ * @throws IllegalStateException if any required field is unset.
+ */
+ fun build(): LocalSkill =
+ LocalSkill(
+ checkRequired("description", description),
+ checkRequired("name", name),
+ checkRequired("path", path),
+ additionalProperties.toMutableMap(),
+ )
+ }
+
+ private var validated: Boolean = false
+
+ fun validate(): LocalSkill = apply {
+ if (validated) {
+ return@apply
+ }
+
+ description()
+ name()
+ path()
+ 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 (description.asKnown().isPresent) 1 else 0) +
+ (if (name.asKnown().isPresent) 1 else 0) +
+ (if (path.asKnown().isPresent) 1 else 0)
+
+ override fun equals(other: Any?): Boolean {
+ if (this === other) {
+ return true
+ }
+
+ return other is LocalSkill &&
+ description == other.description &&
+ name == other.name &&
+ path == other.path &&
+ additionalProperties == other.additionalProperties
+ }
+
+ private val hashCode: Int by lazy {
+ Objects.hash(description, name, path, additionalProperties)
+ }
+
+ override fun hashCode(): Int = hashCode
+
+ override fun toString() =
+ "LocalSkill{description=$description, name=$name, path=$path, additionalProperties=$additionalProperties}"
+}
diff --git a/openai-java-core/src/main/kotlin/com/openai/models/responses/ResponseContainerReference.kt b/openai-java-core/src/main/kotlin/com/openai/models/responses/ResponseContainerReference.kt
new file mode 100644
index 00000000..5cdb5d86
--- /dev/null
+++ b/openai-java-core/src/main/kotlin/com/openai/models/responses/ResponseContainerReference.kt
@@ -0,0 +1,217 @@
+// 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.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
+
+/** Represents a container created with /v1/containers. */
+class ResponseContainerReference
+@JsonCreator(mode = JsonCreator.Mode.DISABLED)
+private constructor(
+ private val containerId: JsonField,
+ private val type: JsonValue,
+ private val additionalProperties: MutableMap,
+) {
+
+ @JsonCreator
+ private constructor(
+ @JsonProperty("container_id")
+ @ExcludeMissing
+ containerId: JsonField = JsonMissing.of(),
+ @JsonProperty("type") @ExcludeMissing type: JsonValue = JsonMissing.of(),
+ ) : this(containerId, type, mutableMapOf())
+
+ /**
+ * @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 containerId(): String = containerId.getRequired("container_id")
+
+ /**
+ * The environment type. Always `container_reference`.
+ *
+ * Expected to always return the following:
+ * ```java
+ * JsonValue.from("container_reference")
+ * ```
+ *
+ * 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
+
+ /**
+ * Returns the raw JSON value of [containerId].
+ *
+ * Unlike [containerId], this method doesn't throw if the JSON field has an unexpected type.
+ */
+ @JsonProperty("container_id")
+ @ExcludeMissing
+ fun _containerId(): JsonField = containerId
+
+ @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 [ResponseContainerReference].
+ *
+ * The following fields are required:
+ * ```java
+ * .containerId()
+ * ```
+ */
+ @JvmStatic fun builder() = Builder()
+ }
+
+ /** A builder for [ResponseContainerReference]. */
+ class Builder internal constructor() {
+
+ private var containerId: JsonField? = null
+ private var type: JsonValue = JsonValue.from("container_reference")
+ private var additionalProperties: MutableMap = mutableMapOf()
+
+ @JvmSynthetic
+ internal fun from(responseContainerReference: ResponseContainerReference) = apply {
+ containerId = responseContainerReference.containerId
+ type = responseContainerReference.type
+ additionalProperties = responseContainerReference.additionalProperties.toMutableMap()
+ }
+
+ fun containerId(containerId: String) = containerId(JsonField.of(containerId))
+
+ /**
+ * Sets [Builder.containerId] to an arbitrary JSON value.
+ *
+ * You should usually call [Builder.containerId] with a well-typed [String] value instead.
+ * This method is primarily for setting the field to an undocumented or not yet supported
+ * value.
+ */
+ fun containerId(containerId: JsonField) = apply { this.containerId = containerId }
+
+ /**
+ * 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("container_reference")
+ * ```
+ *
+ * This method is primarily for setting the field to an undocumented or not yet supported
+ * value.
+ */
+ fun type(type: JsonValue) = apply { this.type = type }
+
+ 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 [ResponseContainerReference].
+ *
+ * Further updates to this [Builder] will not mutate the returned instance.
+ *
+ * The following fields are required:
+ * ```java
+ * .containerId()
+ * ```
+ *
+ * @throws IllegalStateException if any required field is unset.
+ */
+ fun build(): ResponseContainerReference =
+ ResponseContainerReference(
+ checkRequired("containerId", containerId),
+ type,
+ additionalProperties.toMutableMap(),
+ )
+ }
+
+ private var validated: Boolean = false
+
+ fun validate(): ResponseContainerReference = apply {
+ if (validated) {
+ return@apply
+ }
+
+ containerId()
+ _type().let {
+ if (it != JsonValue.from("container_reference")) {
+ throw OpenAIInvalidDataException("'type' 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 =
+ (if (containerId.asKnown().isPresent) 1 else 0) +
+ type.let { if (it == JsonValue.from("container_reference")) 1 else 0 }
+
+ override fun equals(other: Any?): Boolean {
+ if (this === other) {
+ return true
+ }
+
+ return other is ResponseContainerReference &&
+ containerId == other.containerId &&
+ type == other.type &&
+ additionalProperties == other.additionalProperties
+ }
+
+ private val hashCode: Int by lazy { Objects.hash(containerId, type, additionalProperties) }
+
+ override fun hashCode(): Int = hashCode
+
+ override fun toString() =
+ "ResponseContainerReference{containerId=$containerId, type=$type, additionalProperties=$additionalProperties}"
+}
diff --git a/openai-java-core/src/main/kotlin/com/openai/models/responses/ResponseFunctionShellToolCall.kt b/openai-java-core/src/main/kotlin/com/openai/models/responses/ResponseFunctionShellToolCall.kt
index 9111064a..132d87cf 100644
--- a/openai-java-core/src/main/kotlin/com/openai/models/responses/ResponseFunctionShellToolCall.kt
+++ b/openai-java-core/src/main/kotlin/com/openai/models/responses/ResponseFunctionShellToolCall.kt
@@ -6,6 +6,15 @@ 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
@@ -13,6 +22,7 @@ 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
@@ -27,6 +37,7 @@ private constructor(
private val id: JsonField,
private val action: JsonField,
private val callId: JsonField,
+ private val environment: JsonField,
private val status: JsonField,
private val type: JsonValue,
private val createdBy: JsonField,
@@ -38,10 +49,13 @@ private constructor(
@JsonProperty("id") @ExcludeMissing id: JsonField = JsonMissing.of(),
@JsonProperty("action") @ExcludeMissing action: JsonField = JsonMissing.of(),
@JsonProperty("call_id") @ExcludeMissing callId: JsonField = JsonMissing.of(),
+ @JsonProperty("environment")
+ @ExcludeMissing
+ environment: JsonField = JsonMissing.of(),
@JsonProperty("status") @ExcludeMissing status: JsonField = JsonMissing.of(),
@JsonProperty("type") @ExcludeMissing type: JsonValue = JsonMissing.of(),
@JsonProperty("created_by") @ExcludeMissing createdBy: JsonField = JsonMissing.of(),
- ) : this(id, action, callId, status, type, createdBy, mutableMapOf())
+ ) : this(id, action, callId, environment, status, type, createdBy, mutableMapOf())
/**
* The unique ID of the shell tool call. Populated when this item is returned via API.
@@ -67,6 +81,14 @@ private constructor(
*/
fun callId(): String = callId.getRequired("call_id")
+ /**
+ * Represents the use of a local environment to perform shell actions.
+ *
+ * @throws OpenAIInvalidDataException if the JSON field has an unexpected type (e.g. if the
+ * server responded with an unexpected value).
+ */
+ fun environment(): Optional = environment.getOptional("environment")
+
/**
* The status of the shell call. One of `in_progress`, `completed`, or `incomplete`.
*
@@ -117,6 +139,15 @@ private constructor(
*/
@JsonProperty("call_id") @ExcludeMissing fun _callId(): JsonField = callId
+ /**
+ * Returns the raw JSON value of [environment].
+ *
+ * Unlike [environment], this method doesn't throw if the JSON field has an unexpected type.
+ */
+ @JsonProperty("environment")
+ @ExcludeMissing
+ fun _environment(): JsonField = environment
+
/**
* Returns the raw JSON value of [status].
*
@@ -154,6 +185,7 @@ private constructor(
* .id()
* .action()
* .callId()
+ * .environment()
* .status()
* ```
*/
@@ -166,6 +198,7 @@ private constructor(
private var id: JsonField? = null
private var action: JsonField? = null
private var callId: JsonField? = null
+ private var environment: JsonField? = null
private var status: JsonField? = null
private var type: JsonValue = JsonValue.from("shell_call")
private var createdBy: JsonField = JsonMissing.of()
@@ -176,6 +209,7 @@ private constructor(
id = responseFunctionShellToolCall.id
action = responseFunctionShellToolCall.action
callId = responseFunctionShellToolCall.callId
+ environment = responseFunctionShellToolCall.environment
status = responseFunctionShellToolCall.status
type = responseFunctionShellToolCall.type
createdBy = responseFunctionShellToolCall.createdBy
@@ -215,6 +249,44 @@ private constructor(
*/
fun callId(callId: JsonField) = apply { this.callId = callId }
+ /** Represents the use of a local environment to perform shell actions. */
+ fun environment(environment: Environment?) = environment(JsonField.ofNullable(environment))
+
+ /** Alias for calling [Builder.environment] with `environment.orElse(null)`. */
+ fun environment(environment: Optional) = environment(environment.getOrNull())
+
+ /**
+ * Sets [Builder.environment] to an arbitrary JSON value.
+ *
+ * You should usually call [Builder.environment] with a well-typed [Environment] value
+ * instead. This method is primarily for setting the field to an undocumented or not yet
+ * supported value.
+ */
+ fun environment(environment: JsonField