diff --git a/.release-please-manifest.json b/.release-please-manifest.json
index 7dc692e1f..25e9535f2 100644
--- a/.release-please-manifest.json
+++ b/.release-please-manifest.json
@@ -1,3 +1,3 @@
{
- ".": "4.34.0"
+ ".": "4.35.0"
}
\ No newline at end of file
diff --git a/.stats.yml b/.stats.yml
index ab1af60f9..74bb7cc4f 100644
--- a/.stats.yml
+++ b/.stats.yml
@@ -1,4 +1,4 @@
configured_endpoints: 232
-openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/openai/openai-21ecab7aeb61612b9da5e52ea4c0cb75a33d443d975022934b9305e97d1a7d62.yml
-openapi_spec_hash: cfc868a0bb3567183510c9b5629c510f
-config_hash: dd484e2cc01206d26516338d0f4596b0
+openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/openai/openai-08cb8ed18dfe4a9fa518e278576d3cfe5710cb5c22789cf80826c900569bcf56.yml
+openapi_spec_hash: 20f820c94f54741b75d719f6a7371c12
+config_hash: f291a449469edfe61a28424e548899b2
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 41adf3b0c..34f266d61 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,5 +1,47 @@
# Changelog
+## 4.35.0 (2026-05-07)
+
+Full Changelog: [v4.34.0...v4.35.0](https://github.com/openai/openai-java/compare/v4.34.0...v4.35.0)
+
+### Features
+
+* **api:** add quantity field to organization usage responses, update topLogprobs docs ([d4686cc](https://github.com/openai/openai-java/commit/d4686cc7eb9bcd551282d421811341518ddc8584))
+* **api:** launch realtime translate + update image 2 ([28ad918](https://github.com/openai/openai-java/commit/28ad9189d7293388d043ed83496333132afc517f))
+* **api:** manual updates ([7905ef6](https://github.com/openai/openai-java/commit/7905ef6cc30852f0d80bd10c937d949028ff1303))
+* **api:** manual updates ([8328a1e](https://github.com/openai/openai-java/commit/8328a1eb51291dd0a317989e31e0989572bbfa0b))
+* **client:** improve logging ([6393b34](https://github.com/openai/openai-java/commit/6393b3431e87d15ad3ee23cc274161f8e00a87ec))
+* **client:** more robust error parsing ([5a1bfdc](https://github.com/openai/openai-java/commit/5a1bfdcb283dc6efc1ab5058ef96740087112288))
+* **client:** support proxy authentication ([97c8087](https://github.com/openai/openai-java/commit/97c808706c3684892d309245a205fcfcf90738cd))
+
+
+### Bug Fixes
+
+* **api:** fix imagegen `size` enum regression ([aacb886](https://github.com/openai/openai-java/commit/aacb886fd99a7571dabe5bc8f1086bef650c11fc))
+* **client:** match `JsonSchemaValidator` heading levels to API ([#733](https://github.com/openai/openai-java/issues/733)) ([fc57ef7](https://github.com/openai/openai-java/commit/fc57ef7963e6ebdfde0c716adc4f29d315dc9021))
+* **logging:** redact Azure api-key header in logging ([#717](https://github.com/openai/openai-java/issues/717)) ([157207f](https://github.com/openai/openai-java/commit/157207fefe59174141a5aec6a983c546def242b4))
+
+
+### Performance Improvements
+
+* **client:** create one json mapper ([6bdc12e](https://github.com/openai/openai-java/commit/6bdc12ed832827d3e9bdb9825898bfa5aee94d26))
+
+
+### Chores
+
+* fix build error ([82a8527](https://github.com/openai/openai-java/commit/82a85274f613aad7ae277765b12bc3469832e1b1))
+* redact api-key headers in debug logs ([73d01b0](https://github.com/openai/openai-java/commit/73d01b0a5a9af1e4722381701654ff5880ff8986))
+* remove duplicated dokka setup ([06e43e2](https://github.com/openai/openai-java/commit/06e43e2ca1a630dd8b4d38b151724d6b3fb5e014))
+* **tests:** update test fixtures to use valid example URLs ([021f44a](https://github.com/openai/openai-java/commit/021f44a12a39f7e1b8e405e4f309f1a4d0223ed6))
+
+
+### Documentation
+
+* **api:** document web_search_call.results in response includables ([18fe08a](https://github.com/openai/openai-java/commit/18fe08af6a53d6ef9b35e03190e137b02231608e))
+* clarify forwards compat behavior ([d44f466](https://github.com/openai/openai-java/commit/d44f4664a550f4d34b2d1b14c7f376d1047514e0))
+* clarify structured output map limitations ([#726](https://github.com/openai/openai-java/issues/726)) ([e1e1161](https://github.com/openai/openai-java/commit/e1e1161d69d30bd6639ada5ead3a30f14c68cf8d))
+* remove bad semicolon ([#725](https://github.com/openai/openai-java/issues/725)) ([b5dbd07](https://github.com/openai/openai-java/commit/b5dbd07e1147f5554509481798978717e22b03af))
+
## 4.34.0 (2026-05-01)
Full Changelog: [v4.33.0...v4.34.0](https://github.com/openai/openai-java/compare/v4.33.0...v4.34.0)
diff --git a/README.md b/README.md
index 6e80eae21..5cdfe2939 100644
--- a/README.md
+++ b/README.md
@@ -2,8 +2,8 @@
-[](https://central.sonatype.com/artifact/com.openai/openai-java/4.34.0)
-[](https://javadoc.io/doc/com.openai/openai-java/4.34.0)
+[](https://central.sonatype.com/artifact/com.openai/openai-java/4.35.0)
+[](https://javadoc.io/doc/com.openai/openai-java/4.35.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.34.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.35.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.34.0")
+implementation("com.openai:openai-java:4.35.0")
```
### Maven
@@ -33,7 +33,7 @@ implementation("com.openai:openai-java:4.34.0")
com.openai
openai-java
- 4.34.0
+ 4.35.0
```
@@ -349,7 +349,7 @@ client.async().chat().completions().createStreaming(params)
.subscribe(chunk -> {
System.out.println(chunk);
})
- .onCompleteFuture();
+ .onCompleteFuture()
.whenComplete((unused, error) -> {
if (error != null) {
System.out.println("Something went wrong!");
@@ -711,6 +711,8 @@ properties can be derived. This may occur if, for example:
- All fields and getter methods are non-`public`, but none are annotated with `@JsonProperty`.
- A field or getter method is declared with a `Map` type. A `Map` is treated like a separate class
with no named properties, so it will result in an empty `"properties"` field in the JSON schema.
+ If you need arbitrary key/value data, model it as a list of entry objects with named fields so the
+ generated schema still has concrete property names.
### Annotating classes and JSON schemas
@@ -1384,8 +1386,6 @@ while (true) {
## Logging
-The SDK uses the standard [OkHttp logging interceptor](https://github.com/square/okhttp/tree/master/okhttp-logging-interceptor).
-
Enable logging by setting the `OPENAI_LOG` environment variable to `info`:
```sh
@@ -1398,6 +1398,19 @@ Or to `debug` for more verbose logging:
export OPENAI_LOG=debug
```
+Or configure the client manually using the `logLevel` method:
+
+```java
+import com.openai.client.OpenAIClient;
+import com.openai.client.okhttp.OpenAIOkHttpClient;
+import com.openai.core.LogLevel;
+
+OpenAIClient client = OpenAIOkHttpClient.builder()
+ .fromEnv()
+ .logLevel(LogLevel.INFO)
+ .build();
+```
+
## ProGuard and R8
Although the SDK uses reflection, it is still usable with [ProGuard](https://github.com/Guardsquare/proguard) and [R8](https://developer.android.com/topic/performance/app-optimization/enable-app-optimization) because `openai-java-core` is published with a [configuration file](openai-java-core/src/main/resources/META-INF/proguard/openai-java-core.pro) containing [keep rules](https://www.guardsquare.com/manual/configuration/usage).
@@ -1421,7 +1434,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.34.0")
+implementation("com.openai:openai-java-spring-boot-starter:4.35.0")
```
#### Maven
@@ -1430,7 +1443,7 @@ implementation("com.openai:openai-java-spring-boot-starter:4.34.0")
com.openai
openai-java-spring-boot-starter
- 4.34.0
+ 4.35.0
```
@@ -1597,6 +1610,21 @@ OpenAIClient client = OpenAIOkHttpClient.builder()
.build();
```
+If the proxy responds with `407 Proxy Authentication Required`, supply credentials by also configuring `proxyAuthenticator`:
+
+```java
+import com.openai.client.OpenAIClient;
+import com.openai.client.okhttp.OpenAIOkHttpClient;
+import com.openai.core.http.ProxyAuthenticator;
+
+OpenAIClient client = OpenAIOkHttpClient.builder()
+ .fromEnv()
+ .proxy(...)
+ // Or a custom implementation of `ProxyAuthenticator`.
+ .proxyAuthenticator(ProxyAuthenticator.basic("username", "password"))
+ .build();
+```
+
### Connection pooling
To customize the underlying OkHttp connection pool, configure the client using the `maxIdleConnections` and `keepAliveDuration` methods:
@@ -1837,7 +1865,9 @@ In rare cases, the API may return a response that doesn't match the expected typ
By default, the SDK will not throw an exception in this case. It will throw [`OpenAIInvalidDataException`](openai-java-core/src/main/kotlin/com/openai/errors/OpenAIInvalidDataException.kt) only if you directly access the property.
-If you would prefer to check that the response is completely well-typed upfront, then either call `validate()`:
+Validating the response is _not_ forwards compatible with new types from the API for existing fields.
+
+If you would still prefer to check that the response is completely well-typed upfront, then either call `validate()`:
```java
import com.openai.models.chat.completions.ChatCompletion;
diff --git a/build.gradle.kts b/build.gradle.kts
index b5eeb1848..cf1932e56 100644
--- a/build.gradle.kts
+++ b/build.gradle.kts
@@ -8,7 +8,7 @@ repositories {
allprojects {
group = "com.openai"
- version = "4.34.0" // x-release-please-version
+ version = "4.35.0" // x-release-please-version
}
subprojects {
@@ -21,7 +21,6 @@ subprojects {
group = "Verification"
description = "Verifies all source files are formatted."
}
- apply(plugin = "org.jetbrains.dokka")
}
subprojects {
diff --git a/openai-java-client-okhttp/build.gradle.kts b/openai-java-client-okhttp/build.gradle.kts
index 753e4fbee..4d1eb6170 100644
--- a/openai-java-client-okhttp/build.gradle.kts
+++ b/openai-java-client-okhttp/build.gradle.kts
@@ -7,7 +7,6 @@ dependencies {
api(project(":openai-java-core"))
implementation("com.squareup.okhttp3:okhttp:4.12.0")
- implementation("com.squareup.okhttp3:logging-interceptor:4.12.0")
testImplementation(kotlin("test"))
testImplementation("org.assertj:assertj-core:3.27.7")
diff --git a/openai-java-client-okhttp/src/main/kotlin/com/openai/client/okhttp/OkHttpClient.kt b/openai-java-client-okhttp/src/main/kotlin/com/openai/client/okhttp/OkHttpClient.kt
index 51c32b0c2..b4aa82d2f 100644
--- a/openai-java-client-okhttp/src/main/kotlin/com/openai/client/okhttp/OkHttpClient.kt
+++ b/openai-java-client-okhttp/src/main/kotlin/com/openai/client/okhttp/OkHttpClient.kt
@@ -8,9 +8,11 @@ import com.openai.core.http.HttpMethod
import com.openai.core.http.HttpRequest
import com.openai.core.http.HttpRequestBody
import com.openai.core.http.HttpResponse
+import com.openai.core.http.ProxyAuthenticator
import com.openai.errors.OpenAIIoException
import java.io.IOException
import java.io.InputStream
+import java.io.OutputStream
import java.net.Proxy
import java.time.Duration
import java.util.concurrent.CancellationException
@@ -20,10 +22,12 @@ import java.util.concurrent.TimeUnit
import javax.net.ssl.HostnameVerifier
import javax.net.ssl.SSLSocketFactory
import javax.net.ssl.X509TrustManager
+import kotlin.jvm.optionals.getOrNull
import okhttp3.Call
import okhttp3.Callback
import okhttp3.ConnectionPool
import okhttp3.Dispatcher
+import okhttp3.HttpUrl
import okhttp3.HttpUrl.Companion.toHttpUrl
import okhttp3.MediaType
import okhttp3.MediaType.Companion.toMediaType
@@ -31,8 +35,9 @@ import okhttp3.Request
import okhttp3.RequestBody
import okhttp3.RequestBody.Companion.toRequestBody
import okhttp3.Response
-import okhttp3.logging.HttpLoggingInterceptor
import okio.BufferedSink
+import okio.buffer
+import okio.sink
class OkHttpClient
internal constructor(@JvmSynthetic internal val okHttpClient: okhttp3.OkHttpClient) : HttpClient {
@@ -41,7 +46,7 @@ internal constructor(@JvmSynthetic internal val okHttpClient: okhttp3.OkHttpClie
val call = newCall(request, requestOptions)
return try {
- call.execute().toResponse()
+ call.execute().toHttpResponse()
} catch (e: IOException) {
throw OpenAIIoException("Request failed", e)
} finally {
@@ -59,7 +64,7 @@ internal constructor(@JvmSynthetic internal val okHttpClient: okhttp3.OkHttpClie
call.enqueue(
object : Callback {
override fun onResponse(call: Call, response: Response) {
- future.complete(response.toResponse())
+ future.complete(response.toHttpResponse())
}
override fun onFailure(call: Call, e: IOException) {
@@ -87,18 +92,6 @@ internal constructor(@JvmSynthetic internal val okHttpClient: okhttp3.OkHttpClie
private fun newCall(request: HttpRequest, requestOptions: RequestOptions): Call {
val clientBuilder = okHttpClient.newBuilder()
- val logLevel =
- when (System.getenv("OPENAI_LOG")?.lowercase()) {
- "info" -> HttpLoggingInterceptor.Level.BASIC
- "debug" -> HttpLoggingInterceptor.Level.BODY
- else -> null
- }
- if (logLevel != null) {
- clientBuilder.addNetworkInterceptor(
- HttpLoggingInterceptor().setLevel(logLevel).apply { redactHeader("Authorization") }
- )
- }
-
requestOptions.timeout?.let {
clientBuilder
.connectTimeout(it.connect())
@@ -111,89 +104,6 @@ internal constructor(@JvmSynthetic internal val okHttpClient: okhttp3.OkHttpClie
return client.newCall(request.toRequest(client))
}
- private fun HttpRequest.toRequest(client: okhttp3.OkHttpClient): Request {
- var body: RequestBody? = body?.toRequestBody()
- if (body == null && requiresBody(method)) {
- body = "".toRequestBody()
- }
-
- val builder = Request.Builder().url(toUrl()).method(method.name, body)
- headers.names().forEach { name ->
- headers.values(name).forEach { builder.addHeader(name, it) }
- }
-
- if (
- !headers.names().contains("X-Stainless-Read-Timeout") && client.readTimeoutMillis != 0
- ) {
- builder.addHeader(
- "X-Stainless-Read-Timeout",
- Duration.ofMillis(client.readTimeoutMillis.toLong()).seconds.toString(),
- )
- }
- if (!headers.names().contains("X-Stainless-Timeout") && client.callTimeoutMillis != 0) {
- builder.addHeader(
- "X-Stainless-Timeout",
- Duration.ofMillis(client.callTimeoutMillis.toLong()).seconds.toString(),
- )
- }
-
- return builder.build()
- }
-
- /** `OkHttpClient` always requires a request body for some methods. */
- private fun requiresBody(method: HttpMethod): Boolean =
- when (method) {
- HttpMethod.POST,
- HttpMethod.PUT,
- HttpMethod.PATCH -> true
- else -> false
- }
-
- private fun HttpRequest.toUrl(): String {
- val builder = baseUrl.toHttpUrl().newBuilder()
- pathSegments.forEach(builder::addPathSegment)
- queryParams.keys().forEach { key ->
- queryParams.values(key).forEach { builder.addQueryParameter(key, it) }
- }
-
- return builder.toString()
- }
-
- private fun HttpRequestBody.toRequestBody(): RequestBody {
- val mediaType = contentType()?.toMediaType()
- val length = contentLength()
-
- return object : RequestBody() {
- override fun contentType(): MediaType? = mediaType
-
- override fun contentLength(): Long = length
-
- override fun isOneShot(): Boolean = !repeatable()
-
- override fun writeTo(sink: BufferedSink) = writeTo(sink.outputStream())
- }
- }
-
- private fun Response.toResponse(): HttpResponse {
- val headers = headers.toHeaders()
-
- return object : HttpResponse {
- override fun statusCode(): Int = code
-
- override fun headers(): Headers = headers
-
- override fun body(): InputStream = body!!.byteStream()
-
- override fun close() = body!!.close()
- }
- }
-
- private fun okhttp3.Headers.toHeaders(): Headers {
- val headersBuilder = Headers.builder()
- forEach { (name, value) -> headersBuilder.put(name, value) }
- return headersBuilder.build()
- }
-
companion object {
@JvmStatic fun builder() = Builder()
}
@@ -202,6 +112,7 @@ internal constructor(@JvmSynthetic internal val okHttpClient: okhttp3.OkHttpClie
private var timeout: Timeout = Timeout.default()
private var proxy: Proxy? = null
+ private var proxyAuthenticator: ProxyAuthenticator? = null
private var maxIdleConnections: Int? = null
private var keepAliveDuration: Duration? = null
private var dispatcherExecutorService: ExecutorService? = null
@@ -215,6 +126,10 @@ internal constructor(@JvmSynthetic internal val okHttpClient: okhttp3.OkHttpClie
fun proxy(proxy: Proxy?) = apply { this.proxy = proxy }
+ fun proxyAuthenticator(proxyAuthenticator: ProxyAuthenticator?) = apply {
+ this.proxyAuthenticator = proxyAuthenticator
+ }
+
/**
* Sets the maximum number of idle connections kept by the underlying [ConnectionPool].
*
@@ -264,6 +179,19 @@ internal constructor(@JvmSynthetic internal val okHttpClient: okhttp3.OkHttpClie
.callTimeout(timeout.request())
.proxy(proxy)
.apply {
+ proxyAuthenticator?.let { auth ->
+ proxyAuthenticator { route, response ->
+ auth
+ .authenticate(
+ route?.proxy ?: Proxy.NO_PROXY,
+ response.request.toHttpRequest(),
+ response.toHttpResponse(),
+ )
+ .getOrNull()
+ ?.toRequest(client = null)
+ }
+ }
+
dispatcherExecutorService?.let { dispatcher(Dispatcher(it)) }
val maxIdleConnections = maxIdleConnections
@@ -303,3 +231,126 @@ internal constructor(@JvmSynthetic internal val okHttpClient: okhttp3.OkHttpClie
)
}
}
+
+private fun HttpRequest.toRequest(client: okhttp3.OkHttpClient?): Request {
+ var body: RequestBody? = body?.toRequestBody()
+ if (body == null && requiresBody(method)) {
+ body = "".toRequestBody()
+ }
+
+ val builder = Request.Builder().url(toUrl()).method(method.name, body)
+ headers.names().forEach { name -> headers.values(name).forEach { builder.addHeader(name, it) } }
+
+ if (client != null) {
+ if (
+ !headers.names().contains("X-Stainless-Read-Timeout") && client.readTimeoutMillis != 0
+ ) {
+ builder.addHeader(
+ "X-Stainless-Read-Timeout",
+ Duration.ofMillis(client.readTimeoutMillis.toLong()).seconds.toString(),
+ )
+ }
+ if (!headers.names().contains("X-Stainless-Timeout") && client.callTimeoutMillis != 0) {
+ builder.addHeader(
+ "X-Stainless-Timeout",
+ Duration.ofMillis(client.callTimeoutMillis.toLong()).seconds.toString(),
+ )
+ }
+ }
+
+ return builder.build()
+}
+
+/** `OkHttpClient` always requires a request body for some methods. */
+private fun requiresBody(method: HttpMethod): Boolean =
+ when (method) {
+ HttpMethod.POST,
+ HttpMethod.PUT,
+ HttpMethod.PATCH -> true
+ else -> false
+ }
+
+private fun HttpRequest.toUrl(): String {
+ val builder = baseUrl.toHttpUrl().newBuilder()
+ pathSegments.forEach(builder::addPathSegment)
+ queryParams.keys().forEach { key ->
+ queryParams.values(key).forEach { builder.addQueryParameter(key, it) }
+ }
+
+ return builder.toString()
+}
+
+private fun HttpRequestBody.toRequestBody(): RequestBody {
+ val mediaType = contentType()?.toMediaType()
+ val length = contentLength()
+
+ return object : RequestBody() {
+ override fun contentType(): MediaType? = mediaType
+
+ override fun contentLength(): Long = length
+
+ override fun isOneShot(): Boolean = !repeatable()
+
+ override fun writeTo(sink: BufferedSink) = writeTo(sink.outputStream())
+ }
+}
+
+private fun Request.toHttpRequest(): HttpRequest {
+ val builder = HttpRequest.builder().method(HttpMethod.valueOf(method)).baseUrl(url.toBaseUrl())
+ url.pathSegments.forEach(builder::addPathSegment)
+ url.queryParameterNames.forEach { name ->
+ url.queryParameterValues(name).filterNotNull().forEach { builder.putQueryParam(name, it) }
+ }
+ headers.forEach { (name, value) -> builder.putHeader(name, value) }
+ body?.let { builder.body(it.toHttpRequestBody()) }
+ return builder.build()
+}
+
+private fun HttpUrl.toBaseUrl(): String = buildString {
+ append(scheme).append("://").append(host)
+ if (port != HttpUrl.defaultPort(scheme)) {
+ append(":").append(port)
+ }
+}
+
+private fun RequestBody.toHttpRequestBody(): HttpRequestBody {
+ val mediaType = contentType()?.toString()
+ val length = contentLength()
+ val isOneShot = isOneShot()
+ val source = this
+ return object : HttpRequestBody {
+ override fun contentType(): String? = mediaType
+
+ override fun contentLength(): Long = length
+
+ override fun repeatable(): Boolean = !isOneShot
+
+ override fun writeTo(outputStream: OutputStream) {
+ val sink = outputStream.sink().buffer()
+ source.writeTo(sink)
+ sink.flush()
+ }
+
+ override fun close() {}
+ }
+}
+
+private fun Response.toHttpResponse(): HttpResponse {
+ val headers = headers.toHeaders()
+
+ return object : HttpResponse {
+ override fun statusCode(): Int = code
+
+ override fun headers(): Headers = headers
+
+ override fun body(): InputStream = body!!.byteStream()
+
+ override fun close() = body!!.close()
+ }
+}
+
+private fun okhttp3.Headers.toHeaders(): Headers {
+ val headersBuilder = Headers.builder()
+ forEach { (name, value) -> headersBuilder.put(name, value) }
+ return headersBuilder.build()
+}
diff --git a/openai-java-client-okhttp/src/main/kotlin/com/openai/client/okhttp/OpenAIOkHttpClient.kt b/openai-java-client-okhttp/src/main/kotlin/com/openai/client/okhttp/OpenAIOkHttpClient.kt
index eca395985..59ae7e571 100644
--- a/openai-java-client-okhttp/src/main/kotlin/com/openai/client/okhttp/OpenAIOkHttpClient.kt
+++ b/openai-java-client-okhttp/src/main/kotlin/com/openai/client/okhttp/OpenAIOkHttpClient.kt
@@ -9,11 +9,13 @@ import com.openai.azure.AzureUrlPathMode
import com.openai.client.OpenAIClient
import com.openai.client.OpenAIClientImpl
import com.openai.core.ClientOptions
+import com.openai.core.LogLevel
import com.openai.core.Sleeper
import com.openai.core.Timeout
import com.openai.core.http.AsyncStreamResponse
import com.openai.core.http.Headers
import com.openai.core.http.HttpClient
+import com.openai.core.http.ProxyAuthenticator
import com.openai.core.http.QueryParams
import com.openai.credential.Credential
import java.net.Proxy
@@ -52,6 +54,7 @@ class OpenAIOkHttpClient private constructor() {
private var clientOptions: ClientOptions.Builder = ClientOptions.builder()
private var dispatcherExecutorService: ExecutorService? = null
private var proxy: Proxy? = null
+ private var proxyAuthenticator: ProxyAuthenticator? = null
private var maxIdleConnections: Int? = null
private var keepAliveDuration: Duration? = null
private var sslSocketFactory: SSLSocketFactory? = null
@@ -82,6 +85,20 @@ class OpenAIOkHttpClient private constructor() {
/** Alias for calling [Builder.proxy] with `proxy.orElse(null)`. */
fun proxy(proxy: Optional) = proxy(proxy.getOrNull())
+ /**
+ * Provides credentials when an HTTP proxy responds with `407 Proxy Authentication
+ * Required`.
+ */
+ fun proxyAuthenticator(proxyAuthenticator: ProxyAuthenticator?) = apply {
+ this.proxyAuthenticator = proxyAuthenticator
+ }
+
+ /**
+ * Alias for calling [Builder.proxyAuthenticator] with `proxyAuthenticator.orElse(null)`.
+ */
+ fun proxyAuthenticator(proxyAuthenticator: Optional) =
+ proxyAuthenticator(proxyAuthenticator.getOrNull())
+
/**
* The maximum number of idle connections kept by the underlying OkHttp connection pool.
*
@@ -233,6 +250,9 @@ class OpenAIOkHttpClient private constructor() {
/**
* Whether to call `validate` on every response before returning it.
*
+ * Setting this to `true` is _not_ forwards compatible with new types from the API for
+ * existing fields.
+ *
* Defaults to false, which means the shape of the response will not be validated upfront.
* Instead, validation will only occur for the parts of the response that are accessed.
*/
@@ -274,6 +294,15 @@ class OpenAIOkHttpClient private constructor() {
*/
fun maxRetries(maxRetries: Int) = apply { clientOptions.maxRetries(maxRetries) }
+ /**
+ * The level at which to log request and response information.
+ *
+ * [fromEnv] will set the level from environment variables. See [LogLevel.fromEnv].
+ *
+ * Defaults to [LogLevel.fromEnv].
+ */
+ fun logLevel(logLevel: LogLevel) = apply { clientOptions.logLevel(logLevel) }
+
fun apiKey(apiKey: String?) = apply { clientOptions.apiKey(apiKey) }
/** Alias for calling [Builder.apiKey] with `apiKey.orElse(null)`. */
@@ -419,6 +448,7 @@ class OpenAIOkHttpClient private constructor() {
OkHttpClient.builder()
.timeout(clientOptions.timeout())
.proxy(proxy)
+ .proxyAuthenticator(proxyAuthenticator)
.maxIdleConnections(maxIdleConnections)
.keepAliveDuration(keepAliveDuration)
.dispatcherExecutorService(dispatcherExecutorService)
diff --git a/openai-java-client-okhttp/src/main/kotlin/com/openai/client/okhttp/OpenAIOkHttpClientAsync.kt b/openai-java-client-okhttp/src/main/kotlin/com/openai/client/okhttp/OpenAIOkHttpClientAsync.kt
index e3350fb77..a2756a623 100644
--- a/openai-java-client-okhttp/src/main/kotlin/com/openai/client/okhttp/OpenAIOkHttpClientAsync.kt
+++ b/openai-java-client-okhttp/src/main/kotlin/com/openai/client/okhttp/OpenAIOkHttpClientAsync.kt
@@ -9,11 +9,13 @@ import com.openai.azure.AzureUrlPathMode
import com.openai.client.OpenAIClientAsync
import com.openai.client.OpenAIClientAsyncImpl
import com.openai.core.ClientOptions
+import com.openai.core.LogLevel
import com.openai.core.Sleeper
import com.openai.core.Timeout
import com.openai.core.http.AsyncStreamResponse
import com.openai.core.http.Headers
import com.openai.core.http.HttpClient
+import com.openai.core.http.ProxyAuthenticator
import com.openai.core.http.QueryParams
import com.openai.credential.Credential
import java.net.Proxy
@@ -52,6 +54,7 @@ class OpenAIOkHttpClientAsync private constructor() {
private var clientOptions: ClientOptions.Builder = ClientOptions.builder()
private var dispatcherExecutorService: ExecutorService? = null
private var proxy: Proxy? = null
+ private var proxyAuthenticator: ProxyAuthenticator? = null
private var maxIdleConnections: Int? = null
private var keepAliveDuration: Duration? = null
private var sslSocketFactory: SSLSocketFactory? = null
@@ -82,6 +85,20 @@ class OpenAIOkHttpClientAsync private constructor() {
/** Alias for calling [Builder.proxy] with `proxy.orElse(null)`. */
fun proxy(proxy: Optional) = proxy(proxy.getOrNull())
+ /**
+ * Provides credentials when an HTTP proxy responds with `407 Proxy Authentication
+ * Required`.
+ */
+ fun proxyAuthenticator(proxyAuthenticator: ProxyAuthenticator?) = apply {
+ this.proxyAuthenticator = proxyAuthenticator
+ }
+
+ /**
+ * Alias for calling [Builder.proxyAuthenticator] with `proxyAuthenticator.orElse(null)`.
+ */
+ fun proxyAuthenticator(proxyAuthenticator: Optional) =
+ proxyAuthenticator(proxyAuthenticator.getOrNull())
+
/**
* The maximum number of idle connections kept by the underlying OkHttp connection pool.
*
@@ -233,6 +250,9 @@ class OpenAIOkHttpClientAsync private constructor() {
/**
* Whether to call `validate` on every response before returning it.
*
+ * Setting this to `true` is _not_ forwards compatible with new types from the API for
+ * existing fields.
+ *
* Defaults to false, which means the shape of the response will not be validated upfront.
* Instead, validation will only occur for the parts of the response that are accessed.
*/
@@ -274,6 +294,15 @@ class OpenAIOkHttpClientAsync private constructor() {
*/
fun maxRetries(maxRetries: Int) = apply { clientOptions.maxRetries(maxRetries) }
+ /**
+ * The level at which to log request and response information.
+ *
+ * [fromEnv] will set the level from environment variables. See [LogLevel.fromEnv].
+ *
+ * Defaults to [LogLevel.fromEnv].
+ */
+ fun logLevel(logLevel: LogLevel) = apply { clientOptions.logLevel(logLevel) }
+
fun apiKey(apiKey: String?) = apply { clientOptions.apiKey(apiKey) }
/** Alias for calling [Builder.apiKey] with `apiKey.orElse(null)`. */
@@ -419,6 +448,7 @@ class OpenAIOkHttpClientAsync private constructor() {
OkHttpClient.builder()
.timeout(clientOptions.timeout())
.proxy(proxy)
+ .proxyAuthenticator(proxyAuthenticator)
.maxIdleConnections(maxIdleConnections)
.keepAliveDuration(keepAliveDuration)
.dispatcherExecutorService(dispatcherExecutorService)
diff --git a/openai-java-core/src/main/kotlin/com/openai/auth/WorkloadIdentityAuth.kt b/openai-java-core/src/main/kotlin/com/openai/auth/WorkloadIdentityAuth.kt
index d823a4e6d..1066c3605 100644
--- a/openai-java-core/src/main/kotlin/com/openai/auth/WorkloadIdentityAuth.kt
+++ b/openai-java-core/src/main/kotlin/com/openai/auth/WorkloadIdentityAuth.kt
@@ -2,6 +2,9 @@ package com.openai.auth
import com.fasterxml.jackson.databind.json.JsonMapper
import com.fasterxml.jackson.module.kotlin.jacksonTypeRef
+import com.openai.core.JsonField
+import com.openai.core.JsonMissing
+import com.openai.core.JsonValue
import com.openai.core.handlers.errorHandler
import com.openai.core.http.HttpClient
import com.openai.core.http.HttpMethod
@@ -31,22 +34,31 @@ internal class WorkloadIdentityAuth(
) : AutoCloseable {
private val errorHandler =
errorHandler(
- object : HttpResponse.Handler {
- override fun handle(response: HttpResponse): ErrorObject? =
- try {
- val node = jsonMapper.readTree(response.body())
+ object : HttpResponse.Handler> {
+ override fun handle(response: HttpResponse): JsonField {
+ val node =
+ try {
+ jsonMapper.readTree(response.body())
+ } catch (e: Exception) {
+ return JsonMissing.of()
+ }
+
+ return try {
val errorCode = node.get("error")?.asText()
val errorMessage = node.get("error_description")?.asText() ?: errorCode
- jsonMapper.treeToValue(
- jsonMapper.createObjectNode().apply {
- errorCode?.let { put("code", it) }
- errorMessage?.let { put("message", it) }
- },
- ErrorObject::class.java,
+ JsonField.of(
+ jsonMapper.treeToValue(
+ jsonMapper.createObjectNode().apply {
+ errorCode?.let { put("code", it) }
+ errorMessage?.let { put("message", it) }
+ },
+ ErrorObject::class.java,
+ )
)
} catch (e: Exception) {
- null
+ JsonValue.fromJsonNode(node)
}
+ }
}
)
private val lock = ReentrantLock()
diff --git a/openai-java-core/src/main/kotlin/com/openai/core/ClientOptions.kt b/openai-java-core/src/main/kotlin/com/openai/core/ClientOptions.kt
index ebacbca2f..e1c430085 100644
--- a/openai-java-core/src/main/kotlin/com/openai/core/ClientOptions.kt
+++ b/openai-java-core/src/main/kotlin/com/openai/core/ClientOptions.kt
@@ -12,6 +12,7 @@ import com.openai.azure.credential.AzureApiKeyCredential
import com.openai.core.http.AsyncStreamResponse
import com.openai.core.http.Headers
import com.openai.core.http.HttpClient
+import com.openai.core.http.LoggingHttpClient
import com.openai.core.http.PhantomReachableClosingHttpClient
import com.openai.core.http.QueryParams
import com.openai.core.http.RetryingHttpClient
@@ -90,6 +91,9 @@ private constructor(
/**
* Whether to call `validate` on every response before returning it.
*
+ * Setting this to `true` is _not_ forwards compatible with new types from the API for existing
+ * fields.
+ *
* Defaults to false, which means the shape of the response will not be validated upfront.
* Instead, validation will only occur for the parts of the response that are accessed.
*/
@@ -117,6 +121,14 @@ private constructor(
* Defaults to 2.
*/
@get:JvmName("maxRetries") val maxRetries: Int,
+ /**
+ * The level at which to log request and response information.
+ *
+ * [fromEnv] will set the level from environment variables. See [LogLevel.fromEnv].
+ *
+ * Defaults to [LogLevel.fromEnv].
+ */
+ @get:JvmName("logLevel") val logLevel: LogLevel,
private val apiKey: String?,
private val adminApiKey: String?,
@get:JvmName("credential") val credential: Credential,
@@ -190,6 +202,7 @@ private constructor(
private var responseValidation: Boolean = false
private var timeout: Timeout = Timeout.default()
private var maxRetries: Int = 2
+ private var logLevel: LogLevel = LogLevel.fromEnv()
private var apiKey: String? = null
private var credential: Credential? = null
private var azureServiceVersion: AzureOpenAIServiceVersion? = null
@@ -214,6 +227,7 @@ private constructor(
responseValidation = clientOptions.responseValidation
timeout = clientOptions.timeout
maxRetries = clientOptions.maxRetries
+ logLevel = clientOptions.logLevel
apiKey = clientOptions.apiKey
adminApiKey = clientOptions.adminApiKey
credential = clientOptions.credential.takeUnless { it === AdminApiKeyOnlyCredential }
@@ -301,6 +315,9 @@ private constructor(
/**
* Whether to call `validate` on every response before returning it.
*
+ * Setting this to `true` is _not_ forwards compatible with new types from the API for
+ * existing fields.
+ *
* Defaults to false, which means the shape of the response will not be validated upfront.
* Instead, validation will only occur for the parts of the response that are accessed.
*/
@@ -342,6 +359,15 @@ private constructor(
*/
fun maxRetries(maxRetries: Int) = apply { this.maxRetries = maxRetries }
+ /**
+ * The level at which to log request and response information.
+ *
+ * [fromEnv] will set the level from environment variables. See [LogLevel.fromEnv].
+ *
+ * Defaults to [LogLevel.fromEnv].
+ */
+ fun logLevel(logLevel: LogLevel) = apply { this.logLevel = logLevel }
+
fun apiKey(apiKey: String?) = apply {
this.apiKey = apiKey
this.credential = apiKey?.let { BearerTokenCredential.create(it) }
@@ -523,6 +549,7 @@ private constructor(
* System properties take precedence over environment variables.
*/
fun fromEnv() = apply {
+ logLevel(LogLevel.fromEnv())
(System.getProperty("openai.baseUrl") ?: System.getenv("OPENAI_BASE_URL"))?.let {
baseUrl(it)
}
@@ -650,7 +677,13 @@ private constructor(
val wrappedHttpClient =
RetryingHttpClient.builder()
- .httpClient(workloadIdentityHttpClient)
+ .httpClient(
+ LoggingHttpClient.builder()
+ .httpClient(workloadIdentityHttpClient)
+ .clock(clock)
+ .level(logLevel)
+ .build()
+ )
.sleeper(sleeper)
.clock(clock)
.maxRetries(maxRetries)
@@ -670,6 +703,7 @@ private constructor(
responseValidation,
timeout,
maxRetries,
+ logLevel,
apiKey,
adminApiKey,
credential,
diff --git a/openai-java-core/src/main/kotlin/com/openai/core/JsonSchemaValidator.kt b/openai-java-core/src/main/kotlin/com/openai/core/JsonSchemaValidator.kt
index f0f35422f..4242f73fe 100644
--- a/openai-java-core/src/main/kotlin/com/openai/core/JsonSchemaValidator.kt
+++ b/openai-java-core/src/main/kotlin/com/openai/core/JsonSchemaValidator.kt
@@ -153,7 +153,7 @@ internal class JsonSchemaValidator private constructor() {
private const val MAX_ENUM_TOTAL_STRING_LENGTH = 7_500
/** The maximum depth (number of levels) of nesting allowed in a schema. */
- private const val MAX_NESTING_DEPTH = 5
+ private const val MAX_NESTING_DEPTH = 10
/** The depth value that corresponds to the root level of the schema. */
private const val ROOT_DEPTH = 0
diff --git a/openai-java-core/src/main/kotlin/com/openai/core/LogLevel.kt b/openai-java-core/src/main/kotlin/com/openai/core/LogLevel.kt
new file mode 100644
index 000000000..a3b2fc1e9
--- /dev/null
+++ b/openai-java-core/src/main/kotlin/com/openai/core/LogLevel.kt
@@ -0,0 +1,33 @@
+// File generated from our OpenAPI spec by Stainless.
+
+package com.openai.core
+
+/** The level at which to log request and response information. */
+enum class LogLevel {
+ /** No logging. */
+ OFF,
+ /** Minimal request and response summary logs. No headers or bodies are logged. */
+ INFO,
+ /** [INFO] logs plus details about request failures. */
+ ERROR,
+ /**
+ * Full request and response logs. Sensitive headers are redacted, but sensitive data in request
+ * and response bodies may still be visible.
+ */
+ DEBUG;
+
+ /** Returns whether this level is at or higher than the given [level]. */
+ fun shouldLog(level: LogLevel): Boolean = ordinal >= level.ordinal
+
+ companion object {
+
+ /** Returns a [LogLevel] based on the `OPENAI_LOG` environment variable. */
+ fun fromEnv() =
+ when (System.getenv("OPENAI_LOG")?.lowercase()) {
+ "info" -> INFO
+ "error" -> ERROR
+ "debug" -> DEBUG
+ else -> OFF
+ }
+ }
+}
diff --git a/openai-java-core/src/main/kotlin/com/openai/core/ObjectMappers.kt b/openai-java-core/src/main/kotlin/com/openai/core/ObjectMappers.kt
index a552585ee..4a3133fbd 100644
--- a/openai-java-core/src/main/kotlin/com/openai/core/ObjectMappers.kt
+++ b/openai-java-core/src/main/kotlin/com/openai/core/ObjectMappers.kt
@@ -29,7 +29,9 @@ import java.time.ZoneId
import java.time.format.DateTimeFormatter
import java.time.temporal.ChronoField
-fun jsonMapper(): JsonMapper =
+fun jsonMapper(): JsonMapper = JSON_MAPPER
+
+private val JSON_MAPPER: JsonMapper =
JsonMapper.builder()
.addModule(kotlinModule())
.addModule(Jdk8Module())
diff --git a/openai-java-core/src/main/kotlin/com/openai/core/RequestOptions.kt b/openai-java-core/src/main/kotlin/com/openai/core/RequestOptions.kt
index 1d97b7bba..bf5b28b09 100644
--- a/openai-java-core/src/main/kotlin/com/openai/core/RequestOptions.kt
+++ b/openai-java-core/src/main/kotlin/com/openai/core/RequestOptions.kt
@@ -33,6 +33,15 @@ class RequestOptions private constructor(val responseValidation: Boolean?, val t
private var responseValidation: Boolean? = null
private var timeout: Timeout? = null
+ /**
+ * Whether to call `validate` on the response before returning it.
+ *
+ * Setting this to `true` is _not_ forwards compatible with new types from the API for
+ * existing fields.
+ *
+ * Defaults to false, which means the shape of the response will not be validated upfront.
+ * Instead, validation will only occur for the parts of the response that are accessed.
+ */
fun responseValidation(responseValidation: Boolean) = apply {
this.responseValidation = responseValidation
}
diff --git a/openai-java-core/src/main/kotlin/com/openai/core/Utils.kt b/openai-java-core/src/main/kotlin/com/openai/core/Utils.kt
index 5edcc31b9..14744d521 100644
--- a/openai-java-core/src/main/kotlin/com/openai/core/Utils.kt
+++ b/openai-java-core/src/main/kotlin/com/openai/core/Utils.kt
@@ -5,6 +5,7 @@ package com.openai.core
import com.openai.errors.OpenAIInvalidDataException
import java.util.Collections
import java.util.SortedMap
+import java.util.SortedSet
import java.util.concurrent.CompletableFuture
import java.util.concurrent.locks.Lock
@@ -16,6 +17,11 @@ internal fun T?.getOrThrow(name: String): T =
internal fun List.toImmutable(): List =
if (isEmpty()) Collections.emptyList() else Collections.unmodifiableList(toList())
+@JvmSynthetic
+internal fun > SortedSet.toImmutable(): SortedSet =
+ if (isEmpty()) Collections.emptySortedSet()
+ else Collections.unmodifiableSortedSet(toSortedSet(comparator() ?: Comparator.naturalOrder()))
+
@JvmSynthetic
internal fun Map.toImmutable(): Map =
if (isEmpty()) immutableEmptyMap() else Collections.unmodifiableMap(toMap())
diff --git a/openai-java-core/src/main/kotlin/com/openai/core/handlers/ErrorHandler.kt b/openai-java-core/src/main/kotlin/com/openai/core/handlers/ErrorHandler.kt
index 1748c1b7d..6d6ee571c 100644
--- a/openai-java-core/src/main/kotlin/com/openai/core/handlers/ErrorHandler.kt
+++ b/openai-java-core/src/main/kotlin/com/openai/core/handlers/ErrorHandler.kt
@@ -7,6 +7,9 @@ package com.openai.core.handlers
import com.fasterxml.jackson.databind.JsonNode
import com.fasterxml.jackson.databind.json.JsonMapper
import com.fasterxml.jackson.module.kotlin.jacksonTypeRef
+import com.openai.core.JsonField
+import com.openai.core.JsonMissing
+import com.openai.core.JsonValue
import com.openai.core.http.HttpResponse
import com.openai.core.http.HttpResponse.Handler
import com.openai.errors.BadRequestException
@@ -20,23 +23,26 @@ import com.openai.errors.UnprocessableEntityException
import com.openai.models.ErrorObject
@JvmSynthetic
-internal fun errorBodyHandler(jsonMapper: JsonMapper): Handler {
+internal fun errorBodyHandler(jsonMapper: JsonMapper): Handler> {
val handler = jsonHandler(jsonMapper)
- return object : Handler {
- override fun handle(response: HttpResponse): ErrorObject? =
+ return object : Handler> {
+ override fun handle(response: HttpResponse): JsonField =
try {
- handler.handle(response).get("error")?.let {
- jsonMapper.readerFor(jacksonTypeRef()).readValue(it)
- }
+ val node = handler.handle(response)
+ node.get("error")?.let {
+ jsonMapper.readerFor(jacksonTypeRef>()).readValue(it)
+ } ?: JsonValue.fromJsonNode(node)
} catch (e: Exception) {
- null
+ JsonMissing.of()
}
}
}
@JvmSynthetic
-internal fun errorHandler(errorBodyHandler: Handler): Handler =
+internal fun errorHandler(
+ errorBodyHandler: Handler>
+): Handler =
object : Handler {
override fun handle(response: HttpResponse): HttpResponse =
when (val statusCode = response.statusCode()) {
diff --git a/openai-java-core/src/main/kotlin/com/openai/core/handlers/SseHandler.kt b/openai-java-core/src/main/kotlin/com/openai/core/handlers/SseHandler.kt
index 5a0a5ebc0..8907903cc 100644
--- a/openai-java-core/src/main/kotlin/com/openai/core/handlers/SseHandler.kt
+++ b/openai-java-core/src/main/kotlin/com/openai/core/handlers/SseHandler.kt
@@ -7,6 +7,8 @@ package com.openai.core.handlers
import com.fasterxml.jackson.databind.JsonNode
import com.fasterxml.jackson.databind.json.JsonMapper
import com.fasterxml.jackson.module.kotlin.jacksonTypeRef
+import com.openai.core.JsonField
+import com.openai.core.JsonMissing
import com.openai.core.http.HttpResponse
import com.openai.core.http.HttpResponse.Handler
import com.openai.core.http.SseMessage
@@ -48,10 +50,10 @@ internal fun sseHandler(jsonMapper: JsonMapper): Handler())
- .readValue(it)
+ .readerFor(jacksonTypeRef>())
+ .readValue>(it)
} catch (e: Exception) {
- null
+ JsonMissing.of()
}
)
.build()
diff --git a/openai-java-core/src/main/kotlin/com/openai/core/http/LoggingHttpClient.kt b/openai-java-core/src/main/kotlin/com/openai/core/http/LoggingHttpClient.kt
new file mode 100644
index 000000000..464a6f690
--- /dev/null
+++ b/openai-java-core/src/main/kotlin/com/openai/core/http/LoggingHttpClient.kt
@@ -0,0 +1,628 @@
+// File generated from our OpenAPI spec by Stainless.
+
+package com.openai.core.http
+
+import com.openai.core.LogLevel
+import com.openai.core.RequestOptions
+import com.openai.core.checkRequired
+import com.openai.core.toImmutable
+import java.io.ByteArrayOutputStream
+import java.io.InputStream
+import java.io.OutputStream
+import java.nio.ByteBuffer
+import java.nio.charset.CharacterCodingException
+import java.nio.charset.Charset
+import java.nio.charset.CharsetDecoder
+import java.nio.charset.CodingErrorAction
+import java.nio.charset.StandardCharsets
+import java.time.Clock
+import java.time.Duration
+import java.time.OffsetDateTime
+import java.util.SortedSet
+import java.util.concurrent.CompletableFuture
+import java.util.concurrent.CompletionException
+import kotlin.time.toKotlinDuration
+
+/** A wrapper [HttpClient] around [httpClient] that logs request and response information. */
+class LoggingHttpClient
+private constructor(
+ /** The underlying [HttpClient] for making requests. */
+ @get:JvmName("httpClient") val httpClient: HttpClient,
+ /**
+ * Sensitive headers to redact from logs.
+ *
+ * Defaults to `Set.of("authorization", "api-key", "x-api-key", "cookie", "set-cookie")`.
+ */
+ @get:JvmName("redactedHeaders") val redactedHeaders: SortedSet,
+ /**
+ * The clock to use for measuring request and response durations.
+ *
+ * This is primarily useful for using a fake clock in tests.
+ *
+ * Defaults to [Clock.systemUTC].
+ */
+ @get:JvmName("clock") val clock: Clock,
+ /**
+ * The log level to use.
+ *
+ * Pass [LogLevel.fromEnv] to read from environment variables.
+ */
+ @get:JvmName("level") val level: LogLevel,
+) : HttpClient {
+
+ override fun execute(request: HttpRequest, requestOptions: RequestOptions): HttpResponse {
+ val loggingRequest = logRequest(request)
+
+ val before = OffsetDateTime.now(clock)
+ val response =
+ try {
+ httpClient.execute(loggingRequest, requestOptions)
+ } catch (e: Throwable) {
+ logFailure(e, Duration.between(before, OffsetDateTime.now(clock)))
+ throw e
+ }
+
+ val took = Duration.between(before, OffsetDateTime.now(clock))
+ return logResponse(response, took)
+ }
+
+ override fun executeAsync(
+ request: HttpRequest,
+ requestOptions: RequestOptions,
+ ): CompletableFuture {
+ val loggingRequest = logRequest(request)
+
+ val before = OffsetDateTime.now(clock)
+ val future =
+ try {
+ httpClient.executeAsync(loggingRequest, requestOptions)
+ } catch (e: Throwable) {
+ logFailure(e, Duration.between(before, OffsetDateTime.now(clock)))
+ throw e
+ }
+ return future.handle { response, error ->
+ val took = Duration.between(before, OffsetDateTime.now(clock))
+ if (error != null) {
+ logFailure(unwrapCompletionException(error), took)
+ throw error
+ }
+ logResponse(response, took)
+ }
+ }
+
+ private fun logRequest(request: HttpRequest): HttpRequest {
+ if (!level.shouldLog(LogLevel.INFO)) {
+ return request
+ }
+
+ System.err.println(
+ buildString {
+ append("--> ${request.method} ${request.url()}")
+ request.body?.let {
+ val length = it.contentLength()
+ append(if (length >= 0) " ($length-byte body)" else " (unknown-length body)")
+ }
+ }
+ )
+
+ if (!level.shouldLog(LogLevel.DEBUG)) {
+ return request
+ }
+
+ logHeaders(request.headers)
+
+ if (request.body == null) {
+ System.err.println("--> END ${request.method}")
+ System.err.println()
+ return request
+ }
+
+ return request
+ .toBuilder()
+ .body(LoggingHttpRequestBody(request.method, request.body))
+ .build()
+ }
+
+ private fun logResponse(response: HttpResponse, took: Duration): HttpResponse {
+ if (!level.shouldLog(LogLevel.INFO)) {
+ return response
+ }
+
+ val contentLength = response.headers().values("Content-Length").firstOrNull()?.toIntOrNull()
+ System.err.println(
+ "<-- ${response.statusCode()} (${
+ buildString {
+ append(took.format())
+ contentLength?.let { append(", $contentLength-byte body") }
+ }
+ })"
+ )
+
+ if (!level.shouldLog(LogLevel.DEBUG)) {
+ return response
+ }
+
+ logHeaders(response.headers())
+ return LoggingHttpResponse(response)
+ }
+
+ private fun logFailure(error: Throwable, took: Duration) {
+ if (!level.shouldLog(LogLevel.ERROR)) {
+ return
+ }
+
+ System.err.println(
+ buildString {
+ append("<-- !! ${error.javaClass.simpleName}")
+ error.message?.let { append(": $it") }
+ append(" (${took.format()})")
+ }
+ )
+ }
+
+ private fun unwrapCompletionException(error: Throwable): Throwable =
+ if (error is CompletionException && error.cause != null) error.cause!! else error
+
+ private fun logHeaders(headers: Headers) =
+ headers.names().forEach { name ->
+ headers.values(name).forEach { value ->
+ System.err.println("$name: ${if (redactedHeaders.contains(name)) "██" else value}")
+ }
+ }
+
+ override fun close() = httpClient.close()
+
+ fun toBuilder() = Builder().from(this)
+
+ companion object {
+
+ /**
+ * Returns a mutable builder for constructing an instance of [LoggingHttpClient].
+ *
+ * The following fields are required:
+ * ```java
+ * .httpClient()
+ * .level()
+ * ```
+ */
+ @JvmStatic fun builder() = Builder()
+ }
+
+ /** A builder for [LoggingHttpClient]. */
+ class Builder internal constructor() {
+
+ private var httpClient: HttpClient? = null
+ private var redactedHeaders: Set =
+ setOf("authorization", "api-key", "x-api-key", "cookie", "set-cookie")
+ private var clock: Clock = Clock.systemUTC()
+ private var level: LogLevel? = null
+
+ @JvmSynthetic
+ internal fun from(loggingHttpClient: LoggingHttpClient) = apply {
+ httpClient = loggingHttpClient.httpClient
+ redactedHeaders = loggingHttpClient.redactedHeaders
+ clock = loggingHttpClient.clock
+ level = loggingHttpClient.level
+ }
+
+ /** The underlying [HttpClient] for making requests. */
+ fun httpClient(httpClient: HttpClient) = apply { this.httpClient = httpClient }
+
+ /**
+ * Sensitive headers to redact from logs.
+ *
+ * Defaults to `Set.of("authorization", "api-key", "x-api-key", "cookie", "set-cookie")`.
+ */
+ fun redactedHeaders(redactedHeaders: Set) = apply {
+ this.redactedHeaders = redactedHeaders
+ }
+
+ /**
+ * The clock to use for measuring request and response durations.
+ *
+ * This is primarily useful for using a fake clock in tests.
+ *
+ * Defaults to [Clock.systemUTC].
+ */
+ fun clock(clock: Clock) = apply { this.clock = clock }
+
+ /**
+ * The log level to use.
+ *
+ * Pass [LogLevel.fromEnv] to read from environment variables.
+ */
+ fun level(level: LogLevel) = apply { this.level = level }
+
+ /**
+ * Returns an immutable instance of [LoggingHttpClient].
+ *
+ * Further updates to this [Builder] will not mutate the returned instance.
+ *
+ * The following fields are required:
+ * ```java
+ * .httpClient()
+ * .level()
+ * ```
+ *
+ * @throws IllegalStateException if any required field is unset.
+ */
+ fun build(): LoggingHttpClient =
+ LoggingHttpClient(
+ checkRequired("httpClient", httpClient),
+ redactedHeaders.toSortedSet(String.CASE_INSENSITIVE_ORDER).toImmutable(),
+ clock,
+ checkRequired("level", level),
+ )
+ }
+}
+
+/**
+ * An [HttpRequestBody] wrapper that delegates to [body] while also logging line by line as it's
+ * written.
+ *
+ * The logging occurs in a streaming manner with minimal buffering.
+ */
+private class LoggingHttpRequestBody(
+ private val method: HttpMethod,
+ private val body: HttpRequestBody,
+) : HttpRequestBody {
+
+ private val charset by lazy { parseCharset(body.contentType()) }
+
+ override fun writeTo(outputStream: OutputStream) {
+ val loggingOutputStream = LoggingOutputStream(outputStream, charset)
+ body.writeTo(loggingOutputStream)
+
+ loggingOutputStream.flush()
+ System.err.println("--> END $method (${loggingOutputStream.writeCount()}-byte body)")
+ System.err.println()
+ }
+
+ override fun contentType(): String? = body.contentType()
+
+ override fun contentLength(): Long = body.contentLength()
+
+ override fun repeatable(): Boolean = body.repeatable()
+
+ override fun close() = body.close()
+}
+
+/**
+ * An [OutputStream] wrapper that delegates to [outputStream] while also logging bytes line by line
+ * as it's written to.
+ *
+ * The written content is assumed to be in the given [charset] and the logging occurs in a streaming
+ * manner with minimal buffering.
+ */
+private class LoggingOutputStream(private val outputStream: OutputStream, charset: Charset?) :
+ OutputStream() {
+
+ private val buffer = LoggingBuffer(charset)
+
+ fun writeCount() = buffer.writeCount()
+
+ override fun write(b: Int) {
+ outputStream.write(b)
+ buffer.write(b)
+ }
+
+ override fun write(b: ByteArray, off: Int, len: Int) {
+ outputStream.write(b, off, len)
+ for (i in off until off + len) {
+ buffer.write(b[i].toInt() and 0xFF)
+ }
+ }
+
+ /** Prints any currently buffered content. */
+ override fun flush() {
+ buffer.flush()
+ outputStream.flush()
+ }
+
+ override fun close() = outputStream.close()
+}
+
+/**
+ * An [HttpResponse] wrapper that delegates to [response] while also logging line-by-line as it's
+ * read.
+ *
+ * The logging occurs in a streaming manner with minimal buffering.
+ */
+private class LoggingHttpResponse(private val response: HttpResponse) : HttpResponse {
+
+ private val loggingBody: Lazy = lazy {
+ LoggingInputStream(
+ response.body(),
+ parseCharset(response.headers().values("Content-Type").firstOrNull()),
+ )
+ }
+
+ override fun statusCode(): Int = response.statusCode()
+
+ override fun headers(): Headers = response.headers()
+
+ override fun body(): InputStream = loggingBody.value
+
+ override fun close() {
+ if (loggingBody.isInitialized()) {
+ loggingBody.value.close()
+ }
+ response.close()
+ }
+}
+
+/**
+ * An [InputStream] wrapper that delegates to [inputStream] while also logging bytes line by line as
+ * it's read.
+ *
+ * The contents of [inputStream] are assumed to be in the given [charset] and the logging occurs in
+ * a streaming manner with minimal buffering.
+ */
+private class LoggingInputStream(private val inputStream: InputStream, charset: Charset?) :
+ InputStream() {
+
+ private var isDone = false
+ private val buffer = LoggingBuffer(charset)
+
+ override fun read(): Int {
+ if (isDone) {
+ return -1
+ }
+
+ val b = inputStream.read()
+
+ if (b == -1) {
+ markDone()
+ return b
+ }
+
+ buffer.write(b)
+ return b
+ }
+
+ override fun read(b: ByteArray, off: Int, len: Int): Int {
+ if (isDone) {
+ return -1
+ }
+
+ val bytesRead = inputStream.read(b, off, len)
+
+ if (bytesRead == -1) {
+ markDone()
+ return bytesRead
+ }
+
+ for (i in off until off + bytesRead) {
+ buffer.write(b[i].toInt() and 0xFF)
+ }
+ return bytesRead
+ }
+
+ override fun close() {
+ if (!isDone) {
+ markDone(closedEarly = true)
+ }
+ inputStream.close()
+ }
+
+ private fun markDone(closedEarly: Boolean = false) {
+ isDone = true
+ buffer.flush()
+ val suffix = if (closedEarly) ", closed early" else ""
+ System.err.println("<-- END HTTP (${buffer.writeCount()}-byte body$suffix)")
+ System.err.println()
+ }
+}
+
+/**
+ * A byte buffer that prints line by line, using the given [charset], as bytes are written to it.
+ *
+ * When [charset] is `null`, the buffer performs an upfront check to detect binary content. If
+ * non-whitespace ISO control characters are found in the first [PROBABLY_UTF8_CODE_POINT_LIMIT]
+ * code points, body logging is suppressed entirely.
+ */
+private class LoggingBuffer(charset: Charset?) {
+
+ private val charset = charset ?: StandardCharsets.UTF_8
+
+ private val decoder: CharsetDecoder =
+ this.charset
+ .newDecoder()
+ .onMalformedInput(CodingErrorAction.REPORT)
+ .onUnmappableCharacter(CodingErrorAction.REPORT)
+ private var writeCount = 0
+ private val buffer = ByteArrayOutputStream(128)
+
+ /**
+ * Whether logging has been suppressed because the content doesn't appear to be readable text.
+ *
+ * This is only set when [charset] is `null` and the content fails the [isProbablyUtf8] check.
+ */
+ private var suppressed = false
+
+ /**
+ * Bytes accumulated for the [isProbablyUtf8] check before any lines are printed.
+ *
+ * Once the check passes (or [charset] is non-null), this is set to `null` and bytes flow
+ * directly to [buffer].
+ */
+ private var prefetchBuffer: ByteArrayOutputStream? =
+ if (charset != null) null else ByteArrayOutputStream(128)
+
+ fun writeCount() = writeCount
+
+ fun write(b: Int) {
+ if (writeCount == 0) {
+ // Print a newline before we start printing anything to separate the printed content
+ // from previous content.
+ System.err.println()
+ }
+
+ writeCount++
+
+ if (suppressed) {
+ return
+ }
+
+ val prefetch = prefetchBuffer
+ if (prefetch != null) {
+ prefetch.write(b)
+ // Continue accumulating until we have enough bytes to decide.
+ if (prefetch.size() < PROBABLY_UTF8_BYTE_LIMIT && b != '\n'.code) {
+ return
+ }
+ // We have enough bytes. Check if the content is probably UTF-8.
+ prefetchBuffer = null
+ val bytes = prefetch.toByteArray()
+ if (!isProbablyUtf8(bytes)) {
+ suppressed = true
+ System.err.println("(binary body omitted)")
+ return
+ }
+ // Content looks like UTF-8. Feed the accumulated bytes into the normal buffer.
+ for (byte in bytes) {
+ writeToBuffer(byte.toInt() and 0xFF)
+ }
+ return
+ }
+
+ writeToBuffer(b)
+ }
+
+ private fun writeToBuffer(b: Int) {
+ if (b == '\n'.code) {
+ flush()
+ return
+ }
+
+ buffer.write(b)
+ }
+
+ /** Prints any currently buffered content. */
+ fun flush() {
+ if (suppressed) {
+ return
+ }
+
+ // If we still have a prefetch buffer when flush is called (body was shorter than the
+ // limit), run the check now.
+ val prefetch = prefetchBuffer
+ if (prefetch != null) {
+ prefetchBuffer = null
+ val bytes = prefetch.toByteArray()
+ if (bytes.isEmpty()) {
+ return
+ }
+ if (!isProbablyUtf8(bytes)) {
+ suppressed = true
+ System.err.println("(binary body omitted)")
+ return
+ }
+ for (byte in bytes) {
+ writeToBuffer(byte.toInt() and 0xFF)
+ }
+ }
+
+ if (buffer.size() == 0) {
+ return
+ }
+
+ val line =
+ try {
+ decoder.decode(ByteBuffer.wrap(buffer.toByteArray()))
+ } catch (e: CharacterCodingException) {
+ "(omitted line is not valid $charset)"
+ }
+ buffer.reset()
+ System.err.println(line)
+ }
+}
+
+/** The maximum number of code points to sample when checking if content is probably UTF-8. */
+private const val PROBABLY_UTF8_CODE_POINT_LIMIT = 64
+
+/**
+ * The maximum number of bytes to accumulate before running the [isProbablyUtf8] check. UTF-8 code
+ * points are at most 4 bytes, so this accommodates [PROBABLY_UTF8_CODE_POINT_LIMIT] code points.
+ */
+private const val PROBABLY_UTF8_BYTE_LIMIT = PROBABLY_UTF8_CODE_POINT_LIMIT * 4
+
+/**
+ * Returns `true` if the given [bytes] probably contain human-readable UTF-8 text.
+ *
+ * Decodes up to [PROBABLY_UTF8_CODE_POINT_LIMIT] code points and returns `false` if any
+ * non-whitespace ISO control characters are found, or if the bytes are not valid UTF-8.
+ */
+private fun isProbablyUtf8(bytes: ByteArray): Boolean {
+ try {
+ val decoder =
+ StandardCharsets.UTF_8.newDecoder()
+ .onMalformedInput(CodingErrorAction.REPORT)
+ .onUnmappableCharacter(CodingErrorAction.REPORT)
+ val charBuffer = decoder.decode(ByteBuffer.wrap(bytes))
+ var codePointCount = 0
+ var i = 0
+ while (i < charBuffer.length && codePointCount < PROBABLY_UTF8_CODE_POINT_LIMIT) {
+ val codePoint = Character.codePointAt(charBuffer, i)
+ if (Character.isISOControl(codePoint) && !Character.isWhitespace(codePoint)) {
+ return false
+ }
+ i += Character.charCount(codePoint)
+ codePointCount++
+ }
+ return true
+ } catch (e: CharacterCodingException) {
+ return false
+ }
+}
+
+/** Returns the [Charset] in the given [contentType] string, or `null` if unspecified. */
+private fun parseCharset(contentType: String?): Charset? =
+ contentType
+ ?.split(";")
+ ?.drop(1)
+ ?.map { it.trim() }
+ ?.firstOrNull { it.startsWith("charset=", ignoreCase = true) }
+ ?.substringAfter("=")
+ ?.trim()
+ ?.removeSurrounding("\"")
+ ?.let { runCatching { charset(it) }.getOrNull() }
+
+/** Formats the [Duration] into a string like "1m 40s 467ms". */
+private fun Duration.format(): String =
+ toKotlinDuration().toComponents { days, hours, minutes, seconds, nanoseconds ->
+ buildString {
+ val milliseconds = nanoseconds / 1_000_000
+ if (days > 0) {
+ append("${days}d")
+ }
+ if (hours > 0) {
+ if (isNotEmpty()) {
+ append(" ")
+ }
+ append("${hours}h")
+ }
+ if (minutes > 0) {
+ if (isNotEmpty()) {
+ append(" ")
+ }
+ append("${minutes}m")
+ }
+ if (seconds > 0) {
+ if (isNotEmpty()) {
+ append(" ")
+ }
+ append("${seconds}s")
+ }
+ if (milliseconds > 0) {
+ if (isNotEmpty()) {
+ append(" ")
+ }
+ append("${milliseconds}ms")
+ }
+
+ if (isEmpty()) {
+ append("0s")
+ }
+ }
+ }
diff --git a/openai-java-core/src/main/kotlin/com/openai/core/http/ProxyAuthenticator.kt b/openai-java-core/src/main/kotlin/com/openai/core/http/ProxyAuthenticator.kt
new file mode 100644
index 000000000..254976690
--- /dev/null
+++ b/openai-java-core/src/main/kotlin/com/openai/core/http/ProxyAuthenticator.kt
@@ -0,0 +1,59 @@
+package com.openai.core.http
+
+import java.net.Proxy
+import java.nio.charset.Charset
+import java.nio.charset.StandardCharsets
+import java.util.Base64
+import java.util.Optional
+
+/**
+ * Provides credentials when an HTTP proxy responds with `407 Proxy Authentication Required`.
+ *
+ * Implementations inspect the 407 [response] (typically its `Proxy-Authenticate` header) and return
+ * the request to retry with a `Proxy-Authorization` header set, or [Optional.empty] to abandon
+ * authentication and surface the 407 to the caller.
+ *
+ * Implementations must be thread-safe; they may be invoked concurrently from multiple HTTP calls.
+ */
+fun interface ProxyAuthenticator {
+
+ /**
+ * @param proxy the proxy that produced the challenge, or [Proxy.NO_PROXY] if the route is not
+ * yet established
+ * @param request the request that produced [response]
+ * @param response the 407 challenge response
+ * @return the retry request to send (typically [request] with a `Proxy-Authorization` header
+ * added), or [Optional.empty] to abandon authentication
+ */
+ fun authenticate(
+ proxy: Proxy,
+ request: HttpRequest,
+ response: HttpResponse,
+ ): Optional
+
+ companion object {
+
+ /**
+ * A [ProxyAuthenticator] that uses RFC 7617 Basic authentication with the ISO-8859-1
+ * charset.
+ */
+ @JvmStatic
+ fun basic(username: String, password: String): ProxyAuthenticator =
+ basic(username, password, StandardCharsets.ISO_8859_1)
+
+ /**
+ * A [ProxyAuthenticator] that uses RFC 7617 Basic authentication with the given [charset].
+ */
+ @JvmStatic
+ fun basic(username: String, password: String, charset: Charset): ProxyAuthenticator {
+ val token =
+ Base64.getEncoder().encodeToString("$username:$password".toByteArray(charset))
+ val headerValue = "Basic $token"
+ return ProxyAuthenticator { _, request, _ ->
+ Optional.of(
+ request.toBuilder().putHeader("Proxy-Authorization", headerValue).build()
+ )
+ }
+ }
+ }
+}
diff --git a/openai-java-core/src/main/kotlin/com/openai/errors/BadRequestException.kt b/openai-java-core/src/main/kotlin/com/openai/errors/BadRequestException.kt
index bf233b5aa..7bdb7f4cb 100644
--- a/openai-java-core/src/main/kotlin/com/openai/errors/BadRequestException.kt
+++ b/openai-java-core/src/main/kotlin/com/openai/errors/BadRequestException.kt
@@ -2,6 +2,7 @@
package com.openai.errors
+import com.openai.core.JsonField
import com.openai.core.JsonMissing
import com.openai.core.JsonValue
import com.openai.core.checkRequired
@@ -14,20 +15,27 @@ import kotlin.jvm.optionals.getOrNull
class BadRequestException
private constructor(
private val headers: Headers,
- private val error: ErrorObject?,
+ private val error: JsonField,
cause: Throwable?,
-) : OpenAIServiceException("400: ${error?._message()}", cause) {
+) :
+ OpenAIServiceException(
+ "400: ${error.asKnown().getOrNull()?._message()?.asKnown()?.getOrNull() ?: (if (error.isMissing()) "Unknown" else jsonMapper().writeValueAsString(error))}",
+ cause,
+ ) {
override fun statusCode(): Int = 400
override fun body(): JsonValue =
- error?.let { JsonValue.fromJsonNode(jsonMapper().valueToTree(it)) } ?: JsonMissing.of()
+ if (error.isMissing()) JsonMissing.of()
+ else JsonValue.fromJsonNode(jsonMapper().valueToTree(error))
- override fun code(): Optional = Optional.ofNullable(error?.code()?.getOrNull())
+ override fun code(): Optional =
+ Optional.ofNullable(error.asKnown().getOrNull()?.code()?.getOrNull())
- override fun param(): Optional = Optional.ofNullable(error?.param()?.getOrNull())
+ override fun param(): Optional =
+ Optional.ofNullable(error.asKnown().getOrNull()?.param()?.getOrNull())
- override fun type(): Optional = Optional.ofNullable(error?.type())
+ override fun type(): Optional = Optional.ofNullable(error.asKnown().getOrNull()?.type())
override fun headers(): Headers = headers
@@ -50,7 +58,7 @@ private constructor(
class Builder internal constructor() {
private var headers: Headers? = null
- private var error: ErrorObject? = null
+ private var error: JsonField = JsonMissing.of()
private var cause: Throwable? = null
@JvmSynthetic
@@ -62,11 +70,13 @@ private constructor(
fun headers(headers: Headers) = apply { this.headers = headers }
- fun error(error: ErrorObject?) = apply { this.error = error }
+ fun error(error: ErrorObject?) = error(JsonField.ofNullable(error))
/** Alias for calling [Builder.error] with `error.orElse(null)`. */
fun error(error: Optional) = error(error.getOrNull())
+ fun error(error: JsonField) = apply { this.error = error }
+
fun cause(cause: Throwable?) = apply { this.cause = cause }
/** Alias for calling [Builder.cause] with `cause.orElse(null)`. */
diff --git a/openai-java-core/src/main/kotlin/com/openai/errors/InternalServerException.kt b/openai-java-core/src/main/kotlin/com/openai/errors/InternalServerException.kt
index 63e27034d..d573588d4 100644
--- a/openai-java-core/src/main/kotlin/com/openai/errors/InternalServerException.kt
+++ b/openai-java-core/src/main/kotlin/com/openai/errors/InternalServerException.kt
@@ -2,6 +2,7 @@
package com.openai.errors
+import com.openai.core.JsonField
import com.openai.core.JsonMissing
import com.openai.core.JsonValue
import com.openai.core.checkRequired
@@ -15,18 +16,25 @@ class InternalServerException
private constructor(
private val statusCode: Int,
private val headers: Headers,
- private val error: ErrorObject?,
+ private val error: JsonField,
cause: Throwable?,
-) : OpenAIServiceException("$statusCode: ${error?._message()}", cause) {
+) :
+ OpenAIServiceException(
+ "$statusCode: ${error.asKnown().getOrNull()?._message()?.asKnown()?.getOrNull() ?: (if (error.isMissing()) "Unknown" else jsonMapper().writeValueAsString(error))}",
+ cause,
+ ) {
override fun body(): JsonValue =
- error?.let { JsonValue.fromJsonNode(jsonMapper().valueToTree(it)) } ?: JsonMissing.of()
+ if (error.isMissing()) JsonMissing.of()
+ else JsonValue.fromJsonNode(jsonMapper().valueToTree(error))
- override fun code(): Optional = Optional.ofNullable(error?.code()?.getOrNull())
+ override fun code(): Optional =
+ Optional.ofNullable(error.asKnown().getOrNull()?.code()?.getOrNull())
- override fun param(): Optional = Optional.ofNullable(error?.param()?.getOrNull())
+ override fun param(): Optional =
+ Optional.ofNullable(error.asKnown().getOrNull()?.param()?.getOrNull())
- override fun type(): Optional = Optional.ofNullable(error?.type())
+ override fun type(): Optional = Optional.ofNullable(error.asKnown().getOrNull()?.type())
override fun statusCode(): Int = statusCode
@@ -53,7 +61,7 @@ private constructor(
private var statusCode: Int? = null
private var headers: Headers? = null
- private var error: ErrorObject? = null
+ private var error: JsonField = JsonMissing.of()
private var cause: Throwable? = null
@JvmSynthetic
@@ -68,11 +76,13 @@ private constructor(
fun headers(headers: Headers) = apply { this.headers = headers }
- fun error(error: ErrorObject?) = apply { this.error = error }
+ fun error(error: ErrorObject?) = error(JsonField.ofNullable(error))
/** Alias for calling [Builder.error] with `error.orElse(null)`. */
fun error(error: Optional) = error(error.getOrNull())
+ fun error(error: JsonField) = apply { this.error = error }
+
fun cause(cause: Throwable?) = apply { this.cause = cause }
/** Alias for calling [Builder.cause] with `cause.orElse(null)`. */
diff --git a/openai-java-core/src/main/kotlin/com/openai/errors/NotFoundException.kt b/openai-java-core/src/main/kotlin/com/openai/errors/NotFoundException.kt
index bc4ae60d5..457b0503c 100644
--- a/openai-java-core/src/main/kotlin/com/openai/errors/NotFoundException.kt
+++ b/openai-java-core/src/main/kotlin/com/openai/errors/NotFoundException.kt
@@ -2,6 +2,7 @@
package com.openai.errors
+import com.openai.core.JsonField
import com.openai.core.JsonMissing
import com.openai.core.JsonValue
import com.openai.core.checkRequired
@@ -14,20 +15,27 @@ import kotlin.jvm.optionals.getOrNull
class NotFoundException
private constructor(
private val headers: Headers,
- private val error: ErrorObject?,
+ private val error: JsonField,
cause: Throwable?,
-) : OpenAIServiceException("404: ${error?._message()}", cause) {
+) :
+ OpenAIServiceException(
+ "404: ${error.asKnown().getOrNull()?._message()?.asKnown()?.getOrNull() ?: (if (error.isMissing()) "Unknown" else jsonMapper().writeValueAsString(error))}",
+ cause,
+ ) {
override fun statusCode(): Int = 404
override fun body(): JsonValue =
- error?.let { JsonValue.fromJsonNode(jsonMapper().valueToTree(it)) } ?: JsonMissing.of()
+ if (error.isMissing()) JsonMissing.of()
+ else JsonValue.fromJsonNode(jsonMapper().valueToTree(error))
- override fun code(): Optional = Optional.ofNullable(error?.code()?.getOrNull())
+ override fun code(): Optional =
+ Optional.ofNullable(error.asKnown().getOrNull()?.code()?.getOrNull())
- override fun param(): Optional = Optional.ofNullable(error?.param()?.getOrNull())
+ override fun param(): Optional =
+ Optional.ofNullable(error.asKnown().getOrNull()?.param()?.getOrNull())
- override fun type(): Optional = Optional.ofNullable(error?.type())
+ override fun type(): Optional = Optional.ofNullable(error.asKnown().getOrNull()?.type())
override fun headers(): Headers = headers
@@ -50,7 +58,7 @@ private constructor(
class Builder internal constructor() {
private var headers: Headers? = null
- private var error: ErrorObject? = null
+ private var error: JsonField = JsonMissing.of()
private var cause: Throwable? = null
@JvmSynthetic
@@ -62,11 +70,13 @@ private constructor(
fun headers(headers: Headers) = apply { this.headers = headers }
- fun error(error: ErrorObject?) = apply { this.error = error }
+ fun error(error: ErrorObject?) = error(JsonField.ofNullable(error))
/** Alias for calling [Builder.error] with `error.orElse(null)`. */
fun error(error: Optional) = error(error.getOrNull())
+ fun error(error: JsonField) = apply { this.error = error }
+
fun cause(cause: Throwable?) = apply { this.cause = cause }
/** Alias for calling [Builder.cause] with `cause.orElse(null)`. */
diff --git a/openai-java-core/src/main/kotlin/com/openai/errors/PermissionDeniedException.kt b/openai-java-core/src/main/kotlin/com/openai/errors/PermissionDeniedException.kt
index 03a3999f4..c9ae8beec 100644
--- a/openai-java-core/src/main/kotlin/com/openai/errors/PermissionDeniedException.kt
+++ b/openai-java-core/src/main/kotlin/com/openai/errors/PermissionDeniedException.kt
@@ -2,6 +2,7 @@
package com.openai.errors
+import com.openai.core.JsonField
import com.openai.core.JsonMissing
import com.openai.core.JsonValue
import com.openai.core.checkRequired
@@ -14,20 +15,27 @@ import kotlin.jvm.optionals.getOrNull
class PermissionDeniedException
private constructor(
private val headers: Headers,
- private val error: ErrorObject?,
+ private val error: JsonField,
cause: Throwable?,
-) : OpenAIServiceException("403: ${error?._message()}", cause) {
+) :
+ OpenAIServiceException(
+ "403: ${error.asKnown().getOrNull()?._message()?.asKnown()?.getOrNull() ?: (if (error.isMissing()) "Unknown" else jsonMapper().writeValueAsString(error))}",
+ cause,
+ ) {
override fun statusCode(): Int = 403
override fun body(): JsonValue =
- error?.let { JsonValue.fromJsonNode(jsonMapper().valueToTree(it)) } ?: JsonMissing.of()
+ if (error.isMissing()) JsonMissing.of()
+ else JsonValue.fromJsonNode(jsonMapper().valueToTree(error))
- override fun code(): Optional = Optional.ofNullable(error?.code()?.getOrNull())
+ override fun code(): Optional =
+ Optional.ofNullable(error.asKnown().getOrNull()?.code()?.getOrNull())
- override fun param(): Optional = Optional.ofNullable(error?.param()?.getOrNull())
+ override fun param(): Optional =
+ Optional.ofNullable(error.asKnown().getOrNull()?.param()?.getOrNull())
- override fun type(): Optional = Optional.ofNullable(error?.type())
+ override fun type(): Optional = Optional.ofNullable(error.asKnown().getOrNull()?.type())
override fun headers(): Headers = headers
@@ -50,7 +58,7 @@ private constructor(
class Builder internal constructor() {
private var headers: Headers? = null
- private var error: ErrorObject? = null
+ private var error: JsonField = JsonMissing.of()
private var cause: Throwable? = null
@JvmSynthetic
@@ -62,11 +70,13 @@ private constructor(
fun headers(headers: Headers) = apply { this.headers = headers }
- fun error(error: ErrorObject?) = apply { this.error = error }
+ fun error(error: ErrorObject?) = error(JsonField.ofNullable(error))
/** Alias for calling [Builder.error] with `error.orElse(null)`. */
fun error(error: Optional) = error(error.getOrNull())
+ fun error(error: JsonField) = apply { this.error = error }
+
fun cause(cause: Throwable?) = apply { this.cause = cause }
/** Alias for calling [Builder.cause] with `cause.orElse(null)`. */
diff --git a/openai-java-core/src/main/kotlin/com/openai/errors/RateLimitException.kt b/openai-java-core/src/main/kotlin/com/openai/errors/RateLimitException.kt
index 02ae02bb6..8425abb2b 100644
--- a/openai-java-core/src/main/kotlin/com/openai/errors/RateLimitException.kt
+++ b/openai-java-core/src/main/kotlin/com/openai/errors/RateLimitException.kt
@@ -2,6 +2,7 @@
package com.openai.errors
+import com.openai.core.JsonField
import com.openai.core.JsonMissing
import com.openai.core.JsonValue
import com.openai.core.checkRequired
@@ -14,20 +15,27 @@ import kotlin.jvm.optionals.getOrNull
class RateLimitException
private constructor(
private val headers: Headers,
- private val error: ErrorObject?,
+ private val error: JsonField,
cause: Throwable?,
-) : OpenAIServiceException("429: ${error?._message()}", cause) {
+) :
+ OpenAIServiceException(
+ "429: ${error.asKnown().getOrNull()?._message()?.asKnown()?.getOrNull() ?: (if (error.isMissing()) "Unknown" else jsonMapper().writeValueAsString(error))}",
+ cause,
+ ) {
override fun statusCode(): Int = 429
override fun body(): JsonValue =
- error?.let { JsonValue.fromJsonNode(jsonMapper().valueToTree(it)) } ?: JsonMissing.of()
+ if (error.isMissing()) JsonMissing.of()
+ else JsonValue.fromJsonNode(jsonMapper().valueToTree(error))
- override fun code(): Optional = Optional.ofNullable(error?.code()?.getOrNull())
+ override fun code(): Optional =
+ Optional.ofNullable(error.asKnown().getOrNull()?.code()?.getOrNull())
- override fun param(): Optional = Optional.ofNullable(error?.param()?.getOrNull())
+ override fun param(): Optional =
+ Optional.ofNullable(error.asKnown().getOrNull()?.param()?.getOrNull())
- override fun type(): Optional = Optional.ofNullable(error?.type())
+ override fun type(): Optional = Optional.ofNullable(error.asKnown().getOrNull()?.type())
override fun headers(): Headers = headers
@@ -50,7 +58,7 @@ private constructor(
class Builder internal constructor() {
private var headers: Headers? = null
- private var error: ErrorObject? = null
+ private var error: JsonField = JsonMissing.of()
private var cause: Throwable? = null
@JvmSynthetic
@@ -62,11 +70,13 @@ private constructor(
fun headers(headers: Headers) = apply { this.headers = headers }
- fun error(error: ErrorObject?) = apply { this.error = error }
+ fun error(error: ErrorObject?) = error(JsonField.ofNullable(error))
/** Alias for calling [Builder.error] with `error.orElse(null)`. */
fun error(error: Optional) = error(error.getOrNull())
+ fun error(error: JsonField) = apply { this.error = error }
+
fun cause(cause: Throwable?) = apply { this.cause = cause }
/** Alias for calling [Builder.cause] with `cause.orElse(null)`. */
diff --git a/openai-java-core/src/main/kotlin/com/openai/errors/SseException.kt b/openai-java-core/src/main/kotlin/com/openai/errors/SseException.kt
index b4488d5d5..74f969c25 100644
--- a/openai-java-core/src/main/kotlin/com/openai/errors/SseException.kt
+++ b/openai-java-core/src/main/kotlin/com/openai/errors/SseException.kt
@@ -2,6 +2,7 @@
package com.openai.errors
+import com.openai.core.JsonField
import com.openai.core.JsonMissing
import com.openai.core.JsonValue
import com.openai.core.checkRequired
@@ -15,18 +16,25 @@ class SseException
private constructor(
private val statusCode: Int,
private val headers: Headers,
- private val error: ErrorObject?,
+ private val error: JsonField,
cause: Throwable?,
-) : OpenAIServiceException("$statusCode: ${error?._message()}", cause) {
+) :
+ OpenAIServiceException(
+ "$statusCode: ${error.asKnown().getOrNull()?._message()?.asKnown()?.getOrNull() ?: (if (error.isMissing()) "Unknown" else jsonMapper().writeValueAsString(error))}",
+ cause,
+ ) {
override fun body(): JsonValue =
- error?.let { JsonValue.fromJsonNode(jsonMapper().valueToTree(it)) } ?: JsonMissing.of()
+ if (error.isMissing()) JsonMissing.of()
+ else JsonValue.fromJsonNode(jsonMapper().valueToTree(error))
- override fun code(): Optional = Optional.ofNullable(error?.code()?.getOrNull())
+ override fun code(): Optional =
+ Optional.ofNullable(error.asKnown().getOrNull()?.code()?.getOrNull())
- override fun param(): Optional = Optional.ofNullable(error?.param()?.getOrNull())
+ override fun param(): Optional =
+ Optional.ofNullable(error.asKnown().getOrNull()?.param()?.getOrNull())
- override fun type(): Optional = Optional.ofNullable(error?.type())
+ override fun type(): Optional = Optional.ofNullable(error.asKnown().getOrNull()?.type())
override fun statusCode(): Int = statusCode
@@ -53,7 +61,7 @@ private constructor(
private var statusCode: Int? = null
private var headers: Headers? = null
- private var error: ErrorObject? = null
+ private var error: JsonField = JsonMissing.of()
private var cause: Throwable? = null
@JvmSynthetic
@@ -68,11 +76,13 @@ private constructor(
fun headers(headers: Headers) = apply { this.headers = headers }
- fun error(error: ErrorObject?) = apply { this.error = error }
+ fun error(error: ErrorObject?) = error(JsonField.ofNullable(error))
/** Alias for calling [Builder.error] with `error.orElse(null)`. */
fun error(error: Optional) = error(error.getOrNull())
+ fun error(error: JsonField) = apply { this.error = error }
+
fun cause(cause: Throwable?) = apply { this.cause = cause }
/** Alias for calling [Builder.cause] with `cause.orElse(null)`. */
diff --git a/openai-java-core/src/main/kotlin/com/openai/errors/UnauthorizedException.kt b/openai-java-core/src/main/kotlin/com/openai/errors/UnauthorizedException.kt
index e8eb5a2cb..e9ae80302 100644
--- a/openai-java-core/src/main/kotlin/com/openai/errors/UnauthorizedException.kt
+++ b/openai-java-core/src/main/kotlin/com/openai/errors/UnauthorizedException.kt
@@ -2,6 +2,7 @@
package com.openai.errors
+import com.openai.core.JsonField
import com.openai.core.JsonMissing
import com.openai.core.JsonValue
import com.openai.core.checkRequired
@@ -14,20 +15,27 @@ import kotlin.jvm.optionals.getOrNull
class UnauthorizedException
private constructor(
private val headers: Headers,
- private val error: ErrorObject?,
+ private val error: JsonField,
cause: Throwable?,
-) : OpenAIServiceException("401: ${error?._message()}", cause) {
+) :
+ OpenAIServiceException(
+ "401: ${error.asKnown().getOrNull()?._message()?.asKnown()?.getOrNull() ?: (if (error.isMissing()) "Unknown" else jsonMapper().writeValueAsString(error))}",
+ cause,
+ ) {
override fun statusCode(): Int = 401
override fun body(): JsonValue =
- error?.let { JsonValue.fromJsonNode(jsonMapper().valueToTree(it)) } ?: JsonMissing.of()
+ if (error.isMissing()) JsonMissing.of()
+ else JsonValue.fromJsonNode(jsonMapper().valueToTree(error))
- override fun code(): Optional = Optional.ofNullable(error?.code()?.getOrNull())
+ override fun code(): Optional =
+ Optional.ofNullable(error.asKnown().getOrNull()?.code()?.getOrNull())
- override fun param(): Optional = Optional.ofNullable(error?.param()?.getOrNull())
+ override fun param(): Optional =
+ Optional.ofNullable(error.asKnown().getOrNull()?.param()?.getOrNull())
- override fun type(): Optional = Optional.ofNullable(error?.type())
+ override fun type(): Optional = Optional.ofNullable(error.asKnown().getOrNull()?.type())
override fun headers(): Headers = headers
@@ -50,7 +58,7 @@ private constructor(
class Builder internal constructor() {
private var headers: Headers? = null
- private var error: ErrorObject? = null
+ private var error: JsonField = JsonMissing.of()
private var cause: Throwable? = null
@JvmSynthetic
@@ -62,11 +70,13 @@ private constructor(
fun headers(headers: Headers) = apply { this.headers = headers }
- fun error(error: ErrorObject?) = apply { this.error = error }
+ fun error(error: ErrorObject?) = error(JsonField.ofNullable(error))
/** Alias for calling [Builder.error] with `error.orElse(null)`. */
fun error(error: Optional) = error(error.getOrNull())
+ fun error(error: JsonField) = apply { this.error = error }
+
fun cause(cause: Throwable?) = apply { this.cause = cause }
/** Alias for calling [Builder.cause] with `cause.orElse(null)`. */
diff --git a/openai-java-core/src/main/kotlin/com/openai/errors/UnexpectedStatusCodeException.kt b/openai-java-core/src/main/kotlin/com/openai/errors/UnexpectedStatusCodeException.kt
index d4b32160a..16627f1f3 100644
--- a/openai-java-core/src/main/kotlin/com/openai/errors/UnexpectedStatusCodeException.kt
+++ b/openai-java-core/src/main/kotlin/com/openai/errors/UnexpectedStatusCodeException.kt
@@ -2,6 +2,7 @@
package com.openai.errors
+import com.openai.core.JsonField
import com.openai.core.JsonMissing
import com.openai.core.JsonValue
import com.openai.core.checkRequired
@@ -15,18 +16,25 @@ class UnexpectedStatusCodeException
private constructor(
private val statusCode: Int,
private val headers: Headers,
- private val error: ErrorObject?,
+ private val error: JsonField,
cause: Throwable?,
-) : OpenAIServiceException("$statusCode: ${error?._message()}", cause) {
+) :
+ OpenAIServiceException(
+ "$statusCode: ${error.asKnown().getOrNull()?._message()?.asKnown()?.getOrNull() ?: (if (error.isMissing()) "Unknown" else jsonMapper().writeValueAsString(error))}",
+ cause,
+ ) {
override fun body(): JsonValue =
- error?.let { JsonValue.fromJsonNode(jsonMapper().valueToTree(it)) } ?: JsonMissing.of()
+ if (error.isMissing()) JsonMissing.of()
+ else JsonValue.fromJsonNode(jsonMapper().valueToTree(error))
- override fun code(): Optional = Optional.ofNullable(error?.code()?.getOrNull())
+ override fun code(): Optional =
+ Optional.ofNullable(error.asKnown().getOrNull()?.code()?.getOrNull())
- override fun param(): Optional = Optional.ofNullable(error?.param()?.getOrNull())
+ override fun param(): Optional =
+ Optional.ofNullable(error.asKnown().getOrNull()?.param()?.getOrNull())
- override fun type(): Optional = Optional.ofNullable(error?.type())
+ override fun type(): Optional = Optional.ofNullable(error.asKnown().getOrNull()?.type())
override fun statusCode(): Int = statusCode
@@ -54,7 +62,7 @@ private constructor(
private var statusCode: Int? = null
private var headers: Headers? = null
- private var error: ErrorObject? = null
+ private var error: JsonField = JsonMissing.of()
private var cause: Throwable? = null
@JvmSynthetic
@@ -69,11 +77,13 @@ private constructor(
fun headers(headers: Headers) = apply { this.headers = headers }
- fun error(error: ErrorObject?) = apply { this.error = error }
+ fun error(error: ErrorObject?) = error(JsonField.ofNullable(error))
/** Alias for calling [Builder.error] with `error.orElse(null)`. */
fun error(error: Optional) = error(error.getOrNull())
+ fun error(error: JsonField) = apply { this.error = error }
+
fun cause(cause: Throwable?) = apply { this.cause = cause }
/** Alias for calling [Builder.cause] with `cause.orElse(null)`. */
diff --git a/openai-java-core/src/main/kotlin/com/openai/errors/UnprocessableEntityException.kt b/openai-java-core/src/main/kotlin/com/openai/errors/UnprocessableEntityException.kt
index 42a5a7ca2..f23316843 100644
--- a/openai-java-core/src/main/kotlin/com/openai/errors/UnprocessableEntityException.kt
+++ b/openai-java-core/src/main/kotlin/com/openai/errors/UnprocessableEntityException.kt
@@ -2,6 +2,7 @@
package com.openai.errors
+import com.openai.core.JsonField
import com.openai.core.JsonMissing
import com.openai.core.JsonValue
import com.openai.core.checkRequired
@@ -14,20 +15,27 @@ import kotlin.jvm.optionals.getOrNull
class UnprocessableEntityException
private constructor(
private val headers: Headers,
- private val error: ErrorObject?,
+ private val error: JsonField,
cause: Throwable?,
-) : OpenAIServiceException("422: ${error?._message()}", cause) {
+) :
+ OpenAIServiceException(
+ "422: ${error.asKnown().getOrNull()?._message()?.asKnown()?.getOrNull() ?: (if (error.isMissing()) "Unknown" else jsonMapper().writeValueAsString(error))}",
+ cause,
+ ) {
override fun statusCode(): Int = 422
override fun body(): JsonValue =
- error?.let { JsonValue.fromJsonNode(jsonMapper().valueToTree(it)) } ?: JsonMissing.of()
+ if (error.isMissing()) JsonMissing.of()
+ else JsonValue.fromJsonNode(jsonMapper().valueToTree(error))
- override fun code(): Optional = Optional.ofNullable(error?.code()?.getOrNull())
+ override fun code(): Optional =
+ Optional.ofNullable(error.asKnown().getOrNull()?.code()?.getOrNull())
- override fun param(): Optional = Optional.ofNullable(error?.param()?.getOrNull())
+ override fun param(): Optional =
+ Optional.ofNullable(error.asKnown().getOrNull()?.param()?.getOrNull())
- override fun type(): Optional = Optional.ofNullable(error?.type())
+ override fun type(): Optional = Optional.ofNullable(error.asKnown().getOrNull()?.type())
override fun headers(): Headers = headers
@@ -50,7 +58,7 @@ private constructor(
class Builder internal constructor() {
private var headers: Headers? = null
- private var error: ErrorObject? = null
+ private var error: JsonField = JsonMissing.of()
private var cause: Throwable? = null
@JvmSynthetic
@@ -62,11 +70,13 @@ private constructor(
fun headers(headers: Headers) = apply { this.headers = headers }
- fun error(error: ErrorObject?) = apply { this.error = error }
+ fun error(error: ErrorObject?) = error(JsonField.ofNullable(error))
/** Alias for calling [Builder.error] with `error.orElse(null)`. */
fun error(error: Optional) = error(error.getOrNull())
+ fun error(error: JsonField) = apply { this.error = error }
+
fun cause(cause: Throwable?) = apply { this.cause = cause }
/** Alias for calling [Builder.cause] with `cause.orElse(null)`. */
diff --git a/openai-java-core/src/main/kotlin/com/openai/models/AllModels.kt b/openai-java-core/src/main/kotlin/com/openai/models/AllModels.kt
index 318a68e6e..60e555625 100644
--- a/openai-java-core/src/main/kotlin/com/openai/models/AllModels.kt
+++ b/openai-java-core/src/main/kotlin/com/openai/models/AllModels.kt
@@ -52,6 +52,35 @@ private constructor(
fun _json(): Optional = Optional.ofNullable(_json)
+ /**
+ * Maps this instance's current variant to a value of type [T] using the given [visitor].
+ *
+ * Note that this method is _not_ forwards compatible with new variants from the API, unless
+ * [visitor] overrides [Visitor.unknown]. To handle variants not known to this version of the
+ * SDK gracefully, consider overriding [Visitor.unknown]:
+ * ```java
+ * import com.openai.core.JsonValue;
+ * import java.util.Optional;
+ *
+ * Optional result = allModels.accept(new AllModels.Visitor>() {
+ * @Override
+ * public Optional visitString(String string) {
+ * return Optional.of(string.toString());
+ * }
+ *
+ * // ...
+ *
+ * @Override
+ * public Optional unknown(JsonValue json) {
+ * // Or inspect the `json`.
+ * return Optional.empty();
+ * }
+ * });
+ * ```
+ *
+ * @throws OpenAIInvalidDataException if [Visitor.unknown] is not overridden in [visitor] and
+ * the current variant is unknown.
+ */
fun accept(visitor: Visitor): T =
when {
string != null -> visitor.visitString(string)
@@ -62,6 +91,14 @@ private constructor(
private var validated: Boolean = false
+ /**
+ * Validates that the types of all values in this object match their expected types recursively.
+ *
+ * This method is _not_ forwards compatible with new types from the API for existing fields.
+ *
+ * @throws OpenAIInvalidDataException if any value type in this object doesn't match its
+ * expected type.
+ */
fun validate(): AllModels = apply {
if (validated) {
return@apply
@@ -380,6 +417,15 @@ private constructor(
private var validated: Boolean = false
+ /**
+ * Validates that the types of all values in this object match their expected types
+ * recursively.
+ *
+ * This method is _not_ forwards compatible with new types from the API for existing fields.
+ *
+ * @throws OpenAIInvalidDataException if any value type in this object doesn't match its
+ * expected type.
+ */
fun validate(): ResponsesOnlyModel = apply {
if (validated) {
return@apply
diff --git a/openai-java-core/src/main/kotlin/com/openai/models/ChatModel.kt b/openai-java-core/src/main/kotlin/com/openai/models/ChatModel.kt
index 6ae3ba181..16bf07847 100644
--- a/openai-java-core/src/main/kotlin/com/openai/models/ChatModel.kt
+++ b/openai-java-core/src/main/kotlin/com/openai/models/ChatModel.kt
@@ -550,6 +550,14 @@ class ChatModel @JsonCreator private constructor(private val value: JsonField = Optional.ofNullable(_json)
+ /**
+ * Maps this instance's current variant to a value of type [T] using the given [visitor].
+ *
+ * Note that this method is _not_ forwards compatible with new variants from the API, unless
+ * [visitor] overrides [Visitor.unknown]. To handle variants not known to this version of
+ * the SDK gracefully, consider overriding [Visitor.unknown]:
+ * ```java
+ * import com.openai.core.JsonValue;
+ * import java.util.Optional;
+ *
+ * Optional result = value.accept(new Value.Visitor>() {
+ * @Override
+ * public Optional visitString(String string) {
+ * return Optional.of(string.toString());
+ * }
+ *
+ * // ...
+ *
+ * @Override
+ * public Optional unknown(JsonValue json) {
+ * // Or inspect the `json`.
+ * return Optional.empty();
+ * }
+ * });
+ * ```
+ *
+ * @throws OpenAIInvalidDataException if [Visitor.unknown] is not overridden in [visitor]
+ * and the current variant is unknown.
+ */
fun accept(visitor: Visitor): T =
when {
string != null -> visitor.visitString(string)
@@ -509,6 +555,15 @@ private constructor(
private var validated: Boolean = false
+ /**
+ * Validates that the types of all values in this object match their expected types
+ * recursively.
+ *
+ * This method is _not_ forwards compatible with new types from the API for existing fields.
+ *
+ * @throws OpenAIInvalidDataException if any value type in this object doesn't match its
+ * expected type.
+ */
fun validate(): Value = apply {
if (validated) {
return@apply
@@ -709,6 +764,36 @@ private constructor(
fun _json(): Optional = Optional.ofNullable(_json)
+ /**
+ * Maps this instance's current variant to a value of type [T] using the given
+ * [visitor].
+ *
+ * Note that this method is _not_ forwards compatible with new variants from the API,
+ * unless [visitor] overrides [Visitor.unknown]. To handle variants not known to this
+ * version of the SDK gracefully, consider overriding [Visitor.unknown]:
+ * ```java
+ * import com.openai.core.JsonValue;
+ * import java.util.Optional;
+ *
+ * Optional result = comparisonFilterValueItem.accept(new ComparisonFilterValueItem.Visitor>() {
+ * @Override
+ * public Optional visitString(String string) {
+ * return Optional.of(string.toString());
+ * }
+ *
+ * // ...
+ *
+ * @Override
+ * public Optional unknown(JsonValue json) {
+ * // Or inspect the `json`.
+ * return Optional.empty();
+ * }
+ * });
+ * ```
+ *
+ * @throws OpenAIInvalidDataException if [Visitor.unknown] is not overridden in
+ * [visitor] and the current variant is unknown.
+ */
fun accept(visitor: Visitor): T =
when {
string != null -> visitor.visitString(string)
@@ -718,6 +803,16 @@ private constructor(
private var validated: Boolean = false
+ /**
+ * Validates that the types of all values in this object match their expected types
+ * recursively.
+ *
+ * This method is _not_ forwards compatible with new types from the API for existing
+ * fields.
+ *
+ * @throws OpenAIInvalidDataException if any value type in this object doesn't match its
+ * expected type.
+ */
fun validate(): ComparisonFilterValueItem = apply {
if (validated) {
return@apply
diff --git a/openai-java-core/src/main/kotlin/com/openai/models/CompoundFilter.kt b/openai-java-core/src/main/kotlin/com/openai/models/CompoundFilter.kt
index 36e7ce715..84f7ce186 100644
--- a/openai-java-core/src/main/kotlin/com/openai/models/CompoundFilter.kt
+++ b/openai-java-core/src/main/kotlin/com/openai/models/CompoundFilter.kt
@@ -203,6 +203,14 @@ private constructor(
private var validated: Boolean = false
+ /**
+ * Validates that the types of all values in this object match their expected types recursively.
+ *
+ * This method is _not_ forwards compatible with new types from the API for existing fields.
+ *
+ * @throws OpenAIInvalidDataException if any value type in this object doesn't match its
+ * expected type.
+ */
fun validate(): CompoundFilter = apply {
if (validated) {
return@apply
@@ -266,6 +274,35 @@ private constructor(
fun _json(): Optional = Optional.ofNullable(_json)
+ /**
+ * Maps this instance's current variant to a value of type [T] using the given [visitor].
+ *
+ * Note that this method is _not_ forwards compatible with new variants from the API, unless
+ * [visitor] overrides [Visitor.unknown]. To handle variants not known to this version of
+ * the SDK gracefully, consider overriding [Visitor.unknown]:
+ * ```java
+ * import com.openai.core.JsonValue;
+ * import java.util.Optional;
+ *
+ * Optional result = filter.accept(new Filter.Visitor>() {
+ * @Override
+ * public Optional visitComparison(ComparisonFilter comparison) {
+ * return Optional.of(comparison.toString());
+ * }
+ *
+ * // ...
+ *
+ * @Override
+ * public Optional unknown(JsonValue json) {
+ * // Or inspect the `json`.
+ * return Optional.empty();
+ * }
+ * });
+ * ```
+ *
+ * @throws OpenAIInvalidDataException if [Visitor.unknown] is not overridden in [visitor]
+ * and the current variant is unknown.
+ */
fun accept(visitor: Visitor): T =
when {
comparison != null -> visitor.visitComparison(comparison)
@@ -275,6 +312,15 @@ private constructor(
private var validated: Boolean = false
+ /**
+ * Validates that the types of all values in this object match their expected types
+ * recursively.
+ *
+ * This method is _not_ forwards compatible with new types from the API for existing fields.
+ *
+ * @throws OpenAIInvalidDataException if any value type in this object doesn't match its
+ * expected type.
+ */
fun validate(): Filter = apply {
if (validated) {
return@apply
@@ -510,6 +556,15 @@ private constructor(
private var validated: Boolean = false
+ /**
+ * Validates that the types of all values in this object match their expected types
+ * recursively.
+ *
+ * This method is _not_ forwards compatible with new types from the API for existing fields.
+ *
+ * @throws OpenAIInvalidDataException if any value type in this object doesn't match its
+ * expected type.
+ */
fun validate(): Type = apply {
if (validated) {
return@apply
diff --git a/openai-java-core/src/main/kotlin/com/openai/models/CustomToolInputFormat.kt b/openai-java-core/src/main/kotlin/com/openai/models/CustomToolInputFormat.kt
index 1f0d125dc..0d2d1170f 100644
--- a/openai-java-core/src/main/kotlin/com/openai/models/CustomToolInputFormat.kt
+++ b/openai-java-core/src/main/kotlin/com/openai/models/CustomToolInputFormat.kt
@@ -56,6 +56,35 @@ private constructor(
fun _json(): Optional = Optional.ofNullable(_json)
+ /**
+ * Maps this instance's current variant to a value of type [T] using the given [visitor].
+ *
+ * Note that this method is _not_ forwards compatible with new variants from the API, unless
+ * [visitor] overrides [Visitor.unknown]. To handle variants not known to this version of the
+ * SDK gracefully, consider overriding [Visitor.unknown]:
+ * ```java
+ * import com.openai.core.JsonValue;
+ * import java.util.Optional;
+ *
+ * Optional result = customToolInputFormat.accept(new CustomToolInputFormat.Visitor>() {
+ * @Override
+ * public Optional visitText(JsonValue text) {
+ * return Optional.of(text.toString());
+ * }
+ *
+ * // ...
+ *
+ * @Override
+ * public Optional unknown(JsonValue json) {
+ * // Or inspect the `json`.
+ * return Optional.empty();
+ * }
+ * });
+ * ```
+ *
+ * @throws OpenAIInvalidDataException if [Visitor.unknown] is not overridden in [visitor] and
+ * the current variant is unknown.
+ */
fun accept(visitor: Visitor): T =
when {
text != null -> visitor.visitText(text)
@@ -65,6 +94,14 @@ private constructor(
private var validated: Boolean = false
+ /**
+ * Validates that the types of all values in this object match their expected types recursively.
+ *
+ * This method is _not_ forwards compatible with new types from the API for existing fields.
+ *
+ * @throws OpenAIInvalidDataException if any value type in this object doesn't match its
+ * expected type.
+ */
fun validate(): CustomToolInputFormat = apply {
if (validated) {
return@apply
@@ -397,6 +434,15 @@ private constructor(
private var validated: Boolean = false
+ /**
+ * Validates that the types of all values in this object match their expected types
+ * recursively.
+ *
+ * This method is _not_ forwards compatible with new types from the API for existing fields.
+ *
+ * @throws OpenAIInvalidDataException if any value type in this object doesn't match its
+ * expected type.
+ */
fun validate(): Grammar = apply {
if (validated) {
return@apply
@@ -524,6 +570,16 @@ private constructor(
private var validated: Boolean = false
+ /**
+ * Validates that the types of all values in this object match their expected types
+ * recursively.
+ *
+ * This method is _not_ forwards compatible with new types from the API for existing
+ * fields.
+ *
+ * @throws OpenAIInvalidDataException if any value type in this object doesn't match its
+ * expected type.
+ */
fun validate(): Syntax = apply {
if (validated) {
return@apply
diff --git a/openai-java-core/src/main/kotlin/com/openai/models/ErrorObject.kt b/openai-java-core/src/main/kotlin/com/openai/models/ErrorObject.kt
index 88cf53223..14773f348 100644
--- a/openai-java-core/src/main/kotlin/com/openai/models/ErrorObject.kt
+++ b/openai-java-core/src/main/kotlin/com/openai/models/ErrorObject.kt
@@ -225,6 +225,14 @@ private constructor(
private var validated: Boolean = false
+ /**
+ * Validates that the types of all values in this object match their expected types recursively.
+ *
+ * This method is _not_ forwards compatible with new types from the API for existing fields.
+ *
+ * @throws OpenAIInvalidDataException if any value type in this object doesn't match its
+ * expected type.
+ */
fun validate(): ErrorObject = apply {
if (validated) {
return@apply
diff --git a/openai-java-core/src/main/kotlin/com/openai/models/FunctionDefinition.kt b/openai-java-core/src/main/kotlin/com/openai/models/FunctionDefinition.kt
index e30b1e4de..8087c7d3e 100644
--- a/openai-java-core/src/main/kotlin/com/openai/models/FunctionDefinition.kt
+++ b/openai-java-core/src/main/kotlin/com/openai/models/FunctionDefinition.kt
@@ -274,6 +274,14 @@ private constructor(
private var validated: Boolean = false
+ /**
+ * Validates that the types of all values in this object match their expected types recursively.
+ *
+ * This method is _not_ forwards compatible with new types from the API for existing fields.
+ *
+ * @throws OpenAIInvalidDataException if any value type in this object doesn't match its
+ * expected type.
+ */
fun validate(): FunctionDefinition = apply {
if (validated) {
return@apply
diff --git a/openai-java-core/src/main/kotlin/com/openai/models/FunctionParameters.kt b/openai-java-core/src/main/kotlin/com/openai/models/FunctionParameters.kt
index cac22f8ff..02ac1b915 100644
--- a/openai-java-core/src/main/kotlin/com/openai/models/FunctionParameters.kt
+++ b/openai-java-core/src/main/kotlin/com/openai/models/FunctionParameters.kt
@@ -76,6 +76,14 @@ private constructor(
private var validated: Boolean = false
+ /**
+ * Validates that the types of all values in this object match their expected types recursively.
+ *
+ * This method is _not_ forwards compatible with new types from the API for existing fields.
+ *
+ * @throws OpenAIInvalidDataException if any value type in this object doesn't match its
+ * expected type.
+ */
fun validate(): FunctionParameters = apply {
if (validated) {
return@apply
diff --git a/openai-java-core/src/main/kotlin/com/openai/models/OAuthErrorCode.kt b/openai-java-core/src/main/kotlin/com/openai/models/OAuthErrorCode.kt
index 704517d03..ba07f450f 100644
--- a/openai-java-core/src/main/kotlin/com/openai/models/OAuthErrorCode.kt
+++ b/openai-java-core/src/main/kotlin/com/openai/models/OAuthErrorCode.kt
@@ -94,6 +94,14 @@ class OAuthErrorCode @JsonCreator private constructor(private val value: JsonFie
private var validated: Boolean = false
+ /**
+ * Validates that the types of all values in this object match their expected types recursively.
+ *
+ * This method is _not_ forwards compatible with new types from the API for existing fields.
+ *
+ * @throws OpenAIInvalidDataException if any value type in this object doesn't match its
+ * expected type.
+ */
fun validate(): OAuthErrorCode = apply {
if (validated) {
return@apply
diff --git a/openai-java-core/src/main/kotlin/com/openai/models/Reasoning.kt b/openai-java-core/src/main/kotlin/com/openai/models/Reasoning.kt
index 685342fb2..224a76108 100644
--- a/openai-java-core/src/main/kotlin/com/openai/models/Reasoning.kt
+++ b/openai-java-core/src/main/kotlin/com/openai/models/Reasoning.kt
@@ -248,6 +248,14 @@ private constructor(
private var validated: Boolean = false
+ /**
+ * Validates that the types of all values in this object match their expected types recursively.
+ *
+ * This method is _not_ forwards compatible with new types from the API for existing fields.
+ *
+ * @throws OpenAIInvalidDataException if any value type in this object doesn't match its
+ * expected type.
+ */
fun validate(): Reasoning = apply {
if (validated) {
return@apply
@@ -382,6 +390,15 @@ private constructor(
private var validated: Boolean = false
+ /**
+ * Validates that the types of all values in this object match their expected types
+ * recursively.
+ *
+ * This method is _not_ forwards compatible with new types from the API for existing fields.
+ *
+ * @throws OpenAIInvalidDataException if any value type in this object doesn't match its
+ * expected type.
+ */
fun validate(): GenerateSummary = apply {
if (validated) {
return@apply
@@ -520,6 +537,15 @@ private constructor(
private var validated: Boolean = false
+ /**
+ * Validates that the types of all values in this object match their expected types
+ * recursively.
+ *
+ * This method is _not_ forwards compatible with new types from the API for existing fields.
+ *
+ * @throws OpenAIInvalidDataException if any value type in this object doesn't match its
+ * expected type.
+ */
fun validate(): Summary = apply {
if (validated) {
return@apply
diff --git a/openai-java-core/src/main/kotlin/com/openai/models/ReasoningEffort.kt b/openai-java-core/src/main/kotlin/com/openai/models/ReasoningEffort.kt
index 183297e01..0bead0c0a 100644
--- a/openai-java-core/src/main/kotlin/com/openai/models/ReasoningEffort.kt
+++ b/openai-java-core/src/main/kotlin/com/openai/models/ReasoningEffort.kt
@@ -131,6 +131,14 @@ class ReasoningEffort @JsonCreator private constructor(private val value: JsonFi
private var validated: Boolean = false
+ /**
+ * Validates that the types of all values in this object match their expected types recursively.
+ *
+ * This method is _not_ forwards compatible with new types from the API for existing fields.
+ *
+ * @throws OpenAIInvalidDataException if any value type in this object doesn't match its
+ * expected type.
+ */
fun validate(): ReasoningEffort = apply {
if (validated) {
return@apply
diff --git a/openai-java-core/src/main/kotlin/com/openai/models/ResponseFormatJsonObject.kt b/openai-java-core/src/main/kotlin/com/openai/models/ResponseFormatJsonObject.kt
index a67417617..78df68e0a 100644
--- a/openai-java-core/src/main/kotlin/com/openai/models/ResponseFormatJsonObject.kt
+++ b/openai-java-core/src/main/kotlin/com/openai/models/ResponseFormatJsonObject.kt
@@ -117,6 +117,14 @@ private constructor(
private var validated: Boolean = false
+ /**
+ * Validates that the types of all values in this object match their expected types recursively.
+ *
+ * This method is _not_ forwards compatible with new types from the API for existing fields.
+ *
+ * @throws OpenAIInvalidDataException if any value type in this object doesn't match its
+ * expected type.
+ */
fun validate(): ResponseFormatJsonObject = apply {
if (validated) {
return@apply
diff --git a/openai-java-core/src/main/kotlin/com/openai/models/ResponseFormatJsonSchema.kt b/openai-java-core/src/main/kotlin/com/openai/models/ResponseFormatJsonSchema.kt
index 1c18860fd..be7db8d1c 100644
--- a/openai-java-core/src/main/kotlin/com/openai/models/ResponseFormatJsonSchema.kt
+++ b/openai-java-core/src/main/kotlin/com/openai/models/ResponseFormatJsonSchema.kt
@@ -174,6 +174,14 @@ private constructor(
private var validated: Boolean = false
+ /**
+ * Validates that the types of all values in this object match their expected types recursively.
+ *
+ * This method is _not_ forwards compatible with new types from the API for existing fields.
+ *
+ * @throws OpenAIInvalidDataException if any value type in this object doesn't match its
+ * expected type.
+ */
fun validate(): ResponseFormatJsonSchema = apply {
if (validated) {
return@apply
@@ -455,6 +463,15 @@ private constructor(
private var validated: Boolean = false
+ /**
+ * Validates that the types of all values in this object match their expected types
+ * recursively.
+ *
+ * This method is _not_ forwards compatible with new types from the API for existing fields.
+ *
+ * @throws OpenAIInvalidDataException if any value type in this object doesn't match its
+ * expected type.
+ */
fun validate(): JsonSchema = apply {
if (validated) {
return@apply
@@ -553,6 +570,16 @@ private constructor(
private var validated: Boolean = false
+ /**
+ * Validates that the types of all values in this object match their expected types
+ * recursively.
+ *
+ * This method is _not_ forwards compatible with new types from the API for existing
+ * fields.
+ *
+ * @throws OpenAIInvalidDataException if any value type in this object doesn't match its
+ * expected type.
+ */
fun validate(): Schema = apply {
if (validated) {
return@apply
diff --git a/openai-java-core/src/main/kotlin/com/openai/models/ResponseFormatText.kt b/openai-java-core/src/main/kotlin/com/openai/models/ResponseFormatText.kt
index cd8a35d81..b64967b33 100644
--- a/openai-java-core/src/main/kotlin/com/openai/models/ResponseFormatText.kt
+++ b/openai-java-core/src/main/kotlin/com/openai/models/ResponseFormatText.kt
@@ -113,6 +113,14 @@ private constructor(
private var validated: Boolean = false
+ /**
+ * Validates that the types of all values in this object match their expected types recursively.
+ *
+ * This method is _not_ forwards compatible with new types from the API for existing fields.
+ *
+ * @throws OpenAIInvalidDataException if any value type in this object doesn't match its
+ * expected type.
+ */
fun validate(): ResponseFormatText = apply {
if (validated) {
return@apply
diff --git a/openai-java-core/src/main/kotlin/com/openai/models/ResponseFormatTextGrammar.kt b/openai-java-core/src/main/kotlin/com/openai/models/ResponseFormatTextGrammar.kt
index 556dcb6c7..d40fd646b 100644
--- a/openai-java-core/src/main/kotlin/com/openai/models/ResponseFormatTextGrammar.kt
+++ b/openai-java-core/src/main/kotlin/com/openai/models/ResponseFormatTextGrammar.kt
@@ -166,6 +166,14 @@ private constructor(
private var validated: Boolean = false
+ /**
+ * Validates that the types of all values in this object match their expected types recursively.
+ *
+ * This method is _not_ forwards compatible with new types from the API for existing fields.
+ *
+ * @throws OpenAIInvalidDataException if any value type in this object doesn't match its
+ * expected type.
+ */
fun validate(): ResponseFormatTextGrammar = apply {
if (validated) {
return@apply
diff --git a/openai-java-core/src/main/kotlin/com/openai/models/ResponseFormatTextPython.kt b/openai-java-core/src/main/kotlin/com/openai/models/ResponseFormatTextPython.kt
index edfa99ea6..87116f2da 100644
--- a/openai-java-core/src/main/kotlin/com/openai/models/ResponseFormatTextPython.kt
+++ b/openai-java-core/src/main/kotlin/com/openai/models/ResponseFormatTextPython.kt
@@ -117,6 +117,14 @@ private constructor(
private var validated: Boolean = false
+ /**
+ * Validates that the types of all values in this object match their expected types recursively.
+ *
+ * This method is _not_ forwards compatible with new types from the API for existing fields.
+ *
+ * @throws OpenAIInvalidDataException if any value type in this object doesn't match its
+ * expected type.
+ */
fun validate(): ResponseFormatTextPython = apply {
if (validated) {
return@apply
diff --git a/openai-java-core/src/main/kotlin/com/openai/models/ResponsesModel.kt b/openai-java-core/src/main/kotlin/com/openai/models/ResponsesModel.kt
index ba197e098..cafdcc85e 100644
--- a/openai-java-core/src/main/kotlin/com/openai/models/ResponsesModel.kt
+++ b/openai-java-core/src/main/kotlin/com/openai/models/ResponsesModel.kt
@@ -51,6 +51,35 @@ private constructor(
fun _json(): Optional = Optional.ofNullable(_json)
+ /**
+ * Maps this instance's current variant to a value of type [T] using the given [visitor].
+ *
+ * Note that this method is _not_ forwards compatible with new variants from the API, unless
+ * [visitor] overrides [Visitor.unknown]. To handle variants not known to this version of the
+ * SDK gracefully, consider overriding [Visitor.unknown]:
+ * ```java
+ * import com.openai.core.JsonValue;
+ * import java.util.Optional;
+ *
+ * Optional result = responsesModel.accept(new ResponsesModel.Visitor>() {
+ * @Override
+ * public Optional visitString(String string) {
+ * return Optional.of(string.toString());
+ * }
+ *
+ * // ...
+ *
+ * @Override
+ * public Optional unknown(JsonValue json) {
+ * // Or inspect the `json`.
+ * return Optional.empty();
+ * }
+ * });
+ * ```
+ *
+ * @throws OpenAIInvalidDataException if [Visitor.unknown] is not overridden in [visitor] and
+ * the current variant is unknown.
+ */
fun accept(visitor: Visitor): T =
when {
string != null -> visitor.visitString(string)
@@ -61,6 +90,14 @@ private constructor(
private var validated: Boolean = false
+ /**
+ * Validates that the types of all values in this object match their expected types recursively.
+ *
+ * This method is _not_ forwards compatible with new types from the API for existing fields.
+ *
+ * @throws OpenAIInvalidDataException if any value type in this object doesn't match its
+ * expected type.
+ */
fun validate(): ResponsesModel = apply {
if (validated) {
return@apply
@@ -379,6 +416,15 @@ private constructor(
private var validated: Boolean = false
+ /**
+ * Validates that the types of all values in this object match their expected types
+ * recursively.
+ *
+ * This method is _not_ forwards compatible with new types from the API for existing fields.
+ *
+ * @throws OpenAIInvalidDataException if any value type in this object doesn't match its
+ * expected type.
+ */
fun validate(): ResponsesOnlyModel = apply {
if (validated) {
return@apply
diff --git a/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/adminapikeys/AdminApiKey.kt b/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/adminapikeys/AdminApiKey.kt
index e6806ea5f..feb025044 100644
--- a/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/adminapikeys/AdminApiKey.kt
+++ b/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/adminapikeys/AdminApiKey.kt
@@ -345,6 +345,14 @@ private constructor(
private var validated: Boolean = false
+ /**
+ * Validates that the types of all values in this object match their expected types recursively.
+ *
+ * This method is _not_ forwards compatible with new types from the API for existing fields.
+ *
+ * @throws OpenAIInvalidDataException if any value type in this object doesn't match its
+ * expected type.
+ */
fun validate(): AdminApiKey = apply {
if (validated) {
return@apply
@@ -643,6 +651,15 @@ private constructor(
private var validated: Boolean = false
+ /**
+ * Validates that the types of all values in this object match their expected types
+ * recursively.
+ *
+ * This method is _not_ forwards compatible with new types from the API for existing fields.
+ *
+ * @throws OpenAIInvalidDataException if any value type in this object doesn't match its
+ * expected type.
+ */
fun validate(): Owner = apply {
if (validated) {
return@apply
diff --git a/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/adminapikeys/AdminApiKeyCreateParams.kt b/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/adminapikeys/AdminApiKeyCreateParams.kt
index 05770b2f4..f40398276 100644
--- a/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/adminapikeys/AdminApiKeyCreateParams.kt
+++ b/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/adminapikeys/AdminApiKeyCreateParams.kt
@@ -348,6 +348,15 @@ private constructor(
private var validated: Boolean = false
+ /**
+ * Validates that the types of all values in this object match their expected types
+ * recursively.
+ *
+ * This method is _not_ forwards compatible with new types from the API for existing fields.
+ *
+ * @throws OpenAIInvalidDataException if any value type in this object doesn't match its
+ * expected type.
+ */
fun validate(): Body = apply {
if (validated) {
return@apply
diff --git a/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/adminapikeys/AdminApiKeyCreateResponse.kt b/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/adminapikeys/AdminApiKeyCreateResponse.kt
index b8f53d7ce..c7acdc7ed 100644
--- a/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/adminapikeys/AdminApiKeyCreateResponse.kt
+++ b/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/adminapikeys/AdminApiKeyCreateResponse.kt
@@ -392,6 +392,14 @@ private constructor(
private var validated: Boolean = false
+ /**
+ * Validates that the types of all values in this object match their expected types recursively.
+ *
+ * This method is _not_ forwards compatible with new types from the API for existing fields.
+ *
+ * @throws OpenAIInvalidDataException if any value type in this object doesn't match its
+ * expected type.
+ */
fun validate(): AdminApiKeyCreateResponse = apply {
if (validated) {
return@apply
diff --git a/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/adminapikeys/AdminApiKeyDeleteResponse.kt b/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/adminapikeys/AdminApiKeyDeleteResponse.kt
index 24f6cc024..5524cbe80 100644
--- a/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/adminapikeys/AdminApiKeyDeleteResponse.kt
+++ b/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/adminapikeys/AdminApiKeyDeleteResponse.kt
@@ -187,6 +187,14 @@ private constructor(
private var validated: Boolean = false
+ /**
+ * Validates that the types of all values in this object match their expected types recursively.
+ *
+ * This method is _not_ forwards compatible with new types from the API for existing fields.
+ *
+ * @throws OpenAIInvalidDataException if any value type in this object doesn't match its
+ * expected type.
+ */
fun validate(): AdminApiKeyDeleteResponse = apply {
if (validated) {
return@apply
diff --git a/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/adminapikeys/AdminApiKeyListPageResponse.kt b/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/adminapikeys/AdminApiKeyListPageResponse.kt
index 3956d0699..e03698123 100644
--- a/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/adminapikeys/AdminApiKeyListPageResponse.kt
+++ b/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/adminapikeys/AdminApiKeyListPageResponse.kt
@@ -268,6 +268,14 @@ private constructor(
private var validated: Boolean = false
+ /**
+ * Validates that the types of all values in this object match their expected types recursively.
+ *
+ * This method is _not_ forwards compatible with new types from the API for existing fields.
+ *
+ * @throws OpenAIInvalidDataException if any value type in this object doesn't match its
+ * expected type.
+ */
fun validate(): AdminApiKeyListPageResponse = apply {
if (validated) {
return@apply
diff --git a/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/adminapikeys/AdminApiKeyListParams.kt b/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/adminapikeys/AdminApiKeyListParams.kt
index d60f3ee93..f5e5d5a5b 100644
--- a/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/adminapikeys/AdminApiKeyListParams.kt
+++ b/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/adminapikeys/AdminApiKeyListParams.kt
@@ -304,6 +304,15 @@ private constructor(
private var validated: Boolean = false
+ /**
+ * Validates that the types of all values in this object match their expected types
+ * recursively.
+ *
+ * This method is _not_ forwards compatible with new types from the API for existing fields.
+ *
+ * @throws OpenAIInvalidDataException if any value type in this object doesn't match its
+ * expected type.
+ */
fun validate(): Order = apply {
if (validated) {
return@apply
diff --git a/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/auditlogs/AuditLogListPageResponse.kt b/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/auditlogs/AuditLogListPageResponse.kt
index 314f496d0..9e1d17adb 100644
--- a/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/auditlogs/AuditLogListPageResponse.kt
+++ b/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/auditlogs/AuditLogListPageResponse.kt
@@ -270,6 +270,14 @@ private constructor(
private var validated: Boolean = false
+ /**
+ * Validates that the types of all values in this object match their expected types recursively.
+ *
+ * This method is _not_ forwards compatible with new types from the API for existing fields.
+ *
+ * @throws OpenAIInvalidDataException if any value type in this object doesn't match its
+ * expected type.
+ */
fun validate(): AuditLogListPageResponse = apply {
if (validated) {
return@apply
diff --git a/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/auditlogs/AuditLogListParams.kt b/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/auditlogs/AuditLogListParams.kt
index e9ae6df46..ad4518903 100644
--- a/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/auditlogs/AuditLogListParams.kt
+++ b/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/auditlogs/AuditLogListParams.kt
@@ -981,6 +981,15 @@ private constructor(
private var validated: Boolean = false
+ /**
+ * Validates that the types of all values in this object match their expected types
+ * recursively.
+ *
+ * This method is _not_ forwards compatible with new types from the API for existing fields.
+ *
+ * @throws OpenAIInvalidDataException if any value type in this object doesn't match its
+ * expected type.
+ */
fun validate(): EventType = apply {
if (validated) {
return@apply
diff --git a/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/auditlogs/AuditLogListResponse.kt b/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/auditlogs/AuditLogListResponse.kt
index 69361e29a..851ac96ed 100644
--- a/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/auditlogs/AuditLogListResponse.kt
+++ b/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/auditlogs/AuditLogListResponse.kt
@@ -2166,6 +2166,14 @@ private constructor(
private var validated: Boolean = false
+ /**
+ * Validates that the types of all values in this object match their expected types recursively.
+ *
+ * This method is _not_ forwards compatible with new types from the API for existing fields.
+ *
+ * @throws OpenAIInvalidDataException if any value type in this object doesn't match its
+ * expected type.
+ */
fun validate(): AuditLogListResponse = apply {
if (validated) {
return@apply
@@ -2672,6 +2680,15 @@ private constructor(
private var validated: Boolean = false
+ /**
+ * Validates that the types of all values in this object match their expected types
+ * recursively.
+ *
+ * This method is _not_ forwards compatible with new types from the API for existing fields.
+ *
+ * @throws OpenAIInvalidDataException if any value type in this object doesn't match its
+ * expected type.
+ */
fun validate(): Type = apply {
if (validated) {
return@apply
@@ -2871,6 +2888,15 @@ private constructor(
private var validated: Boolean = false
+ /**
+ * Validates that the types of all values in this object match their expected types
+ * recursively.
+ *
+ * This method is _not_ forwards compatible with new types from the API for existing fields.
+ *
+ * @throws OpenAIInvalidDataException if any value type in this object doesn't match its
+ * expected type.
+ */
fun validate(): Actor = apply {
if (validated) {
return@apply
@@ -3107,6 +3133,16 @@ private constructor(
private var validated: Boolean = false
+ /**
+ * Validates that the types of all values in this object match their expected types
+ * recursively.
+ *
+ * This method is _not_ forwards compatible with new types from the API for existing
+ * fields.
+ *
+ * @throws OpenAIInvalidDataException if any value type in this object doesn't match its
+ * expected type.
+ */
fun validate(): ApiKey = apply {
if (validated) {
return@apply
@@ -3245,6 +3281,16 @@ private constructor(
private var validated: Boolean = false
+ /**
+ * Validates that the types of all values in this object match their expected types
+ * recursively.
+ *
+ * This method is _not_ forwards compatible with new types from the API for existing
+ * fields.
+ *
+ * @throws OpenAIInvalidDataException if any value type in this object doesn't match
+ * its expected type.
+ */
fun validate(): ServiceAccount = apply {
if (validated) {
return@apply
@@ -3381,6 +3427,16 @@ private constructor(
private var validated: Boolean = false
+ /**
+ * Validates that the types of all values in this object match their expected types
+ * recursively.
+ *
+ * This method is _not_ forwards compatible with new types from the API for existing
+ * fields.
+ *
+ * @throws OpenAIInvalidDataException if any value type in this object doesn't match
+ * its expected type.
+ */
fun validate(): Type = apply {
if (validated) {
return@apply
@@ -3555,6 +3611,16 @@ private constructor(
private var validated: Boolean = false
+ /**
+ * Validates that the types of all values in this object match their expected types
+ * recursively.
+ *
+ * This method is _not_ forwards compatible with new types from the API for existing
+ * fields.
+ *
+ * @throws OpenAIInvalidDataException if any value type in this object doesn't match
+ * its expected type.
+ */
fun validate(): User = apply {
if (validated) {
return@apply
@@ -3764,6 +3830,16 @@ private constructor(
private var validated: Boolean = false
+ /**
+ * Validates that the types of all values in this object match their expected types
+ * recursively.
+ *
+ * This method is _not_ forwards compatible with new types from the API for existing
+ * fields.
+ *
+ * @throws OpenAIInvalidDataException if any value type in this object doesn't match its
+ * expected type.
+ */
fun validate(): Session = apply {
if (validated) {
return@apply
@@ -3929,6 +4005,16 @@ private constructor(
private var validated: Boolean = false
+ /**
+ * Validates that the types of all values in this object match their expected types
+ * recursively.
+ *
+ * This method is _not_ forwards compatible with new types from the API for existing
+ * fields.
+ *
+ * @throws OpenAIInvalidDataException if any value type in this object doesn't match
+ * its expected type.
+ */
fun validate(): User = apply {
if (validated) {
return@apply
@@ -4088,6 +4174,16 @@ private constructor(
private var validated: Boolean = false
+ /**
+ * Validates that the types of all values in this object match their expected types
+ * recursively.
+ *
+ * This method is _not_ forwards compatible with new types from the API for existing
+ * fields.
+ *
+ * @throws OpenAIInvalidDataException if any value type in this object doesn't match its
+ * expected type.
+ */
fun validate(): Type = apply {
if (validated) {
return@apply
@@ -4279,6 +4375,15 @@ private constructor(
private var validated: Boolean = false
+ /**
+ * Validates that the types of all values in this object match their expected types
+ * recursively.
+ *
+ * This method is _not_ forwards compatible with new types from the API for existing fields.
+ *
+ * @throws OpenAIInvalidDataException if any value type in this object doesn't match its
+ * expected type.
+ */
fun validate(): ApiKeyCreated = apply {
if (validated) {
return@apply
@@ -4429,6 +4534,16 @@ private constructor(
private var validated: Boolean = false
+ /**
+ * Validates that the types of all values in this object match their expected types
+ * recursively.
+ *
+ * This method is _not_ forwards compatible with new types from the API for existing
+ * fields.
+ *
+ * @throws OpenAIInvalidDataException if any value type in this object doesn't match its
+ * expected type.
+ */
fun validate(): Data = apply {
if (validated) {
return@apply
@@ -4590,6 +4705,15 @@ private constructor(
private var validated: Boolean = false
+ /**
+ * Validates that the types of all values in this object match their expected types
+ * recursively.
+ *
+ * This method is _not_ forwards compatible with new types from the API for existing fields.
+ *
+ * @throws OpenAIInvalidDataException if any value type in this object doesn't match its
+ * expected type.
+ */
fun validate(): ApiKeyDeleted = apply {
if (validated) {
return@apply
@@ -4773,6 +4897,15 @@ private constructor(
private var validated: Boolean = false
+ /**
+ * Validates that the types of all values in this object match their expected types
+ * recursively.
+ *
+ * This method is _not_ forwards compatible with new types from the API for existing fields.
+ *
+ * @throws OpenAIInvalidDataException if any value type in this object doesn't match its
+ * expected type.
+ */
fun validate(): ApiKeyUpdated = apply {
if (validated) {
return@apply
@@ -4924,6 +5057,16 @@ private constructor(
private var validated: Boolean = false
+ /**
+ * Validates that the types of all values in this object match their expected types
+ * recursively.
+ *
+ * This method is _not_ forwards compatible with new types from the API for existing
+ * fields.
+ *
+ * @throws OpenAIInvalidDataException if any value type in this object doesn't match its
+ * expected type.
+ */
fun validate(): ChangesRequested = apply {
if (validated) {
return@apply
@@ -5119,6 +5262,15 @@ private constructor(
private var validated: Boolean = false
+ /**
+ * Validates that the types of all values in this object match their expected types
+ * recursively.
+ *
+ * This method is _not_ forwards compatible with new types from the API for existing fields.
+ *
+ * @throws OpenAIInvalidDataException if any value type in this object doesn't match its
+ * expected type.
+ */
fun validate(): CertificateCreated = apply {
if (validated) {
return@apply
@@ -5334,6 +5486,15 @@ private constructor(
private var validated: Boolean = false
+ /**
+ * Validates that the types of all values in this object match their expected types
+ * recursively.
+ *
+ * This method is _not_ forwards compatible with new types from the API for existing fields.
+ *
+ * @throws OpenAIInvalidDataException if any value type in this object doesn't match its
+ * expected type.
+ */
fun validate(): CertificateDeleted = apply {
if (validated) {
return@apply
@@ -5518,6 +5679,15 @@ private constructor(
private var validated: Boolean = false
+ /**
+ * Validates that the types of all values in this object match their expected types
+ * recursively.
+ *
+ * This method is _not_ forwards compatible with new types from the API for existing fields.
+ *
+ * @throws OpenAIInvalidDataException if any value type in this object doesn't match its
+ * expected type.
+ */
fun validate(): CertificateUpdated = apply {
if (validated) {
return@apply
@@ -5687,6 +5857,15 @@ private constructor(
private var validated: Boolean = false
+ /**
+ * Validates that the types of all values in this object match their expected types
+ * recursively.
+ *
+ * This method is _not_ forwards compatible with new types from the API for existing fields.
+ *
+ * @throws OpenAIInvalidDataException if any value type in this object doesn't match its
+ * expected type.
+ */
fun validate(): CertificatesActivated = apply {
if (validated) {
return@apply
@@ -5847,6 +6026,16 @@ private constructor(
private var validated: Boolean = false
+ /**
+ * Validates that the types of all values in this object match their expected types
+ * recursively.
+ *
+ * This method is _not_ forwards compatible with new types from the API for existing
+ * fields.
+ *
+ * @throws OpenAIInvalidDataException if any value type in this object doesn't match its
+ * expected type.
+ */
fun validate(): Certificate = apply {
if (validated) {
return@apply
@@ -6034,6 +6223,15 @@ private constructor(
private var validated: Boolean = false
+ /**
+ * Validates that the types of all values in this object match their expected types
+ * recursively.
+ *
+ * This method is _not_ forwards compatible with new types from the API for existing fields.
+ *
+ * @throws OpenAIInvalidDataException if any value type in this object doesn't match its
+ * expected type.
+ */
fun validate(): CertificatesDeactivated = apply {
if (validated) {
return@apply
@@ -6194,6 +6392,16 @@ private constructor(
private var validated: Boolean = false
+ /**
+ * Validates that the types of all values in this object match their expected types
+ * recursively.
+ *
+ * This method is _not_ forwards compatible with new types from the API for existing
+ * fields.
+ *
+ * @throws OpenAIInvalidDataException if any value type in this object doesn't match its
+ * expected type.
+ */
fun validate(): Certificate = apply {
if (validated) {
return@apply
@@ -6396,6 +6604,15 @@ private constructor(
private var validated: Boolean = false
+ /**
+ * Validates that the types of all values in this object match their expected types
+ * recursively.
+ *
+ * This method is _not_ forwards compatible with new types from the API for existing fields.
+ *
+ * @throws OpenAIInvalidDataException if any value type in this object doesn't match its
+ * expected type.
+ */
fun validate(): CheckpointPermissionCreated = apply {
if (validated) {
return@apply
@@ -6572,6 +6789,16 @@ private constructor(
private var validated: Boolean = false
+ /**
+ * Validates that the types of all values in this object match their expected types
+ * recursively.
+ *
+ * This method is _not_ forwards compatible with new types from the API for existing
+ * fields.
+ *
+ * @throws OpenAIInvalidDataException if any value type in this object doesn't match its
+ * expected type.
+ */
fun validate(): Data = apply {
if (validated) {
return@apply
@@ -6745,6 +6972,15 @@ private constructor(
private var validated: Boolean = false
+ /**
+ * Validates that the types of all values in this object match their expected types
+ * recursively.
+ *
+ * This method is _not_ forwards compatible with new types from the API for existing fields.
+ *
+ * @throws OpenAIInvalidDataException if any value type in this object doesn't match its
+ * expected type.
+ */
fun validate(): CheckpointPermissionDeleted = apply {
if (validated) {
return@apply
@@ -6907,6 +7143,15 @@ private constructor(
private var validated: Boolean = false
+ /**
+ * Validates that the types of all values in this object match their expected types
+ * recursively.
+ *
+ * This method is _not_ forwards compatible with new types from the API for existing fields.
+ *
+ * @throws OpenAIInvalidDataException if any value type in this object doesn't match its
+ * expected type.
+ */
fun validate(): ExternalKeyRegistered = apply {
if (validated) {
return@apply
@@ -7051,6 +7296,15 @@ private constructor(
private var validated: Boolean = false
+ /**
+ * Validates that the types of all values in this object match their expected types
+ * recursively.
+ *
+ * This method is _not_ forwards compatible with new types from the API for existing fields.
+ *
+ * @throws OpenAIInvalidDataException if any value type in this object doesn't match its
+ * expected type.
+ */
fun validate(): ExternalKeyRemoved = apply {
if (validated) {
return@apply
@@ -7224,6 +7478,15 @@ private constructor(
private var validated: Boolean = false
+ /**
+ * Validates that the types of all values in this object match their expected types
+ * recursively.
+ *
+ * This method is _not_ forwards compatible with new types from the API for existing fields.
+ *
+ * @throws OpenAIInvalidDataException if any value type in this object doesn't match its
+ * expected type.
+ */
fun validate(): GroupCreated = apply {
if (validated) {
return@apply
@@ -7359,6 +7622,16 @@ private constructor(
private var validated: Boolean = false
+ /**
+ * Validates that the types of all values in this object match their expected types
+ * recursively.
+ *
+ * This method is _not_ forwards compatible with new types from the API for existing
+ * fields.
+ *
+ * @throws OpenAIInvalidDataException if any value type in this object doesn't match its
+ * expected type.
+ */
fun validate(): Data = apply {
if (validated) {
return@apply
@@ -7521,6 +7794,15 @@ private constructor(
private var validated: Boolean = false
+ /**
+ * Validates that the types of all values in this object match their expected types
+ * recursively.
+ *
+ * This method is _not_ forwards compatible with new types from the API for existing fields.
+ *
+ * @throws OpenAIInvalidDataException if any value type in this object doesn't match its
+ * expected type.
+ */
fun validate(): GroupDeleted = apply {
if (validated) {
return@apply
@@ -7703,6 +7985,15 @@ private constructor(
private var validated: Boolean = false
+ /**
+ * Validates that the types of all values in this object match their expected types
+ * recursively.
+ *
+ * This method is _not_ forwards compatible with new types from the API for existing fields.
+ *
+ * @throws OpenAIInvalidDataException if any value type in this object doesn't match its
+ * expected type.
+ */
fun validate(): GroupUpdated = apply {
if (validated) {
return@apply
@@ -7840,6 +8131,16 @@ private constructor(
private var validated: Boolean = false
+ /**
+ * Validates that the types of all values in this object match their expected types
+ * recursively.
+ *
+ * This method is _not_ forwards compatible with new types from the API for existing
+ * fields.
+ *
+ * @throws OpenAIInvalidDataException if any value type in this object doesn't match its
+ * expected type.
+ */
fun validate(): ChangesRequested = apply {
if (validated) {
return@apply
@@ -8004,6 +8305,15 @@ private constructor(
private var validated: Boolean = false
+ /**
+ * Validates that the types of all values in this object match their expected types
+ * recursively.
+ *
+ * This method is _not_ forwards compatible with new types from the API for existing fields.
+ *
+ * @throws OpenAIInvalidDataException if any value type in this object doesn't match its
+ * expected type.
+ */
fun validate(): InviteAccepted = apply {
if (validated) {
return@apply
@@ -8146,6 +8456,15 @@ private constructor(
private var validated: Boolean = false
+ /**
+ * Validates that the types of all values in this object match their expected types
+ * recursively.
+ *
+ * This method is _not_ forwards compatible with new types from the API for existing fields.
+ *
+ * @throws OpenAIInvalidDataException if any value type in this object doesn't match its
+ * expected type.
+ */
fun validate(): InviteDeleted = apply {
if (validated) {
return@apply
@@ -8319,6 +8638,15 @@ private constructor(
private var validated: Boolean = false
+ /**
+ * Validates that the types of all values in this object match their expected types
+ * recursively.
+ *
+ * This method is _not_ forwards compatible with new types from the API for existing fields.
+ *
+ * @throws OpenAIInvalidDataException if any value type in this object doesn't match its
+ * expected type.
+ */
fun validate(): InviteSent = apply {
if (validated) {
return@apply
@@ -8480,6 +8808,16 @@ private constructor(
private var validated: Boolean = false
+ /**
+ * Validates that the types of all values in this object match their expected types
+ * recursively.
+ *
+ * This method is _not_ forwards compatible with new types from the API for existing
+ * fields.
+ *
+ * @throws OpenAIInvalidDataException if any value type in this object doesn't match its
+ * expected type.
+ */
fun validate(): Data = apply {
if (validated) {
return@apply
@@ -8669,6 +9007,15 @@ private constructor(
private var validated: Boolean = false
+ /**
+ * Validates that the types of all values in this object match their expected types
+ * recursively.
+ *
+ * This method is _not_ forwards compatible with new types from the API for existing fields.
+ *
+ * @throws OpenAIInvalidDataException if any value type in this object doesn't match its
+ * expected type.
+ */
fun validate(): IpAllowlistConfigActivated = apply {
if (validated) {
return@apply
@@ -8828,6 +9175,16 @@ private constructor(
private var validated: Boolean = false
+ /**
+ * Validates that the types of all values in this object match their expected types
+ * recursively.
+ *
+ * This method is _not_ forwards compatible with new types from the API for existing
+ * fields.
+ *
+ * @throws OpenAIInvalidDataException if any value type in this object doesn't match its
+ * expected type.
+ */
fun validate(): Config = apply {
if (validated) {
return@apply
@@ -9016,6 +9373,15 @@ private constructor(
private var validated: Boolean = false
+ /**
+ * Validates that the types of all values in this object match their expected types
+ * recursively.
+ *
+ * This method is _not_ forwards compatible with new types from the API for existing fields.
+ *
+ * @throws OpenAIInvalidDataException if any value type in this object doesn't match its
+ * expected type.
+ */
fun validate(): IpAllowlistConfigDeactivated = apply {
if (validated) {
return@apply
@@ -9175,6 +9541,16 @@ private constructor(
private var validated: Boolean = false
+ /**
+ * Validates that the types of all values in this object match their expected types
+ * recursively.
+ *
+ * This method is _not_ forwards compatible with new types from the API for existing
+ * fields.
+ *
+ * @throws OpenAIInvalidDataException if any value type in this object doesn't match its
+ * expected type.
+ */
fun validate(): Config = apply {
if (validated) {
return@apply
@@ -9425,6 +9801,15 @@ private constructor(
private var validated: Boolean = false
+ /**
+ * Validates that the types of all values in this object match their expected types
+ * recursively.
+ *
+ * This method is _not_ forwards compatible with new types from the API for existing fields.
+ *
+ * @throws OpenAIInvalidDataException if any value type in this object doesn't match its
+ * expected type.
+ */
fun validate(): IpAllowlistCreated = apply {
if (validated) {
return@apply
@@ -9663,6 +10048,15 @@ private constructor(
private var validated: Boolean = false
+ /**
+ * Validates that the types of all values in this object match their expected types
+ * recursively.
+ *
+ * This method is _not_ forwards compatible with new types from the API for existing fields.
+ *
+ * @throws OpenAIInvalidDataException if any value type in this object doesn't match its
+ * expected type.
+ */
fun validate(): IpAllowlistDeleted = apply {
if (validated) {
return@apply
@@ -9869,6 +10263,15 @@ private constructor(
private var validated: Boolean = false
+ /**
+ * Validates that the types of all values in this object match their expected types
+ * recursively.
+ *
+ * This method is _not_ forwards compatible with new types from the API for existing fields.
+ *
+ * @throws OpenAIInvalidDataException if any value type in this object doesn't match its
+ * expected type.
+ */
fun validate(): IpAllowlistUpdated = apply {
if (validated) {
return@apply
@@ -10056,6 +10459,15 @@ private constructor(
private var validated: Boolean = false
+ /**
+ * Validates that the types of all values in this object match their expected types
+ * recursively.
+ *
+ * This method is _not_ forwards compatible with new types from the API for existing fields.
+ *
+ * @throws OpenAIInvalidDataException if any value type in this object doesn't match its
+ * expected type.
+ */
fun validate(): LoginFailed = apply {
if (validated) {
return@apply
@@ -10246,6 +10658,15 @@ private constructor(
private var validated: Boolean = false
+ /**
+ * Validates that the types of all values in this object match their expected types
+ * recursively.
+ *
+ * This method is _not_ forwards compatible with new types from the API for existing fields.
+ *
+ * @throws OpenAIInvalidDataException if any value type in this object doesn't match its
+ * expected type.
+ */
fun validate(): LogoutFailed = apply {
if (validated) {
return@apply
@@ -10436,6 +10857,15 @@ private constructor(
private var validated: Boolean = false
+ /**
+ * Validates that the types of all values in this object match their expected types
+ * recursively.
+ *
+ * This method is _not_ forwards compatible with new types from the API for existing fields.
+ *
+ * @throws OpenAIInvalidDataException if any value type in this object doesn't match its
+ * expected type.
+ */
fun validate(): OrganizationUpdated = apply {
if (validated) {
return@apply
@@ -10830,6 +11260,16 @@ private constructor(
private var validated: Boolean = false
+ /**
+ * Validates that the types of all values in this object match their expected types
+ * recursively.
+ *
+ * This method is _not_ forwards compatible with new types from the API for existing
+ * fields.
+ *
+ * @throws OpenAIInvalidDataException if any value type in this object doesn't match its
+ * expected type.
+ */
fun validate(): ChangesRequested = apply {
if (validated) {
return@apply
@@ -11058,6 +11498,15 @@ private constructor(
private var validated: Boolean = false
+ /**
+ * Validates that the types of all values in this object match their expected types
+ * recursively.
+ *
+ * This method is _not_ forwards compatible with new types from the API for existing fields.
+ *
+ * @throws OpenAIInvalidDataException if any value type in this object doesn't match its
+ * expected type.
+ */
fun validate(): Project = apply {
if (validated) {
return@apply
@@ -11204,6 +11653,15 @@ private constructor(
private var validated: Boolean = false
+ /**
+ * Validates that the types of all values in this object match their expected types
+ * recursively.
+ *
+ * This method is _not_ forwards compatible with new types from the API for existing fields.
+ *
+ * @throws OpenAIInvalidDataException if any value type in this object doesn't match its
+ * expected type.
+ */
fun validate(): ProjectArchived = apply {
if (validated) {
return@apply
@@ -11378,6 +11836,15 @@ private constructor(
private var validated: Boolean = false
+ /**
+ * Validates that the types of all values in this object match their expected types
+ * recursively.
+ *
+ * This method is _not_ forwards compatible with new types from the API for existing fields.
+ *
+ * @throws OpenAIInvalidDataException if any value type in this object doesn't match its
+ * expected type.
+ */
fun validate(): ProjectCreated = apply {
if (validated) {
return@apply
@@ -11539,6 +12006,16 @@ private constructor(
private var validated: Boolean = false
+ /**
+ * Validates that the types of all values in this object match their expected types
+ * recursively.
+ *
+ * This method is _not_ forwards compatible with new types from the API for existing
+ * fields.
+ *
+ * @throws OpenAIInvalidDataException if any value type in this object doesn't match its
+ * expected type.
+ */
fun validate(): Data = apply {
if (validated) {
return@apply
@@ -11704,6 +12181,15 @@ private constructor(
private var validated: Boolean = false
+ /**
+ * Validates that the types of all values in this object match their expected types
+ * recursively.
+ *
+ * This method is _not_ forwards compatible with new types from the API for existing fields.
+ *
+ * @throws OpenAIInvalidDataException if any value type in this object doesn't match its
+ * expected type.
+ */
fun validate(): ProjectDeleted = apply {
if (validated) {
return@apply
@@ -11887,6 +12373,15 @@ private constructor(
private var validated: Boolean = false
+ /**
+ * Validates that the types of all values in this object match their expected types
+ * recursively.
+ *
+ * This method is _not_ forwards compatible with new types from the API for existing fields.
+ *
+ * @throws OpenAIInvalidDataException if any value type in this object doesn't match its
+ * expected type.
+ */
fun validate(): ProjectUpdated = apply {
if (validated) {
return@apply
@@ -12019,6 +12514,16 @@ private constructor(
private var validated: Boolean = false
+ /**
+ * Validates that the types of all values in this object match their expected types
+ * recursively.
+ *
+ * This method is _not_ forwards compatible with new types from the API for existing
+ * fields.
+ *
+ * @throws OpenAIInvalidDataException if any value type in this object doesn't match its
+ * expected type.
+ */
fun validate(): ChangesRequested = apply {
if (validated) {
return@apply
@@ -12183,6 +12688,15 @@ private constructor(
private var validated: Boolean = false
+ /**
+ * Validates that the types of all values in this object match their expected types
+ * recursively.
+ *
+ * This method is _not_ forwards compatible with new types from the API for existing fields.
+ *
+ * @throws OpenAIInvalidDataException if any value type in this object doesn't match its
+ * expected type.
+ */
fun validate(): RateLimitDeleted = apply {
if (validated) {
return@apply
@@ -12366,6 +12880,15 @@ private constructor(
private var validated: Boolean = false
+ /**
+ * Validates that the types of all values in this object match their expected types
+ * recursively.
+ *
+ * This method is _not_ forwards compatible with new types from the API for existing fields.
+ *
+ * @throws OpenAIInvalidDataException if any value type in this object doesn't match its
+ * expected type.
+ */
fun validate(): RateLimitUpdated = apply {
if (validated) {
return@apply
@@ -12724,6 +13247,16 @@ private constructor(
private var validated: Boolean = false
+ /**
+ * Validates that the types of all values in this object match their expected types
+ * recursively.
+ *
+ * This method is _not_ forwards compatible with new types from the API for existing
+ * fields.
+ *
+ * @throws OpenAIInvalidDataException if any value type in this object doesn't match its
+ * expected type.
+ */
fun validate(): ChangesRequested = apply {
if (validated) {
return@apply
@@ -13072,6 +13605,15 @@ private constructor(
private var validated: Boolean = false
+ /**
+ * Validates that the types of all values in this object match their expected types
+ * recursively.
+ *
+ * This method is _not_ forwards compatible with new types from the API for existing fields.
+ *
+ * @throws OpenAIInvalidDataException if any value type in this object doesn't match its
+ * expected type.
+ */
fun validate(): RoleAssignmentCreated = apply {
if (validated) {
return@apply
@@ -13395,6 +13937,15 @@ private constructor(
private var validated: Boolean = false
+ /**
+ * Validates that the types of all values in this object match their expected types
+ * recursively.
+ *
+ * This method is _not_ forwards compatible with new types from the API for existing fields.
+ *
+ * @throws OpenAIInvalidDataException if any value type in this object doesn't match its
+ * expected type.
+ */
fun validate(): RoleAssignmentDeleted = apply {
if (validated) {
return@apply
@@ -13723,6 +14274,15 @@ private constructor(
private var validated: Boolean = false
+ /**
+ * Validates that the types of all values in this object match their expected types
+ * recursively.
+ *
+ * This method is _not_ forwards compatible with new types from the API for existing fields.
+ *
+ * @throws OpenAIInvalidDataException if any value type in this object doesn't match its
+ * expected type.
+ */
fun validate(): RoleCreated = apply {
if (validated) {
return@apply
@@ -13881,6 +14441,15 @@ private constructor(
private var validated: Boolean = false
+ /**
+ * Validates that the types of all values in this object match their expected types
+ * recursively.
+ *
+ * This method is _not_ forwards compatible with new types from the API for existing fields.
+ *
+ * @throws OpenAIInvalidDataException if any value type in this object doesn't match its
+ * expected type.
+ */
fun validate(): RoleDeleted = apply {
if (validated) {
return@apply
@@ -14063,6 +14632,15 @@ private constructor(
private var validated: Boolean = false
+ /**
+ * Validates that the types of all values in this object match their expected types
+ * recursively.
+ *
+ * This method is _not_ forwards compatible with new types from the API for existing fields.
+ *
+ * @throws OpenAIInvalidDataException if any value type in this object doesn't match its
+ * expected type.
+ */
fun validate(): RoleUpdated = apply {
if (validated) {
return@apply
@@ -14453,6 +15031,16 @@ private constructor(
private var validated: Boolean = false
+ /**
+ * Validates that the types of all values in this object match their expected types
+ * recursively.
+ *
+ * This method is _not_ forwards compatible with new types from the API for existing
+ * fields.
+ *
+ * @throws OpenAIInvalidDataException if any value type in this object doesn't match its
+ * expected type.
+ */
fun validate(): ChangesRequested = apply {
if (validated) {
return@apply
@@ -14645,6 +15233,15 @@ private constructor(
private var validated: Boolean = false
+ /**
+ * Validates that the types of all values in this object match their expected types
+ * recursively.
+ *
+ * This method is _not_ forwards compatible with new types from the API for existing fields.
+ *
+ * @throws OpenAIInvalidDataException if any value type in this object doesn't match its
+ * expected type.
+ */
fun validate(): ScimDisabled = apply {
if (validated) {
return@apply
@@ -14786,6 +15383,15 @@ private constructor(
private var validated: Boolean = false
+ /**
+ * Validates that the types of all values in this object match their expected types
+ * recursively.
+ *
+ * This method is _not_ forwards compatible with new types from the API for existing fields.
+ *
+ * @throws OpenAIInvalidDataException if any value type in this object doesn't match its
+ * expected type.
+ */
fun validate(): ScimEnabled = apply {
if (validated) {
return@apply
@@ -14961,6 +15567,15 @@ private constructor(
private var validated: Boolean = false
+ /**
+ * Validates that the types of all values in this object match their expected types
+ * recursively.
+ *
+ * This method is _not_ forwards compatible with new types from the API for existing fields.
+ *
+ * @throws OpenAIInvalidDataException if any value type in this object doesn't match its
+ * expected type.
+ */
fun validate(): ServiceAccountCreated = apply {
if (validated) {
return@apply
@@ -15091,6 +15706,16 @@ private constructor(
private var validated: Boolean = false
+ /**
+ * Validates that the types of all values in this object match their expected types
+ * recursively.
+ *
+ * This method is _not_ forwards compatible with new types from the API for existing
+ * fields.
+ *
+ * @throws OpenAIInvalidDataException if any value type in this object doesn't match its
+ * expected type.
+ */
fun validate(): Data = apply {
if (validated) {
return@apply
@@ -15254,6 +15879,15 @@ private constructor(
private var validated: Boolean = false
+ /**
+ * Validates that the types of all values in this object match their expected types
+ * recursively.
+ *
+ * This method is _not_ forwards compatible with new types from the API for existing fields.
+ *
+ * @throws OpenAIInvalidDataException if any value type in this object doesn't match its
+ * expected type.
+ */
fun validate(): ServiceAccountDeleted = apply {
if (validated) {
return@apply
@@ -15439,6 +16073,15 @@ private constructor(
private var validated: Boolean = false
+ /**
+ * Validates that the types of all values in this object match their expected types
+ * recursively.
+ *
+ * This method is _not_ forwards compatible with new types from the API for existing fields.
+ *
+ * @throws OpenAIInvalidDataException if any value type in this object doesn't match its
+ * expected type.
+ */
fun validate(): ServiceAccountUpdated = apply {
if (validated) {
return@apply
@@ -15571,6 +16214,16 @@ private constructor(
private var validated: Boolean = false
+ /**
+ * Validates that the types of all values in this object match their expected types
+ * recursively.
+ *
+ * This method is _not_ forwards compatible with new types from the API for existing
+ * fields.
+ *
+ * @throws OpenAIInvalidDataException if any value type in this object doesn't match its
+ * expected type.
+ */
fun validate(): ChangesRequested = apply {
if (validated) {
return@apply
@@ -15765,6 +16418,15 @@ private constructor(
private var validated: Boolean = false
+ /**
+ * Validates that the types of all values in this object match their expected types
+ * recursively.
+ *
+ * This method is _not_ forwards compatible with new types from the API for existing fields.
+ *
+ * @throws OpenAIInvalidDataException if any value type in this object doesn't match its
+ * expected type.
+ */
fun validate(): UserAdded = apply {
if (validated) {
return@apply
@@ -15895,6 +16557,16 @@ private constructor(
private var validated: Boolean = false
+ /**
+ * Validates that the types of all values in this object match their expected types
+ * recursively.
+ *
+ * This method is _not_ forwards compatible with new types from the API for existing
+ * fields.
+ *
+ * @throws OpenAIInvalidDataException if any value type in this object doesn't match its
+ * expected type.
+ */
fun validate(): Data = apply {
if (validated) {
return@apply
@@ -16055,6 +16727,15 @@ private constructor(
private var validated: Boolean = false
+ /**
+ * Validates that the types of all values in this object match their expected types
+ * recursively.
+ *
+ * This method is _not_ forwards compatible with new types from the API for existing fields.
+ *
+ * @throws OpenAIInvalidDataException if any value type in this object doesn't match its
+ * expected type.
+ */
fun validate(): UserDeleted = apply {
if (validated) {
return@apply
@@ -16237,6 +16918,15 @@ private constructor(
private var validated: Boolean = false
+ /**
+ * Validates that the types of all values in this object match their expected types
+ * recursively.
+ *
+ * This method is _not_ forwards compatible with new types from the API for existing fields.
+ *
+ * @throws OpenAIInvalidDataException if any value type in this object doesn't match its
+ * expected type.
+ */
fun validate(): UserUpdated = apply {
if (validated) {
return@apply
@@ -16369,6 +17059,16 @@ private constructor(
private var validated: Boolean = false
+ /**
+ * Validates that the types of all values in this object match their expected types
+ * recursively.
+ *
+ * This method is _not_ forwards compatible with new types from the API for existing
+ * fields.
+ *
+ * @throws OpenAIInvalidDataException if any value type in this object doesn't match its
+ * expected type.
+ */
fun validate(): ChangesRequested = apply {
if (validated) {
return@apply
diff --git a/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/certificates/Certificate.kt b/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/certificates/Certificate.kt
index 7a574e0b1..006b12dee 100644
--- a/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/certificates/Certificate.kt
+++ b/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/certificates/Certificate.kt
@@ -324,6 +324,14 @@ private constructor(
private var validated: Boolean = false
+ /**
+ * Validates that the types of all values in this object match their expected types recursively.
+ *
+ * This method is _not_ forwards compatible with new types from the API for existing fields.
+ *
+ * @throws OpenAIInvalidDataException if any value type in this object doesn't match its
+ * expected type.
+ */
fun validate(): Certificate = apply {
if (validated) {
return@apply
@@ -523,6 +531,15 @@ private constructor(
private var validated: Boolean = false
+ /**
+ * Validates that the types of all values in this object match their expected types
+ * recursively.
+ *
+ * This method is _not_ forwards compatible with new types from the API for existing fields.
+ *
+ * @throws OpenAIInvalidDataException if any value type in this object doesn't match its
+ * expected type.
+ */
fun validate(): CertificateDetails = apply {
if (validated) {
return@apply
@@ -677,6 +694,15 @@ private constructor(
private var validated: Boolean = false
+ /**
+ * Validates that the types of all values in this object match their expected types
+ * recursively.
+ *
+ * This method is _not_ forwards compatible with new types from the API for existing fields.
+ *
+ * @throws OpenAIInvalidDataException if any value type in this object doesn't match its
+ * expected type.
+ */
fun validate(): Object = apply {
if (validated) {
return@apply
diff --git a/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/certificates/CertificateActivatePageResponse.kt b/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/certificates/CertificateActivatePageResponse.kt
index ca98c0ad6..81f58e6f6 100644
--- a/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/certificates/CertificateActivatePageResponse.kt
+++ b/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/certificates/CertificateActivatePageResponse.kt
@@ -184,6 +184,14 @@ private constructor(
private var validated: Boolean = false
+ /**
+ * Validates that the types of all values in this object match their expected types recursively.
+ *
+ * This method is _not_ forwards compatible with new types from the API for existing fields.
+ *
+ * @throws OpenAIInvalidDataException if any value type in this object doesn't match its
+ * expected type.
+ */
fun validate(): CertificateActivatePageResponse = apply {
if (validated) {
return@apply
diff --git a/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/certificates/CertificateActivateParams.kt b/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/certificates/CertificateActivateParams.kt
index 1a7cc6abd..3b57b19d6 100644
--- a/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/certificates/CertificateActivateParams.kt
+++ b/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/certificates/CertificateActivateParams.kt
@@ -390,6 +390,15 @@ private constructor(
private var validated: Boolean = false
+ /**
+ * Validates that the types of all values in this object match their expected types
+ * recursively.
+ *
+ * This method is _not_ forwards compatible with new types from the API for existing fields.
+ *
+ * @throws OpenAIInvalidDataException if any value type in this object doesn't match its
+ * expected type.
+ */
fun validate(): Body = apply {
if (validated) {
return@apply
diff --git a/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/certificates/CertificateActivateResponse.kt b/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/certificates/CertificateActivateResponse.kt
index f0d91f36f..47d41c0ac 100644
--- a/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/certificates/CertificateActivateResponse.kt
+++ b/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/certificates/CertificateActivateResponse.kt
@@ -307,6 +307,14 @@ private constructor(
private var validated: Boolean = false
+ /**
+ * Validates that the types of all values in this object match their expected types recursively.
+ *
+ * This method is _not_ forwards compatible with new types from the API for existing fields.
+ *
+ * @throws OpenAIInvalidDataException if any value type in this object doesn't match its
+ * expected type.
+ */
fun validate(): CertificateActivateResponse = apply {
if (validated) {
return@apply
@@ -479,6 +487,15 @@ private constructor(
private var validated: Boolean = false
+ /**
+ * Validates that the types of all values in this object match their expected types
+ * recursively.
+ *
+ * This method is _not_ forwards compatible with new types from the API for existing fields.
+ *
+ * @throws OpenAIInvalidDataException if any value type in this object doesn't match its
+ * expected type.
+ */
fun validate(): CertificateDetails = apply {
if (validated) {
return@apply
diff --git a/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/certificates/CertificateCreateParams.kt b/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/certificates/CertificateCreateParams.kt
index dda207632..32ab58ff9 100644
--- a/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/certificates/CertificateCreateParams.kt
+++ b/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/certificates/CertificateCreateParams.kt
@@ -429,6 +429,15 @@ private constructor(
private var validated: Boolean = false
+ /**
+ * Validates that the types of all values in this object match their expected types
+ * recursively.
+ *
+ * This method is _not_ forwards compatible with new types from the API for existing fields.
+ *
+ * @throws OpenAIInvalidDataException if any value type in this object doesn't match its
+ * expected type.
+ */
fun validate(): Body = apply {
if (validated) {
return@apply
diff --git a/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/certificates/CertificateDeactivatePageResponse.kt b/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/certificates/CertificateDeactivatePageResponse.kt
index c13084861..aee9f2cfc 100644
--- a/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/certificates/CertificateDeactivatePageResponse.kt
+++ b/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/certificates/CertificateDeactivatePageResponse.kt
@@ -184,6 +184,14 @@ private constructor(
private var validated: Boolean = false
+ /**
+ * Validates that the types of all values in this object match their expected types recursively.
+ *
+ * This method is _not_ forwards compatible with new types from the API for existing fields.
+ *
+ * @throws OpenAIInvalidDataException if any value type in this object doesn't match its
+ * expected type.
+ */
fun validate(): CertificateDeactivatePageResponse = apply {
if (validated) {
return@apply
diff --git a/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/certificates/CertificateDeactivateParams.kt b/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/certificates/CertificateDeactivateParams.kt
index 195a18e06..553388411 100644
--- a/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/certificates/CertificateDeactivateParams.kt
+++ b/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/certificates/CertificateDeactivateParams.kt
@@ -390,6 +390,15 @@ private constructor(
private var validated: Boolean = false
+ /**
+ * Validates that the types of all values in this object match their expected types
+ * recursively.
+ *
+ * This method is _not_ forwards compatible with new types from the API for existing fields.
+ *
+ * @throws OpenAIInvalidDataException if any value type in this object doesn't match its
+ * expected type.
+ */
fun validate(): Body = apply {
if (validated) {
return@apply
diff --git a/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/certificates/CertificateDeactivateResponse.kt b/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/certificates/CertificateDeactivateResponse.kt
index 917395c3d..0ae4ac038 100644
--- a/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/certificates/CertificateDeactivateResponse.kt
+++ b/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/certificates/CertificateDeactivateResponse.kt
@@ -308,6 +308,14 @@ private constructor(
private var validated: Boolean = false
+ /**
+ * Validates that the types of all values in this object match their expected types recursively.
+ *
+ * This method is _not_ forwards compatible with new types from the API for existing fields.
+ *
+ * @throws OpenAIInvalidDataException if any value type in this object doesn't match its
+ * expected type.
+ */
fun validate(): CertificateDeactivateResponse = apply {
if (validated) {
return@apply
@@ -480,6 +488,15 @@ private constructor(
private var validated: Boolean = false
+ /**
+ * Validates that the types of all values in this object match their expected types
+ * recursively.
+ *
+ * This method is _not_ forwards compatible with new types from the API for existing fields.
+ *
+ * @throws OpenAIInvalidDataException if any value type in this object doesn't match its
+ * expected type.
+ */
fun validate(): CertificateDetails = apply {
if (validated) {
return@apply
diff --git a/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/certificates/CertificateDeleteResponse.kt b/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/certificates/CertificateDeleteResponse.kt
index cf7d3b742..4604f242c 100644
--- a/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/certificates/CertificateDeleteResponse.kt
+++ b/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/certificates/CertificateDeleteResponse.kt
@@ -162,6 +162,14 @@ private constructor(
private var validated: Boolean = false
+ /**
+ * Validates that the types of all values in this object match their expected types recursively.
+ *
+ * This method is _not_ forwards compatible with new types from the API for existing fields.
+ *
+ * @throws OpenAIInvalidDataException if any value type in this object doesn't match its
+ * expected type.
+ */
fun validate(): CertificateDeleteResponse = apply {
if (validated) {
return@apply
diff --git a/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/certificates/CertificateListPageResponse.kt b/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/certificates/CertificateListPageResponse.kt
index dafd89652..0366b1741 100644
--- a/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/certificates/CertificateListPageResponse.kt
+++ b/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/certificates/CertificateListPageResponse.kt
@@ -276,6 +276,14 @@ private constructor(
private var validated: Boolean = false
+ /**
+ * Validates that the types of all values in this object match their expected types recursively.
+ *
+ * This method is _not_ forwards compatible with new types from the API for existing fields.
+ *
+ * @throws OpenAIInvalidDataException if any value type in this object doesn't match its
+ * expected type.
+ */
fun validate(): CertificateListPageResponse = apply {
if (validated) {
return@apply
diff --git a/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/certificates/CertificateListParams.kt b/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/certificates/CertificateListParams.kt
index d81d05e88..ccbc9bfe6 100644
--- a/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/certificates/CertificateListParams.kt
+++ b/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/certificates/CertificateListParams.kt
@@ -328,6 +328,15 @@ private constructor(
private var validated: Boolean = false
+ /**
+ * Validates that the types of all values in this object match their expected types
+ * recursively.
+ *
+ * This method is _not_ forwards compatible with new types from the API for existing fields.
+ *
+ * @throws OpenAIInvalidDataException if any value type in this object doesn't match its
+ * expected type.
+ */
fun validate(): Order = apply {
if (validated) {
return@apply
diff --git a/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/certificates/CertificateListResponse.kt b/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/certificates/CertificateListResponse.kt
index 3a6dcb2ca..2ae56e63c 100644
--- a/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/certificates/CertificateListResponse.kt
+++ b/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/certificates/CertificateListResponse.kt
@@ -307,6 +307,14 @@ private constructor(
private var validated: Boolean = false
+ /**
+ * Validates that the types of all values in this object match their expected types recursively.
+ *
+ * This method is _not_ forwards compatible with new types from the API for existing fields.
+ *
+ * @throws OpenAIInvalidDataException if any value type in this object doesn't match its
+ * expected type.
+ */
fun validate(): CertificateListResponse = apply {
if (validated) {
return@apply
@@ -479,6 +487,15 @@ private constructor(
private var validated: Boolean = false
+ /**
+ * Validates that the types of all values in this object match their expected types
+ * recursively.
+ *
+ * This method is _not_ forwards compatible with new types from the API for existing fields.
+ *
+ * @throws OpenAIInvalidDataException if any value type in this object doesn't match its
+ * expected type.
+ */
fun validate(): CertificateDetails = apply {
if (validated) {
return@apply
diff --git a/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/certificates/CertificateRetrieveParams.kt b/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/certificates/CertificateRetrieveParams.kt
index 467927cc3..6b3aea914 100644
--- a/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/certificates/CertificateRetrieveParams.kt
+++ b/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/certificates/CertificateRetrieveParams.kt
@@ -302,6 +302,15 @@ private constructor(
private var validated: Boolean = false
+ /**
+ * Validates that the types of all values in this object match their expected types
+ * recursively.
+ *
+ * This method is _not_ forwards compatible with new types from the API for existing fields.
+ *
+ * @throws OpenAIInvalidDataException if any value type in this object doesn't match its
+ * expected type.
+ */
fun validate(): Include = apply {
if (validated) {
return@apply
diff --git a/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/certificates/CertificateUpdateParams.kt b/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/certificates/CertificateUpdateParams.kt
index e77f17499..9233c6ead 100644
--- a/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/certificates/CertificateUpdateParams.kt
+++ b/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/certificates/CertificateUpdateParams.kt
@@ -346,6 +346,15 @@ private constructor(
private var validated: Boolean = false
+ /**
+ * Validates that the types of all values in this object match their expected types
+ * recursively.
+ *
+ * This method is _not_ forwards compatible with new types from the API for existing fields.
+ *
+ * @throws OpenAIInvalidDataException if any value type in this object doesn't match its
+ * expected type.
+ */
fun validate(): Body = apply {
if (validated) {
return@apply
diff --git a/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/groups/Group.kt b/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/groups/Group.kt
index 1f28507e9..5f5422d00 100644
--- a/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/groups/Group.kt
+++ b/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/groups/Group.kt
@@ -271,6 +271,14 @@ private constructor(
private var validated: Boolean = false
+ /**
+ * Validates that the types of all values in this object match their expected types recursively.
+ *
+ * This method is _not_ forwards compatible with new types from the API for existing fields.
+ *
+ * @throws OpenAIInvalidDataException if any value type in this object doesn't match its
+ * expected type.
+ */
fun validate(): Group = apply {
if (validated) {
return@apply
diff --git a/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/groups/GroupCreateParams.kt b/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/groups/GroupCreateParams.kt
index 01667dfb3..3b9b41fdb 100644
--- a/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/groups/GroupCreateParams.kt
+++ b/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/groups/GroupCreateParams.kt
@@ -355,6 +355,15 @@ private constructor(
private var validated: Boolean = false
+ /**
+ * Validates that the types of all values in this object match their expected types
+ * recursively.
+ *
+ * This method is _not_ forwards compatible with new types from the API for existing fields.
+ *
+ * @throws OpenAIInvalidDataException if any value type in this object doesn't match its
+ * expected type.
+ */
fun validate(): Body = apply {
if (validated) {
return@apply
diff --git a/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/groups/GroupDeleteResponse.kt b/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/groups/GroupDeleteResponse.kt
index 223501c99..93afb68f6 100644
--- a/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/groups/GroupDeleteResponse.kt
+++ b/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/groups/GroupDeleteResponse.kt
@@ -196,6 +196,14 @@ private constructor(
private var validated: Boolean = false
+ /**
+ * Validates that the types of all values in this object match their expected types recursively.
+ *
+ * This method is _not_ forwards compatible with new types from the API for existing fields.
+ *
+ * @throws OpenAIInvalidDataException if any value type in this object doesn't match its
+ * expected type.
+ */
fun validate(): GroupDeleteResponse = apply {
if (validated) {
return@apply
diff --git a/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/groups/GroupListPageResponse.kt b/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/groups/GroupListPageResponse.kt
index ad0d18c06..ae556e625 100644
--- a/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/groups/GroupListPageResponse.kt
+++ b/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/groups/GroupListPageResponse.kt
@@ -251,6 +251,14 @@ private constructor(
private var validated: Boolean = false
+ /**
+ * Validates that the types of all values in this object match their expected types recursively.
+ *
+ * This method is _not_ forwards compatible with new types from the API for existing fields.
+ *
+ * @throws OpenAIInvalidDataException if any value type in this object doesn't match its
+ * expected type.
+ */
fun validate(): GroupListPageResponse = apply {
if (validated) {
return@apply
diff --git a/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/groups/GroupListParams.kt b/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/groups/GroupListParams.kt
index b39f07dff..4ac584867 100644
--- a/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/groups/GroupListParams.kt
+++ b/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/groups/GroupListParams.kt
@@ -319,6 +319,15 @@ private constructor(
private var validated: Boolean = false
+ /**
+ * Validates that the types of all values in this object match their expected types
+ * recursively.
+ *
+ * This method is _not_ forwards compatible with new types from the API for existing fields.
+ *
+ * @throws OpenAIInvalidDataException if any value type in this object doesn't match its
+ * expected type.
+ */
fun validate(): Order = apply {
if (validated) {
return@apply
diff --git a/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/groups/GroupUpdateParams.kt b/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/groups/GroupUpdateParams.kt
index 15d80b70c..89b9cc424 100644
--- a/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/groups/GroupUpdateParams.kt
+++ b/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/groups/GroupUpdateParams.kt
@@ -374,6 +374,15 @@ private constructor(
private var validated: Boolean = false
+ /**
+ * Validates that the types of all values in this object match their expected types
+ * recursively.
+ *
+ * This method is _not_ forwards compatible with new types from the API for existing fields.
+ *
+ * @throws OpenAIInvalidDataException if any value type in this object doesn't match its
+ * expected type.
+ */
fun validate(): Body = apply {
if (validated) {
return@apply
diff --git a/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/groups/GroupUpdateResponse.kt b/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/groups/GroupUpdateResponse.kt
index 05df311c0..7711fef7e 100644
--- a/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/groups/GroupUpdateResponse.kt
+++ b/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/groups/GroupUpdateResponse.kt
@@ -237,6 +237,14 @@ private constructor(
private var validated: Boolean = false
+ /**
+ * Validates that the types of all values in this object match their expected types recursively.
+ *
+ * This method is _not_ forwards compatible with new types from the API for existing fields.
+ *
+ * @throws OpenAIInvalidDataException if any value type in this object doesn't match its
+ * expected type.
+ */
fun validate(): GroupUpdateResponse = apply {
if (validated) {
return@apply
diff --git a/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/groups/roles/RoleCreateParams.kt b/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/groups/roles/RoleCreateParams.kt
index 07936ac22..7a7ba11b9 100644
--- a/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/groups/roles/RoleCreateParams.kt
+++ b/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/groups/roles/RoleCreateParams.kt
@@ -374,6 +374,15 @@ private constructor(
private var validated: Boolean = false
+ /**
+ * Validates that the types of all values in this object match their expected types
+ * recursively.
+ *
+ * This method is _not_ forwards compatible with new types from the API for existing fields.
+ *
+ * @throws OpenAIInvalidDataException if any value type in this object doesn't match its
+ * expected type.
+ */
fun validate(): Body = apply {
if (validated) {
return@apply
diff --git a/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/groups/roles/RoleCreateResponse.kt b/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/groups/roles/RoleCreateResponse.kt
index 5ead2920b..b0efd3080 100644
--- a/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/groups/roles/RoleCreateResponse.kt
+++ b/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/groups/roles/RoleCreateResponse.kt
@@ -198,6 +198,14 @@ private constructor(
private var validated: Boolean = false
+ /**
+ * Validates that the types of all values in this object match their expected types recursively.
+ *
+ * This method is _not_ forwards compatible with new types from the API for existing fields.
+ *
+ * @throws OpenAIInvalidDataException if any value type in this object doesn't match its
+ * expected type.
+ */
fun validate(): RoleCreateResponse = apply {
if (validated) {
return@apply
@@ -491,6 +499,15 @@ private constructor(
private var validated: Boolean = false
+ /**
+ * Validates that the types of all values in this object match their expected types
+ * recursively.
+ *
+ * This method is _not_ forwards compatible with new types from the API for existing fields.
+ *
+ * @throws OpenAIInvalidDataException if any value type in this object doesn't match its
+ * expected type.
+ */
fun validate(): Group = apply {
if (validated) {
return@apply
diff --git a/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/groups/roles/RoleDeleteResponse.kt b/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/groups/roles/RoleDeleteResponse.kt
index 128301d61..5c9001a5b 100644
--- a/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/groups/roles/RoleDeleteResponse.kt
+++ b/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/groups/roles/RoleDeleteResponse.kt
@@ -167,6 +167,14 @@ private constructor(
private var validated: Boolean = false
+ /**
+ * Validates that the types of all values in this object match their expected types recursively.
+ *
+ * This method is _not_ forwards compatible with new types from the API for existing fields.
+ *
+ * @throws OpenAIInvalidDataException if any value type in this object doesn't match its
+ * expected type.
+ */
fun validate(): RoleDeleteResponse = apply {
if (validated) {
return@apply
diff --git a/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/groups/roles/RoleListPageResponse.kt b/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/groups/roles/RoleListPageResponse.kt
index be269f45d..6cac445a5 100644
--- a/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/groups/roles/RoleListPageResponse.kt
+++ b/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/groups/roles/RoleListPageResponse.kt
@@ -255,6 +255,14 @@ private constructor(
private var validated: Boolean = false
+ /**
+ * Validates that the types of all values in this object match their expected types recursively.
+ *
+ * This method is _not_ forwards compatible with new types from the API for existing fields.
+ *
+ * @throws OpenAIInvalidDataException if any value type in this object doesn't match its
+ * expected type.
+ */
fun validate(): RoleListPageResponse = apply {
if (validated) {
return@apply
diff --git a/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/groups/roles/RoleListParams.kt b/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/groups/roles/RoleListParams.kt
index febdba7cb..10b990602 100644
--- a/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/groups/roles/RoleListParams.kt
+++ b/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/groups/roles/RoleListParams.kt
@@ -327,6 +327,15 @@ private constructor(
private var validated: Boolean = false
+ /**
+ * Validates that the types of all values in this object match their expected types
+ * recursively.
+ *
+ * This method is _not_ forwards compatible with new types from the API for existing fields.
+ *
+ * @throws OpenAIInvalidDataException if any value type in this object doesn't match its
+ * expected type.
+ */
fun validate(): Order = apply {
if (validated) {
return@apply
diff --git a/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/groups/roles/RoleListResponse.kt b/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/groups/roles/RoleListResponse.kt
index 87de26d82..aabc3da55 100644
--- a/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/groups/roles/RoleListResponse.kt
+++ b/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/groups/roles/RoleListResponse.kt
@@ -559,6 +559,14 @@ private constructor(
private var validated: Boolean = false
+ /**
+ * Validates that the types of all values in this object match their expected types recursively.
+ *
+ * This method is _not_ forwards compatible with new types from the API for existing fields.
+ *
+ * @throws OpenAIInvalidDataException if any value type in this object doesn't match its
+ * expected type.
+ */
fun validate(): RoleListResponse = apply {
if (validated) {
return@apply
@@ -664,6 +672,15 @@ private constructor(
private var validated: Boolean = false
+ /**
+ * Validates that the types of all values in this object match their expected types
+ * recursively.
+ *
+ * This method is _not_ forwards compatible with new types from the API for existing fields.
+ *
+ * @throws OpenAIInvalidDataException if any value type in this object doesn't match its
+ * expected type.
+ */
fun validate(): CreatedByUserObj = apply {
if (validated) {
return@apply
@@ -764,6 +781,15 @@ private constructor(
private var validated: Boolean = false
+ /**
+ * Validates that the types of all values in this object match their expected types
+ * recursively.
+ *
+ * This method is _not_ forwards compatible with new types from the API for existing fields.
+ *
+ * @throws OpenAIInvalidDataException if any value type in this object doesn't match its
+ * expected type.
+ */
fun validate(): Metadata = apply {
if (validated) {
return@apply
diff --git a/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/groups/users/OrganizationGroupUser.kt b/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/groups/users/OrganizationGroupUser.kt
index 4c1029925..df7543043 100644
--- a/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/groups/users/OrganizationGroupUser.kt
+++ b/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/groups/users/OrganizationGroupUser.kt
@@ -202,6 +202,14 @@ private constructor(
private var validated: Boolean = false
+ /**
+ * Validates that the types of all values in this object match their expected types recursively.
+ *
+ * This method is _not_ forwards compatible with new types from the API for existing fields.
+ *
+ * @throws OpenAIInvalidDataException if any value type in this object doesn't match its
+ * expected type.
+ */
fun validate(): OrganizationGroupUser = apply {
if (validated) {
return@apply
diff --git a/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/groups/users/UserCreateParams.kt b/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/groups/users/UserCreateParams.kt
index 3695f7a9e..15fd6abd0 100644
--- a/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/groups/users/UserCreateParams.kt
+++ b/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/groups/users/UserCreateParams.kt
@@ -374,6 +374,15 @@ private constructor(
private var validated: Boolean = false
+ /**
+ * Validates that the types of all values in this object match their expected types
+ * recursively.
+ *
+ * This method is _not_ forwards compatible with new types from the API for existing fields.
+ *
+ * @throws OpenAIInvalidDataException if any value type in this object doesn't match its
+ * expected type.
+ */
fun validate(): Body = apply {
if (validated) {
return@apply
diff --git a/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/groups/users/UserCreateResponse.kt b/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/groups/users/UserCreateResponse.kt
index 4d2d6c61b..de4bc4a21 100644
--- a/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/groups/users/UserCreateResponse.kt
+++ b/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/groups/users/UserCreateResponse.kt
@@ -196,6 +196,14 @@ private constructor(
private var validated: Boolean = false
+ /**
+ * Validates that the types of all values in this object match their expected types recursively.
+ *
+ * This method is _not_ forwards compatible with new types from the API for existing fields.
+ *
+ * @throws OpenAIInvalidDataException if any value type in this object doesn't match its
+ * expected type.
+ */
fun validate(): UserCreateResponse = apply {
if (validated) {
return@apply
diff --git a/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/groups/users/UserDeleteResponse.kt b/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/groups/users/UserDeleteResponse.kt
index b6edac4d9..4d47508a1 100644
--- a/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/groups/users/UserDeleteResponse.kt
+++ b/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/groups/users/UserDeleteResponse.kt
@@ -163,6 +163,14 @@ private constructor(
private var validated: Boolean = false
+ /**
+ * Validates that the types of all values in this object match their expected types recursively.
+ *
+ * This method is _not_ forwards compatible with new types from the API for existing fields.
+ *
+ * @throws OpenAIInvalidDataException if any value type in this object doesn't match its
+ * expected type.
+ */
fun validate(): UserDeleteResponse = apply {
if (validated) {
return@apply
diff --git a/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/groups/users/UserListPageResponse.kt b/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/groups/users/UserListPageResponse.kt
index ff4d1fed1..6dca007e8 100644
--- a/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/groups/users/UserListPageResponse.kt
+++ b/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/groups/users/UserListPageResponse.kt
@@ -255,6 +255,14 @@ private constructor(
private var validated: Boolean = false
+ /**
+ * Validates that the types of all values in this object match their expected types recursively.
+ *
+ * This method is _not_ forwards compatible with new types from the API for existing fields.
+ *
+ * @throws OpenAIInvalidDataException if any value type in this object doesn't match its
+ * expected type.
+ */
fun validate(): UserListPageResponse = apply {
if (validated) {
return@apply
diff --git a/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/groups/users/UserListParams.kt b/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/groups/users/UserListParams.kt
index 6675ca176..4829ecb9a 100644
--- a/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/groups/users/UserListParams.kt
+++ b/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/groups/users/UserListParams.kt
@@ -333,6 +333,15 @@ private constructor(
private var validated: Boolean = false
+ /**
+ * Validates that the types of all values in this object match their expected types
+ * recursively.
+ *
+ * This method is _not_ forwards compatible with new types from the API for existing fields.
+ *
+ * @throws OpenAIInvalidDataException if any value type in this object doesn't match its
+ * expected type.
+ */
fun validate(): Order = apply {
if (validated) {
return@apply
diff --git a/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/invites/Invite.kt b/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/invites/Invite.kt
index df6608518..bf5923f77 100644
--- a/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/invites/Invite.kt
+++ b/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/invites/Invite.kt
@@ -443,6 +443,14 @@ private constructor(
private var validated: Boolean = false
+ /**
+ * Validates that the types of all values in this object match their expected types recursively.
+ *
+ * This method is _not_ forwards compatible with new types from the API for existing fields.
+ *
+ * @throws OpenAIInvalidDataException if any value type in this object doesn't match its
+ * expected type.
+ */
fun validate(): Invite = apply {
if (validated) {
return@apply
@@ -639,6 +647,15 @@ private constructor(
private var validated: Boolean = false
+ /**
+ * Validates that the types of all values in this object match their expected types
+ * recursively.
+ *
+ * This method is _not_ forwards compatible with new types from the API for existing fields.
+ *
+ * @throws OpenAIInvalidDataException if any value type in this object doesn't match its
+ * expected type.
+ */
fun validate(): Project = apply {
if (validated) {
return@apply
@@ -757,6 +774,16 @@ private constructor(
private var validated: Boolean = false
+ /**
+ * Validates that the types of all values in this object match their expected types
+ * recursively.
+ *
+ * This method is _not_ forwards compatible with new types from the API for existing
+ * fields.
+ *
+ * @throws OpenAIInvalidDataException if any value type in this object doesn't match its
+ * expected type.
+ */
fun validate(): Role = apply {
if (validated) {
return@apply
@@ -902,6 +929,15 @@ private constructor(
private var validated: Boolean = false
+ /**
+ * Validates that the types of all values in this object match their expected types
+ * recursively.
+ *
+ * This method is _not_ forwards compatible with new types from the API for existing fields.
+ *
+ * @throws OpenAIInvalidDataException if any value type in this object doesn't match its
+ * expected type.
+ */
fun validate(): Role = apply {
if (validated) {
return@apply
@@ -1034,6 +1070,15 @@ private constructor(
private var validated: Boolean = false
+ /**
+ * Validates that the types of all values in this object match their expected types
+ * recursively.
+ *
+ * This method is _not_ forwards compatible with new types from the API for existing fields.
+ *
+ * @throws OpenAIInvalidDataException if any value type in this object doesn't match its
+ * expected type.
+ */
fun validate(): Status = apply {
if (validated) {
return@apply
diff --git a/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/invites/InviteCreateParams.kt b/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/invites/InviteCreateParams.kt
index 233c6c2be..aa78bf78b 100644
--- a/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/invites/InviteCreateParams.kt
+++ b/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/invites/InviteCreateParams.kt
@@ -525,6 +525,15 @@ private constructor(
private var validated: Boolean = false
+ /**
+ * Validates that the types of all values in this object match their expected types
+ * recursively.
+ *
+ * This method is _not_ forwards compatible with new types from the API for existing fields.
+ *
+ * @throws OpenAIInvalidDataException if any value type in this object doesn't match its
+ * expected type.
+ */
fun validate(): Body = apply {
if (validated) {
return@apply
@@ -666,6 +675,15 @@ private constructor(
private var validated: Boolean = false
+ /**
+ * Validates that the types of all values in this object match their expected types
+ * recursively.
+ *
+ * This method is _not_ forwards compatible with new types from the API for existing fields.
+ *
+ * @throws OpenAIInvalidDataException if any value type in this object doesn't match its
+ * expected type.
+ */
fun validate(): Role = apply {
if (validated) {
return@apply
@@ -854,6 +872,15 @@ private constructor(
private var validated: Boolean = false
+ /**
+ * Validates that the types of all values in this object match their expected types
+ * recursively.
+ *
+ * This method is _not_ forwards compatible with new types from the API for existing fields.
+ *
+ * @throws OpenAIInvalidDataException if any value type in this object doesn't match its
+ * expected type.
+ */
fun validate(): Project = apply {
if (validated) {
return@apply
@@ -972,6 +999,16 @@ private constructor(
private var validated: Boolean = false
+ /**
+ * Validates that the types of all values in this object match their expected types
+ * recursively.
+ *
+ * This method is _not_ forwards compatible with new types from the API for existing
+ * fields.
+ *
+ * @throws OpenAIInvalidDataException if any value type in this object doesn't match its
+ * expected type.
+ */
fun validate(): Role = apply {
if (validated) {
return@apply
diff --git a/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/invites/InviteDeleteResponse.kt b/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/invites/InviteDeleteResponse.kt
index 42bf52f0b..691e88ce5 100644
--- a/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/invites/InviteDeleteResponse.kt
+++ b/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/invites/InviteDeleteResponse.kt
@@ -189,6 +189,14 @@ private constructor(
private var validated: Boolean = false
+ /**
+ * Validates that the types of all values in this object match their expected types recursively.
+ *
+ * This method is _not_ forwards compatible with new types from the API for existing fields.
+ *
+ * @throws OpenAIInvalidDataException if any value type in this object doesn't match its
+ * expected type.
+ */
fun validate(): InviteDeleteResponse = apply {
if (validated) {
return@apply
diff --git a/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/invites/InviteListPageResponse.kt b/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/invites/InviteListPageResponse.kt
index 0b0ae39c7..762af682d 100644
--- a/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/invites/InviteListPageResponse.kt
+++ b/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/invites/InviteListPageResponse.kt
@@ -281,6 +281,14 @@ private constructor(
private var validated: Boolean = false
+ /**
+ * Validates that the types of all values in this object match their expected types recursively.
+ *
+ * This method is _not_ forwards compatible with new types from the API for existing fields.
+ *
+ * @throws OpenAIInvalidDataException if any value type in this object doesn't match its
+ * expected type.
+ */
fun validate(): InviteListPageResponse = apply {
if (validated) {
return@apply
diff --git a/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/projects/Project.kt b/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/projects/Project.kt
index 0601b646d..2bee5db8d 100644
--- a/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/projects/Project.kt
+++ b/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/projects/Project.kt
@@ -350,6 +350,14 @@ private constructor(
private var validated: Boolean = false
+ /**
+ * Validates that the types of all values in this object match their expected types recursively.
+ *
+ * This method is _not_ forwards compatible with new types from the API for existing fields.
+ *
+ * @throws OpenAIInvalidDataException if any value type in this object doesn't match its
+ * expected type.
+ */
fun validate(): Project = apply {
if (validated) {
return@apply
diff --git a/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/projects/ProjectCreateParams.kt b/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/projects/ProjectCreateParams.kt
index b31b09680..4c75e2795 100644
--- a/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/projects/ProjectCreateParams.kt
+++ b/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/projects/ProjectCreateParams.kt
@@ -524,6 +524,15 @@ private constructor(
private var validated: Boolean = false
+ /**
+ * Validates that the types of all values in this object match their expected types
+ * recursively.
+ *
+ * This method is _not_ forwards compatible with new types from the API for existing fields.
+ *
+ * @throws OpenAIInvalidDataException if any value type in this object doesn't match its
+ * expected type.
+ */
fun validate(): Body = apply {
if (validated) {
return@apply
diff --git a/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/projects/ProjectListPageResponse.kt b/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/projects/ProjectListPageResponse.kt
index b1dddc616..5d26f8d20 100644
--- a/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/projects/ProjectListPageResponse.kt
+++ b/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/projects/ProjectListPageResponse.kt
@@ -268,6 +268,14 @@ private constructor(
private var validated: Boolean = false
+ /**
+ * Validates that the types of all values in this object match their expected types recursively.
+ *
+ * This method is _not_ forwards compatible with new types from the API for existing fields.
+ *
+ * @throws OpenAIInvalidDataException if any value type in this object doesn't match its
+ * expected type.
+ */
fun validate(): ProjectListPageResponse = apply {
if (validated) {
return@apply
diff --git a/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/projects/ProjectUpdateParams.kt b/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/projects/ProjectUpdateParams.kt
index c70c1668c..61e6f3f05 100644
--- a/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/projects/ProjectUpdateParams.kt
+++ b/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/projects/ProjectUpdateParams.kt
@@ -496,6 +496,15 @@ private constructor(
private var validated: Boolean = false
+ /**
+ * Validates that the types of all values in this object match their expected types
+ * recursively.
+ *
+ * This method is _not_ forwards compatible with new types from the API for existing fields.
+ *
+ * @throws OpenAIInvalidDataException if any value type in this object doesn't match its
+ * expected type.
+ */
fun validate(): Body = apply {
if (validated) {
return@apply
diff --git a/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/projects/apikeys/ApiKeyDeleteResponse.kt b/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/projects/apikeys/ApiKeyDeleteResponse.kt
index bb577842f..f5a22b9e9 100644
--- a/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/projects/apikeys/ApiKeyDeleteResponse.kt
+++ b/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/projects/apikeys/ApiKeyDeleteResponse.kt
@@ -187,6 +187,14 @@ private constructor(
private var validated: Boolean = false
+ /**
+ * Validates that the types of all values in this object match their expected types recursively.
+ *
+ * This method is _not_ forwards compatible with new types from the API for existing fields.
+ *
+ * @throws OpenAIInvalidDataException if any value type in this object doesn't match its
+ * expected type.
+ */
fun validate(): ApiKeyDeleteResponse = apply {
if (validated) {
return@apply
diff --git a/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/projects/apikeys/ApiKeyListPageResponse.kt b/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/projects/apikeys/ApiKeyListPageResponse.kt
index bae1d695b..9abbbc687 100644
--- a/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/projects/apikeys/ApiKeyListPageResponse.kt
+++ b/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/projects/apikeys/ApiKeyListPageResponse.kt
@@ -270,6 +270,14 @@ private constructor(
private var validated: Boolean = false
+ /**
+ * Validates that the types of all values in this object match their expected types recursively.
+ *
+ * This method is _not_ forwards compatible with new types from the API for existing fields.
+ *
+ * @throws OpenAIInvalidDataException if any value type in this object doesn't match its
+ * expected type.
+ */
fun validate(): ApiKeyListPageResponse = apply {
if (validated) {
return@apply
diff --git a/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/projects/apikeys/ProjectApiKey.kt b/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/projects/apikeys/ProjectApiKey.kt
index 8be7f65ac..ad430525b 100644
--- a/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/projects/apikeys/ProjectApiKey.kt
+++ b/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/projects/apikeys/ProjectApiKey.kt
@@ -347,6 +347,14 @@ private constructor(
private var validated: Boolean = false
+ /**
+ * Validates that the types of all values in this object match their expected types recursively.
+ *
+ * This method is _not_ forwards compatible with new types from the API for existing fields.
+ *
+ * @throws OpenAIInvalidDataException if any value type in this object doesn't match its
+ * expected type.
+ */
fun validate(): ProjectApiKey = apply {
if (validated) {
return@apply
@@ -559,6 +567,15 @@ private constructor(
private var validated: Boolean = false
+ /**
+ * Validates that the types of all values in this object match their expected types
+ * recursively.
+ *
+ * This method is _not_ forwards compatible with new types from the API for existing fields.
+ *
+ * @throws OpenAIInvalidDataException if any value type in this object doesn't match its
+ * expected type.
+ */
fun validate(): Owner = apply {
if (validated) {
return@apply
@@ -821,6 +838,16 @@ private constructor(
private var validated: Boolean = false
+ /**
+ * Validates that the types of all values in this object match their expected types
+ * recursively.
+ *
+ * This method is _not_ forwards compatible with new types from the API for existing
+ * fields.
+ *
+ * @throws OpenAIInvalidDataException if any value type in this object doesn't match its
+ * expected type.
+ */
fun validate(): ServiceAccount = apply {
if (validated) {
return@apply
@@ -967,6 +994,16 @@ private constructor(
private var validated: Boolean = false
+ /**
+ * Validates that the types of all values in this object match their expected types
+ * recursively.
+ *
+ * This method is _not_ forwards compatible with new types from the API for existing
+ * fields.
+ *
+ * @throws OpenAIInvalidDataException if any value type in this object doesn't match its
+ * expected type.
+ */
fun validate(): Type = apply {
if (validated) {
return@apply
@@ -1271,6 +1308,16 @@ private constructor(
private var validated: Boolean = false
+ /**
+ * Validates that the types of all values in this object match their expected types
+ * recursively.
+ *
+ * This method is _not_ forwards compatible with new types from the API for existing
+ * fields.
+ *
+ * @throws OpenAIInvalidDataException if any value type in this object doesn't match its
+ * expected type.
+ */
fun validate(): User = apply {
if (validated) {
return@apply
diff --git a/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/projects/certificates/CertificateActivatePageResponse.kt b/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/projects/certificates/CertificateActivatePageResponse.kt
index e52aac909..59e1910f2 100644
--- a/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/projects/certificates/CertificateActivatePageResponse.kt
+++ b/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/projects/certificates/CertificateActivatePageResponse.kt
@@ -185,6 +185,14 @@ private constructor(
private var validated: Boolean = false
+ /**
+ * Validates that the types of all values in this object match their expected types recursively.
+ *
+ * This method is _not_ forwards compatible with new types from the API for existing fields.
+ *
+ * @throws OpenAIInvalidDataException if any value type in this object doesn't match its
+ * expected type.
+ */
fun validate(): CertificateActivatePageResponse = apply {
if (validated) {
return@apply
diff --git a/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/projects/certificates/CertificateActivateParams.kt b/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/projects/certificates/CertificateActivateParams.kt
index 6934f83ee..9b0b6f577 100644
--- a/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/projects/certificates/CertificateActivateParams.kt
+++ b/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/projects/certificates/CertificateActivateParams.kt
@@ -408,6 +408,15 @@ private constructor(
private var validated: Boolean = false
+ /**
+ * Validates that the types of all values in this object match their expected types
+ * recursively.
+ *
+ * This method is _not_ forwards compatible with new types from the API for existing fields.
+ *
+ * @throws OpenAIInvalidDataException if any value type in this object doesn't match its
+ * expected type.
+ */
fun validate(): Body = apply {
if (validated) {
return@apply
diff --git a/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/projects/certificates/CertificateActivateResponse.kt b/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/projects/certificates/CertificateActivateResponse.kt
index e0b7e03e1..e7761291b 100644
--- a/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/projects/certificates/CertificateActivateResponse.kt
+++ b/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/projects/certificates/CertificateActivateResponse.kt
@@ -307,6 +307,14 @@ private constructor(
private var validated: Boolean = false
+ /**
+ * Validates that the types of all values in this object match their expected types recursively.
+ *
+ * This method is _not_ forwards compatible with new types from the API for existing fields.
+ *
+ * @throws OpenAIInvalidDataException if any value type in this object doesn't match its
+ * expected type.
+ */
fun validate(): CertificateActivateResponse = apply {
if (validated) {
return@apply
@@ -479,6 +487,15 @@ private constructor(
private var validated: Boolean = false
+ /**
+ * Validates that the types of all values in this object match their expected types
+ * recursively.
+ *
+ * This method is _not_ forwards compatible with new types from the API for existing fields.
+ *
+ * @throws OpenAIInvalidDataException if any value type in this object doesn't match its
+ * expected type.
+ */
fun validate(): CertificateDetails = apply {
if (validated) {
return@apply
diff --git a/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/projects/certificates/CertificateDeactivatePageResponse.kt b/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/projects/certificates/CertificateDeactivatePageResponse.kt
index 8d40b4603..937df49dc 100644
--- a/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/projects/certificates/CertificateDeactivatePageResponse.kt
+++ b/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/projects/certificates/CertificateDeactivatePageResponse.kt
@@ -185,6 +185,14 @@ private constructor(
private var validated: Boolean = false
+ /**
+ * Validates that the types of all values in this object match their expected types recursively.
+ *
+ * This method is _not_ forwards compatible with new types from the API for existing fields.
+ *
+ * @throws OpenAIInvalidDataException if any value type in this object doesn't match its
+ * expected type.
+ */
fun validate(): CertificateDeactivatePageResponse = apply {
if (validated) {
return@apply
diff --git a/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/projects/certificates/CertificateDeactivateParams.kt b/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/projects/certificates/CertificateDeactivateParams.kt
index 9d628537d..22484edea 100644
--- a/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/projects/certificates/CertificateDeactivateParams.kt
+++ b/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/projects/certificates/CertificateDeactivateParams.kt
@@ -407,6 +407,15 @@ private constructor(
private var validated: Boolean = false
+ /**
+ * Validates that the types of all values in this object match their expected types
+ * recursively.
+ *
+ * This method is _not_ forwards compatible with new types from the API for existing fields.
+ *
+ * @throws OpenAIInvalidDataException if any value type in this object doesn't match its
+ * expected type.
+ */
fun validate(): Body = apply {
if (validated) {
return@apply
diff --git a/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/projects/certificates/CertificateDeactivateResponse.kt b/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/projects/certificates/CertificateDeactivateResponse.kt
index 1935f2435..37b912afc 100644
--- a/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/projects/certificates/CertificateDeactivateResponse.kt
+++ b/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/projects/certificates/CertificateDeactivateResponse.kt
@@ -308,6 +308,14 @@ private constructor(
private var validated: Boolean = false
+ /**
+ * Validates that the types of all values in this object match their expected types recursively.
+ *
+ * This method is _not_ forwards compatible with new types from the API for existing fields.
+ *
+ * @throws OpenAIInvalidDataException if any value type in this object doesn't match its
+ * expected type.
+ */
fun validate(): CertificateDeactivateResponse = apply {
if (validated) {
return@apply
@@ -480,6 +488,15 @@ private constructor(
private var validated: Boolean = false
+ /**
+ * Validates that the types of all values in this object match their expected types
+ * recursively.
+ *
+ * This method is _not_ forwards compatible with new types from the API for existing fields.
+ *
+ * @throws OpenAIInvalidDataException if any value type in this object doesn't match its
+ * expected type.
+ */
fun validate(): CertificateDetails = apply {
if (validated) {
return@apply
diff --git a/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/projects/certificates/CertificateListPageResponse.kt b/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/projects/certificates/CertificateListPageResponse.kt
index d0e836504..e501f84cb 100644
--- a/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/projects/certificates/CertificateListPageResponse.kt
+++ b/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/projects/certificates/CertificateListPageResponse.kt
@@ -276,6 +276,14 @@ private constructor(
private var validated: Boolean = false
+ /**
+ * Validates that the types of all values in this object match their expected types recursively.
+ *
+ * This method is _not_ forwards compatible with new types from the API for existing fields.
+ *
+ * @throws OpenAIInvalidDataException if any value type in this object doesn't match its
+ * expected type.
+ */
fun validate(): CertificateListPageResponse = apply {
if (validated) {
return@apply
diff --git a/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/projects/certificates/CertificateListParams.kt b/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/projects/certificates/CertificateListParams.kt
index b50dbcea1..6e1422a64 100644
--- a/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/projects/certificates/CertificateListParams.kt
+++ b/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/projects/certificates/CertificateListParams.kt
@@ -345,6 +345,15 @@ private constructor(
private var validated: Boolean = false
+ /**
+ * Validates that the types of all values in this object match their expected types
+ * recursively.
+ *
+ * This method is _not_ forwards compatible with new types from the API for existing fields.
+ *
+ * @throws OpenAIInvalidDataException if any value type in this object doesn't match its
+ * expected type.
+ */
fun validate(): Order = apply {
if (validated) {
return@apply
diff --git a/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/projects/certificates/CertificateListResponse.kt b/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/projects/certificates/CertificateListResponse.kt
index 0dd5347cf..ed4f1e593 100644
--- a/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/projects/certificates/CertificateListResponse.kt
+++ b/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/projects/certificates/CertificateListResponse.kt
@@ -307,6 +307,14 @@ private constructor(
private var validated: Boolean = false
+ /**
+ * Validates that the types of all values in this object match their expected types recursively.
+ *
+ * This method is _not_ forwards compatible with new types from the API for existing fields.
+ *
+ * @throws OpenAIInvalidDataException if any value type in this object doesn't match its
+ * expected type.
+ */
fun validate(): CertificateListResponse = apply {
if (validated) {
return@apply
@@ -479,6 +487,15 @@ private constructor(
private var validated: Boolean = false
+ /**
+ * Validates that the types of all values in this object match their expected types
+ * recursively.
+ *
+ * This method is _not_ forwards compatible with new types from the API for existing fields.
+ *
+ * @throws OpenAIInvalidDataException if any value type in this object doesn't match its
+ * expected type.
+ */
fun validate(): CertificateDetails = apply {
if (validated) {
return@apply
diff --git a/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/projects/groups/GroupCreateParams.kt b/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/projects/groups/GroupCreateParams.kt
index 122230a4e..ad942b84a 100644
--- a/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/projects/groups/GroupCreateParams.kt
+++ b/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/projects/groups/GroupCreateParams.kt
@@ -440,6 +440,15 @@ private constructor(
private var validated: Boolean = false
+ /**
+ * Validates that the types of all values in this object match their expected types
+ * recursively.
+ *
+ * This method is _not_ forwards compatible with new types from the API for existing fields.
+ *
+ * @throws OpenAIInvalidDataException if any value type in this object doesn't match its
+ * expected type.
+ */
fun validate(): Body = apply {
if (validated) {
return@apply
diff --git a/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/projects/groups/GroupDeleteResponse.kt b/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/projects/groups/GroupDeleteResponse.kt
index bfae1911c..55f3fb9c9 100644
--- a/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/projects/groups/GroupDeleteResponse.kt
+++ b/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/projects/groups/GroupDeleteResponse.kt
@@ -163,6 +163,14 @@ private constructor(
private var validated: Boolean = false
+ /**
+ * Validates that the types of all values in this object match their expected types recursively.
+ *
+ * This method is _not_ forwards compatible with new types from the API for existing fields.
+ *
+ * @throws OpenAIInvalidDataException if any value type in this object doesn't match its
+ * expected type.
+ */
fun validate(): GroupDeleteResponse = apply {
if (validated) {
return@apply
diff --git a/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/projects/groups/GroupListPageResponse.kt b/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/projects/groups/GroupListPageResponse.kt
index e9c52bc89..c48ec1faf 100644
--- a/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/projects/groups/GroupListPageResponse.kt
+++ b/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/projects/groups/GroupListPageResponse.kt
@@ -253,6 +253,14 @@ private constructor(
private var validated: Boolean = false
+ /**
+ * Validates that the types of all values in this object match their expected types recursively.
+ *
+ * This method is _not_ forwards compatible with new types from the API for existing fields.
+ *
+ * @throws OpenAIInvalidDataException if any value type in this object doesn't match its
+ * expected type.
+ */
fun validate(): GroupListPageResponse = apply {
if (validated) {
return@apply
diff --git a/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/projects/groups/GroupListParams.kt b/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/projects/groups/GroupListParams.kt
index e85a33a87..4ef505c27 100644
--- a/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/projects/groups/GroupListParams.kt
+++ b/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/projects/groups/GroupListParams.kt
@@ -327,6 +327,15 @@ private constructor(
private var validated: Boolean = false
+ /**
+ * Validates that the types of all values in this object match their expected types
+ * recursively.
+ *
+ * This method is _not_ forwards compatible with new types from the API for existing fields.
+ *
+ * @throws OpenAIInvalidDataException if any value type in this object doesn't match its
+ * expected type.
+ */
fun validate(): Order = apply {
if (validated) {
return@apply
diff --git a/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/projects/groups/ProjectGroup.kt b/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/projects/groups/ProjectGroup.kt
index 78fd2c09f..d1ac52444 100644
--- a/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/projects/groups/ProjectGroup.kt
+++ b/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/projects/groups/ProjectGroup.kt
@@ -298,6 +298,14 @@ private constructor(
private var validated: Boolean = false
+ /**
+ * Validates that the types of all values in this object match their expected types recursively.
+ *
+ * This method is _not_ forwards compatible with new types from the API for existing fields.
+ *
+ * @throws OpenAIInvalidDataException if any value type in this object doesn't match its
+ * expected type.
+ */
fun validate(): ProjectGroup = apply {
if (validated) {
return@apply
diff --git a/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/projects/groups/roles/RoleCreateParams.kt b/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/projects/groups/roles/RoleCreateParams.kt
index 326146afe..c303f0e5d 100644
--- a/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/projects/groups/roles/RoleCreateParams.kt
+++ b/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/projects/groups/roles/RoleCreateParams.kt
@@ -385,6 +385,15 @@ private constructor(
private var validated: Boolean = false
+ /**
+ * Validates that the types of all values in this object match their expected types
+ * recursively.
+ *
+ * This method is _not_ forwards compatible with new types from the API for existing fields.
+ *
+ * @throws OpenAIInvalidDataException if any value type in this object doesn't match its
+ * expected type.
+ */
fun validate(): Body = apply {
if (validated) {
return@apply
diff --git a/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/projects/groups/roles/RoleCreateResponse.kt b/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/projects/groups/roles/RoleCreateResponse.kt
index d5ecbdc16..1b39b3703 100644
--- a/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/projects/groups/roles/RoleCreateResponse.kt
+++ b/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/projects/groups/roles/RoleCreateResponse.kt
@@ -198,6 +198,14 @@ private constructor(
private var validated: Boolean = false
+ /**
+ * Validates that the types of all values in this object match their expected types recursively.
+ *
+ * This method is _not_ forwards compatible with new types from the API for existing fields.
+ *
+ * @throws OpenAIInvalidDataException if any value type in this object doesn't match its
+ * expected type.
+ */
fun validate(): RoleCreateResponse = apply {
if (validated) {
return@apply
@@ -491,6 +499,15 @@ private constructor(
private var validated: Boolean = false
+ /**
+ * Validates that the types of all values in this object match their expected types
+ * recursively.
+ *
+ * This method is _not_ forwards compatible with new types from the API for existing fields.
+ *
+ * @throws OpenAIInvalidDataException if any value type in this object doesn't match its
+ * expected type.
+ */
fun validate(): Group = apply {
if (validated) {
return@apply
diff --git a/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/projects/groups/roles/RoleDeleteResponse.kt b/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/projects/groups/roles/RoleDeleteResponse.kt
index 1b93e5bdd..22cd6692f 100644
--- a/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/projects/groups/roles/RoleDeleteResponse.kt
+++ b/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/projects/groups/roles/RoleDeleteResponse.kt
@@ -167,6 +167,14 @@ private constructor(
private var validated: Boolean = false
+ /**
+ * Validates that the types of all values in this object match their expected types recursively.
+ *
+ * This method is _not_ forwards compatible with new types from the API for existing fields.
+ *
+ * @throws OpenAIInvalidDataException if any value type in this object doesn't match its
+ * expected type.
+ */
fun validate(): RoleDeleteResponse = apply {
if (validated) {
return@apply
diff --git a/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/projects/groups/roles/RoleListPageResponse.kt b/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/projects/groups/roles/RoleListPageResponse.kt
index 46dfad409..b03e38470 100644
--- a/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/projects/groups/roles/RoleListPageResponse.kt
+++ b/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/projects/groups/roles/RoleListPageResponse.kt
@@ -255,6 +255,14 @@ private constructor(
private var validated: Boolean = false
+ /**
+ * Validates that the types of all values in this object match their expected types recursively.
+ *
+ * This method is _not_ forwards compatible with new types from the API for existing fields.
+ *
+ * @throws OpenAIInvalidDataException if any value type in this object doesn't match its
+ * expected type.
+ */
fun validate(): RoleListPageResponse = apply {
if (validated) {
return@apply
diff --git a/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/projects/groups/roles/RoleListParams.kt b/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/projects/groups/roles/RoleListParams.kt
index a7d8f2963..45873c8ee 100644
--- a/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/projects/groups/roles/RoleListParams.kt
+++ b/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/projects/groups/roles/RoleListParams.kt
@@ -349,6 +349,15 @@ private constructor(
private var validated: Boolean = false
+ /**
+ * Validates that the types of all values in this object match their expected types
+ * recursively.
+ *
+ * This method is _not_ forwards compatible with new types from the API for existing fields.
+ *
+ * @throws OpenAIInvalidDataException if any value type in this object doesn't match its
+ * expected type.
+ */
fun validate(): Order = apply {
if (validated) {
return@apply
diff --git a/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/projects/groups/roles/RoleListResponse.kt b/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/projects/groups/roles/RoleListResponse.kt
index f8fb98ad3..76aa79864 100644
--- a/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/projects/groups/roles/RoleListResponse.kt
+++ b/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/projects/groups/roles/RoleListResponse.kt
@@ -559,6 +559,14 @@ private constructor(
private var validated: Boolean = false
+ /**
+ * Validates that the types of all values in this object match their expected types recursively.
+ *
+ * This method is _not_ forwards compatible with new types from the API for existing fields.
+ *
+ * @throws OpenAIInvalidDataException if any value type in this object doesn't match its
+ * expected type.
+ */
fun validate(): RoleListResponse = apply {
if (validated) {
return@apply
@@ -664,6 +672,15 @@ private constructor(
private var validated: Boolean = false
+ /**
+ * Validates that the types of all values in this object match their expected types
+ * recursively.
+ *
+ * This method is _not_ forwards compatible with new types from the API for existing fields.
+ *
+ * @throws OpenAIInvalidDataException if any value type in this object doesn't match its
+ * expected type.
+ */
fun validate(): CreatedByUserObj = apply {
if (validated) {
return@apply
@@ -764,6 +781,15 @@ private constructor(
private var validated: Boolean = false
+ /**
+ * Validates that the types of all values in this object match their expected types
+ * recursively.
+ *
+ * This method is _not_ forwards compatible with new types from the API for existing fields.
+ *
+ * @throws OpenAIInvalidDataException if any value type in this object doesn't match its
+ * expected type.
+ */
fun validate(): Metadata = apply {
if (validated) {
return@apply
diff --git a/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/projects/ratelimits/ProjectRateLimit.kt b/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/projects/ratelimits/ProjectRateLimit.kt
index 39c659b14..bb94290e8 100644
--- a/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/projects/ratelimits/ProjectRateLimit.kt
+++ b/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/projects/ratelimits/ProjectRateLimit.kt
@@ -457,6 +457,14 @@ private constructor(
private var validated: Boolean = false
+ /**
+ * Validates that the types of all values in this object match their expected types recursively.
+ *
+ * This method is _not_ forwards compatible with new types from the API for existing fields.
+ *
+ * @throws OpenAIInvalidDataException if any value type in this object doesn't match its
+ * expected type.
+ */
fun validate(): ProjectRateLimit = apply {
if (validated) {
return@apply
diff --git a/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/projects/ratelimits/RateLimitListRateLimitsPageResponse.kt b/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/projects/ratelimits/RateLimitListRateLimitsPageResponse.kt
index e5503e989..826283c5b 100644
--- a/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/projects/ratelimits/RateLimitListRateLimitsPageResponse.kt
+++ b/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/projects/ratelimits/RateLimitListRateLimitsPageResponse.kt
@@ -274,6 +274,14 @@ private constructor(
private var validated: Boolean = false
+ /**
+ * Validates that the types of all values in this object match their expected types recursively.
+ *
+ * This method is _not_ forwards compatible with new types from the API for existing fields.
+ *
+ * @throws OpenAIInvalidDataException if any value type in this object doesn't match its
+ * expected type.
+ */
fun validate(): RateLimitListRateLimitsPageResponse = apply {
if (validated) {
return@apply
diff --git a/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/projects/ratelimits/RateLimitUpdateRateLimitParams.kt b/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/projects/ratelimits/RateLimitUpdateRateLimitParams.kt
index 0c047fa3b..28293716b 100644
--- a/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/projects/ratelimits/RateLimitUpdateRateLimitParams.kt
+++ b/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/projects/ratelimits/RateLimitUpdateRateLimitParams.kt
@@ -765,6 +765,15 @@ private constructor(
private var validated: Boolean = false
+ /**
+ * Validates that the types of all values in this object match their expected types
+ * recursively.
+ *
+ * This method is _not_ forwards compatible with new types from the API for existing fields.
+ *
+ * @throws OpenAIInvalidDataException if any value type in this object doesn't match its
+ * expected type.
+ */
fun validate(): Body = apply {
if (validated) {
return@apply
diff --git a/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/projects/roles/RoleCreateParams.kt b/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/projects/roles/RoleCreateParams.kt
index 755267a53..0e822d193 100644
--- a/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/projects/roles/RoleCreateParams.kt
+++ b/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/projects/roles/RoleCreateParams.kt
@@ -544,6 +544,15 @@ private constructor(
private var validated: Boolean = false
+ /**
+ * Validates that the types of all values in this object match their expected types
+ * recursively.
+ *
+ * This method is _not_ forwards compatible with new types from the API for existing fields.
+ *
+ * @throws OpenAIInvalidDataException if any value type in this object doesn't match its
+ * expected type.
+ */
fun validate(): Body = apply {
if (validated) {
return@apply
diff --git a/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/projects/roles/RoleDeleteResponse.kt b/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/projects/roles/RoleDeleteResponse.kt
index cb8370fa7..3e84ac52d 100644
--- a/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/projects/roles/RoleDeleteResponse.kt
+++ b/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/projects/roles/RoleDeleteResponse.kt
@@ -196,6 +196,14 @@ private constructor(
private var validated: Boolean = false
+ /**
+ * Validates that the types of all values in this object match their expected types recursively.
+ *
+ * This method is _not_ forwards compatible with new types from the API for existing fields.
+ *
+ * @throws OpenAIInvalidDataException if any value type in this object doesn't match its
+ * expected type.
+ */
fun validate(): RoleDeleteResponse = apply {
if (validated) {
return@apply
diff --git a/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/projects/roles/RoleListPageResponse.kt b/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/projects/roles/RoleListPageResponse.kt
index 971c70203..ec64f0fe8 100644
--- a/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/projects/roles/RoleListPageResponse.kt
+++ b/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/projects/roles/RoleListPageResponse.kt
@@ -253,6 +253,14 @@ private constructor(
private var validated: Boolean = false
+ /**
+ * Validates that the types of all values in this object match their expected types recursively.
+ *
+ * This method is _not_ forwards compatible with new types from the API for existing fields.
+ *
+ * @throws OpenAIInvalidDataException if any value type in this object doesn't match its
+ * expected type.
+ */
fun validate(): RoleListPageResponse = apply {
if (validated) {
return@apply
diff --git a/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/projects/roles/RoleListParams.kt b/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/projects/roles/RoleListParams.kt
index 5b9d8f17b..bedf9e02c 100644
--- a/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/projects/roles/RoleListParams.kt
+++ b/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/projects/roles/RoleListParams.kt
@@ -327,6 +327,15 @@ private constructor(
private var validated: Boolean = false
+ /**
+ * Validates that the types of all values in this object match their expected types
+ * recursively.
+ *
+ * This method is _not_ forwards compatible with new types from the API for existing fields.
+ *
+ * @throws OpenAIInvalidDataException if any value type in this object doesn't match its
+ * expected type.
+ */
fun validate(): Order = apply {
if (validated) {
return@apply
diff --git a/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/projects/roles/RoleUpdateParams.kt b/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/projects/roles/RoleUpdateParams.kt
index 954e38819..879a609b6 100644
--- a/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/projects/roles/RoleUpdateParams.kt
+++ b/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/projects/roles/RoleUpdateParams.kt
@@ -549,6 +549,15 @@ private constructor(
private var validated: Boolean = false
+ /**
+ * Validates that the types of all values in this object match their expected types
+ * recursively.
+ *
+ * This method is _not_ forwards compatible with new types from the API for existing fields.
+ *
+ * @throws OpenAIInvalidDataException if any value type in this object doesn't match its
+ * expected type.
+ */
fun validate(): Body = apply {
if (validated) {
return@apply
diff --git a/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/projects/serviceaccounts/ProjectServiceAccount.kt b/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/projects/serviceaccounts/ProjectServiceAccount.kt
index 871deb288..9f70e6ac5 100644
--- a/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/projects/serviceaccounts/ProjectServiceAccount.kt
+++ b/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/projects/serviceaccounts/ProjectServiceAccount.kt
@@ -264,6 +264,14 @@ private constructor(
private var validated: Boolean = false
+ /**
+ * Validates that the types of all values in this object match their expected types recursively.
+ *
+ * This method is _not_ forwards compatible with new types from the API for existing fields.
+ *
+ * @throws OpenAIInvalidDataException if any value type in this object doesn't match its
+ * expected type.
+ */
fun validate(): ProjectServiceAccount = apply {
if (validated) {
return@apply
@@ -392,6 +400,15 @@ private constructor(
private var validated: Boolean = false
+ /**
+ * Validates that the types of all values in this object match their expected types
+ * recursively.
+ *
+ * This method is _not_ forwards compatible with new types from the API for existing fields.
+ *
+ * @throws OpenAIInvalidDataException if any value type in this object doesn't match its
+ * expected type.
+ */
fun validate(): Role = apply {
if (validated) {
return@apply
diff --git a/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/projects/serviceaccounts/ServiceAccountCreateParams.kt b/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/projects/serviceaccounts/ServiceAccountCreateParams.kt
index a54637ca6..193d76a08 100644
--- a/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/projects/serviceaccounts/ServiceAccountCreateParams.kt
+++ b/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/projects/serviceaccounts/ServiceAccountCreateParams.kt
@@ -376,6 +376,15 @@ private constructor(
private var validated: Boolean = false
+ /**
+ * Validates that the types of all values in this object match their expected types
+ * recursively.
+ *
+ * This method is _not_ forwards compatible with new types from the API for existing fields.
+ *
+ * @throws OpenAIInvalidDataException if any value type in this object doesn't match its
+ * expected type.
+ */
fun validate(): Body = apply {
if (validated) {
return@apply
diff --git a/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/projects/serviceaccounts/ServiceAccountCreateResponse.kt b/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/projects/serviceaccounts/ServiceAccountCreateResponse.kt
index 4e8ca7b66..abd593d58 100644
--- a/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/projects/serviceaccounts/ServiceAccountCreateResponse.kt
+++ b/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/projects/serviceaccounts/ServiceAccountCreateResponse.kt
@@ -284,6 +284,14 @@ private constructor(
private var validated: Boolean = false
+ /**
+ * Validates that the types of all values in this object match their expected types recursively.
+ *
+ * This method is _not_ forwards compatible with new types from the API for existing fields.
+ *
+ * @throws OpenAIInvalidDataException if any value type in this object doesn't match its
+ * expected type.
+ */
fun validate(): ServiceAccountCreateResponse = apply {
if (validated) {
return@apply
@@ -571,6 +579,15 @@ private constructor(
private var validated: Boolean = false
+ /**
+ * Validates that the types of all values in this object match their expected types
+ * recursively.
+ *
+ * This method is _not_ forwards compatible with new types from the API for existing fields.
+ *
+ * @throws OpenAIInvalidDataException if any value type in this object doesn't match its
+ * expected type.
+ */
fun validate(): ApiKey = apply {
if (validated) {
return@apply
diff --git a/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/projects/serviceaccounts/ServiceAccountDeleteResponse.kt b/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/projects/serviceaccounts/ServiceAccountDeleteResponse.kt
index 7c7198b05..62c43169d 100644
--- a/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/projects/serviceaccounts/ServiceAccountDeleteResponse.kt
+++ b/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/projects/serviceaccounts/ServiceAccountDeleteResponse.kt
@@ -188,6 +188,14 @@ private constructor(
private var validated: Boolean = false
+ /**
+ * Validates that the types of all values in this object match their expected types recursively.
+ *
+ * This method is _not_ forwards compatible with new types from the API for existing fields.
+ *
+ * @throws OpenAIInvalidDataException if any value type in this object doesn't match its
+ * expected type.
+ */
fun validate(): ServiceAccountDeleteResponse = apply {
if (validated) {
return@apply
diff --git a/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/projects/serviceaccounts/ServiceAccountListPageResponse.kt b/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/projects/serviceaccounts/ServiceAccountListPageResponse.kt
index 30783d2ef..397924312 100644
--- a/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/projects/serviceaccounts/ServiceAccountListPageResponse.kt
+++ b/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/projects/serviceaccounts/ServiceAccountListPageResponse.kt
@@ -272,6 +272,14 @@ private constructor(
private var validated: Boolean = false
+ /**
+ * Validates that the types of all values in this object match their expected types recursively.
+ *
+ * This method is _not_ forwards compatible with new types from the API for existing fields.
+ *
+ * @throws OpenAIInvalidDataException if any value type in this object doesn't match its
+ * expected type.
+ */
fun validate(): ServiceAccountListPageResponse = apply {
if (validated) {
return@apply
diff --git a/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/projects/users/ProjectUser.kt b/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/projects/users/ProjectUser.kt
index 160142210..01def33c1 100644
--- a/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/projects/users/ProjectUser.kt
+++ b/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/projects/users/ProjectUser.kt
@@ -299,6 +299,14 @@ private constructor(
private var validated: Boolean = false
+ /**
+ * Validates that the types of all values in this object match their expected types recursively.
+ *
+ * This method is _not_ forwards compatible with new types from the API for existing fields.
+ *
+ * @throws OpenAIInvalidDataException if any value type in this object doesn't match its
+ * expected type.
+ */
fun validate(): ProjectUser = apply {
if (validated) {
return@apply
diff --git a/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/projects/users/UserCreateParams.kt b/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/projects/users/UserCreateParams.kt
index e753bfa69..fb9531778 100644
--- a/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/projects/users/UserCreateParams.kt
+++ b/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/projects/users/UserCreateParams.kt
@@ -509,6 +509,15 @@ private constructor(
private var validated: Boolean = false
+ /**
+ * Validates that the types of all values in this object match their expected types
+ * recursively.
+ *
+ * This method is _not_ forwards compatible with new types from the API for existing fields.
+ *
+ * @throws OpenAIInvalidDataException if any value type in this object doesn't match its
+ * expected type.
+ */
fun validate(): Body = apply {
if (validated) {
return@apply
diff --git a/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/projects/users/UserDeleteResponse.kt b/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/projects/users/UserDeleteResponse.kt
index 517cafc84..27b42c272 100644
--- a/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/projects/users/UserDeleteResponse.kt
+++ b/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/projects/users/UserDeleteResponse.kt
@@ -187,6 +187,14 @@ private constructor(
private var validated: Boolean = false
+ /**
+ * Validates that the types of all values in this object match their expected types recursively.
+ *
+ * This method is _not_ forwards compatible with new types from the API for existing fields.
+ *
+ * @throws OpenAIInvalidDataException if any value type in this object doesn't match its
+ * expected type.
+ */
fun validate(): UserDeleteResponse = apply {
if (validated) {
return@apply
diff --git a/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/projects/users/UserListPageResponse.kt b/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/projects/users/UserListPageResponse.kt
index 0e5ee9909..11f329ffd 100644
--- a/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/projects/users/UserListPageResponse.kt
+++ b/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/projects/users/UserListPageResponse.kt
@@ -268,6 +268,14 @@ private constructor(
private var validated: Boolean = false
+ /**
+ * Validates that the types of all values in this object match their expected types recursively.
+ *
+ * This method is _not_ forwards compatible with new types from the API for existing fields.
+ *
+ * @throws OpenAIInvalidDataException if any value type in this object doesn't match its
+ * expected type.
+ */
fun validate(): UserListPageResponse = apply {
if (validated) {
return@apply
diff --git a/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/projects/users/UserUpdateParams.kt b/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/projects/users/UserUpdateParams.kt
index daa0151c0..8a7042bea 100644
--- a/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/projects/users/UserUpdateParams.kt
+++ b/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/projects/users/UserUpdateParams.kt
@@ -373,6 +373,15 @@ private constructor(
private var validated: Boolean = false
+ /**
+ * Validates that the types of all values in this object match their expected types
+ * recursively.
+ *
+ * This method is _not_ forwards compatible with new types from the API for existing fields.
+ *
+ * @throws OpenAIInvalidDataException if any value type in this object doesn't match its
+ * expected type.
+ */
fun validate(): Body = apply {
if (validated) {
return@apply
diff --git a/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/projects/users/roles/RoleCreateParams.kt b/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/projects/users/roles/RoleCreateParams.kt
index ff977cd02..43f3368dd 100644
--- a/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/projects/users/roles/RoleCreateParams.kt
+++ b/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/projects/users/roles/RoleCreateParams.kt
@@ -385,6 +385,15 @@ private constructor(
private var validated: Boolean = false
+ /**
+ * Validates that the types of all values in this object match their expected types
+ * recursively.
+ *
+ * This method is _not_ forwards compatible with new types from the API for existing fields.
+ *
+ * @throws OpenAIInvalidDataException if any value type in this object doesn't match its
+ * expected type.
+ */
fun validate(): Body = apply {
if (validated) {
return@apply
diff --git a/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/projects/users/roles/RoleCreateResponse.kt b/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/projects/users/roles/RoleCreateResponse.kt
index f1c6b1451..0be3ef292 100644
--- a/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/projects/users/roles/RoleCreateResponse.kt
+++ b/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/projects/users/roles/RoleCreateResponse.kt
@@ -200,6 +200,14 @@ private constructor(
private var validated: Boolean = false
+ /**
+ * Validates that the types of all values in this object match their expected types recursively.
+ *
+ * This method is _not_ forwards compatible with new types from the API for existing fields.
+ *
+ * @throws OpenAIInvalidDataException if any value type in this object doesn't match its
+ * expected type.
+ */
fun validate(): RoleCreateResponse = apply {
if (validated) {
return@apply
diff --git a/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/projects/users/roles/RoleDeleteResponse.kt b/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/projects/users/roles/RoleDeleteResponse.kt
index 2e6d906f4..1250dac58 100644
--- a/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/projects/users/roles/RoleDeleteResponse.kt
+++ b/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/projects/users/roles/RoleDeleteResponse.kt
@@ -167,6 +167,14 @@ private constructor(
private var validated: Boolean = false
+ /**
+ * Validates that the types of all values in this object match their expected types recursively.
+ *
+ * This method is _not_ forwards compatible with new types from the API for existing fields.
+ *
+ * @throws OpenAIInvalidDataException if any value type in this object doesn't match its
+ * expected type.
+ */
fun validate(): RoleDeleteResponse = apply {
if (validated) {
return@apply
diff --git a/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/projects/users/roles/RoleListPageResponse.kt b/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/projects/users/roles/RoleListPageResponse.kt
index 14c00a585..32c1d8c5b 100644
--- a/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/projects/users/roles/RoleListPageResponse.kt
+++ b/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/projects/users/roles/RoleListPageResponse.kt
@@ -255,6 +255,14 @@ private constructor(
private var validated: Boolean = false
+ /**
+ * Validates that the types of all values in this object match their expected types recursively.
+ *
+ * This method is _not_ forwards compatible with new types from the API for existing fields.
+ *
+ * @throws OpenAIInvalidDataException if any value type in this object doesn't match its
+ * expected type.
+ */
fun validate(): RoleListPageResponse = apply {
if (validated) {
return@apply
diff --git a/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/projects/users/roles/RoleListParams.kt b/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/projects/users/roles/RoleListParams.kt
index 1cd29af26..ed56f72a2 100644
--- a/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/projects/users/roles/RoleListParams.kt
+++ b/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/projects/users/roles/RoleListParams.kt
@@ -349,6 +349,15 @@ private constructor(
private var validated: Boolean = false
+ /**
+ * Validates that the types of all values in this object match their expected types
+ * recursively.
+ *
+ * This method is _not_ forwards compatible with new types from the API for existing fields.
+ *
+ * @throws OpenAIInvalidDataException if any value type in this object doesn't match its
+ * expected type.
+ */
fun validate(): Order = apply {
if (validated) {
return@apply
diff --git a/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/projects/users/roles/RoleListResponse.kt b/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/projects/users/roles/RoleListResponse.kt
index 13a30650a..096b63fec 100644
--- a/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/projects/users/roles/RoleListResponse.kt
+++ b/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/projects/users/roles/RoleListResponse.kt
@@ -559,6 +559,14 @@ private constructor(
private var validated: Boolean = false
+ /**
+ * Validates that the types of all values in this object match their expected types recursively.
+ *
+ * This method is _not_ forwards compatible with new types from the API for existing fields.
+ *
+ * @throws OpenAIInvalidDataException if any value type in this object doesn't match its
+ * expected type.
+ */
fun validate(): RoleListResponse = apply {
if (validated) {
return@apply
@@ -664,6 +672,15 @@ private constructor(
private var validated: Boolean = false
+ /**
+ * Validates that the types of all values in this object match their expected types
+ * recursively.
+ *
+ * This method is _not_ forwards compatible with new types from the API for existing fields.
+ *
+ * @throws OpenAIInvalidDataException if any value type in this object doesn't match its
+ * expected type.
+ */
fun validate(): CreatedByUserObj = apply {
if (validated) {
return@apply
@@ -764,6 +781,15 @@ private constructor(
private var validated: Boolean = false
+ /**
+ * Validates that the types of all values in this object match their expected types
+ * recursively.
+ *
+ * This method is _not_ forwards compatible with new types from the API for existing fields.
+ *
+ * @throws OpenAIInvalidDataException if any value type in this object doesn't match its
+ * expected type.
+ */
fun validate(): Metadata = apply {
if (validated) {
return@apply
diff --git a/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/roles/Role.kt b/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/roles/Role.kt
index c3b6001fe..d03717dba 100644
--- a/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/roles/Role.kt
+++ b/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/roles/Role.kt
@@ -380,6 +380,14 @@ private constructor(
private var validated: Boolean = false
+ /**
+ * Validates that the types of all values in this object match their expected types recursively.
+ *
+ * This method is _not_ forwards compatible with new types from the API for existing fields.
+ *
+ * @throws OpenAIInvalidDataException if any value type in this object doesn't match its
+ * expected type.
+ */
fun validate(): Role = apply {
if (validated) {
return@apply
diff --git a/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/roles/RoleCreateParams.kt b/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/roles/RoleCreateParams.kt
index 6bb2ce7f7..dc070b962 100644
--- a/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/roles/RoleCreateParams.kt
+++ b/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/roles/RoleCreateParams.kt
@@ -523,6 +523,15 @@ private constructor(
private var validated: Boolean = false
+ /**
+ * Validates that the types of all values in this object match their expected types
+ * recursively.
+ *
+ * This method is _not_ forwards compatible with new types from the API for existing fields.
+ *
+ * @throws OpenAIInvalidDataException if any value type in this object doesn't match its
+ * expected type.
+ */
fun validate(): Body = apply {
if (validated) {
return@apply
diff --git a/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/roles/RoleDeleteResponse.kt b/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/roles/RoleDeleteResponse.kt
index 5360eeb0a..b92dd295a 100644
--- a/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/roles/RoleDeleteResponse.kt
+++ b/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/roles/RoleDeleteResponse.kt
@@ -196,6 +196,14 @@ private constructor(
private var validated: Boolean = false
+ /**
+ * Validates that the types of all values in this object match their expected types recursively.
+ *
+ * This method is _not_ forwards compatible with new types from the API for existing fields.
+ *
+ * @throws OpenAIInvalidDataException if any value type in this object doesn't match its
+ * expected type.
+ */
fun validate(): RoleDeleteResponse = apply {
if (validated) {
return@apply
diff --git a/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/roles/RoleListPageResponse.kt b/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/roles/RoleListPageResponse.kt
index 0c90ac8c0..8499fc26d 100644
--- a/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/roles/RoleListPageResponse.kt
+++ b/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/roles/RoleListPageResponse.kt
@@ -252,6 +252,14 @@ private constructor(
private var validated: Boolean = false
+ /**
+ * Validates that the types of all values in this object match their expected types recursively.
+ *
+ * This method is _not_ forwards compatible with new types from the API for existing fields.
+ *
+ * @throws OpenAIInvalidDataException if any value type in this object doesn't match its
+ * expected type.
+ */
fun validate(): RoleListPageResponse = apply {
if (validated) {
return@apply
diff --git a/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/roles/RoleListParams.kt b/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/roles/RoleListParams.kt
index 1feb32fda..5fdb0fa62 100644
--- a/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/roles/RoleListParams.kt
+++ b/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/roles/RoleListParams.kt
@@ -310,6 +310,15 @@ private constructor(
private var validated: Boolean = false
+ /**
+ * Validates that the types of all values in this object match their expected types
+ * recursively.
+ *
+ * This method is _not_ forwards compatible with new types from the API for existing fields.
+ *
+ * @throws OpenAIInvalidDataException if any value type in this object doesn't match its
+ * expected type.
+ */
fun validate(): Order = apply {
if (validated) {
return@apply
diff --git a/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/roles/RoleUpdateParams.kt b/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/roles/RoleUpdateParams.kt
index 6bab4882b..dae5bcc00 100644
--- a/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/roles/RoleUpdateParams.kt
+++ b/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/roles/RoleUpdateParams.kt
@@ -527,6 +527,15 @@ private constructor(
private var validated: Boolean = false
+ /**
+ * Validates that the types of all values in this object match their expected types
+ * recursively.
+ *
+ * This method is _not_ forwards compatible with new types from the API for existing fields.
+ *
+ * @throws OpenAIInvalidDataException if any value type in this object doesn't match its
+ * expected type.
+ */
fun validate(): Body = apply {
if (validated) {
return@apply
diff --git a/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/usage/UsageAudioSpeechesParams.kt b/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/usage/UsageAudioSpeechesParams.kt
index 12932b64b..a7e99598c 100644
--- a/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/usage/UsageAudioSpeechesParams.kt
+++ b/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/usage/UsageAudioSpeechesParams.kt
@@ -509,6 +509,15 @@ private constructor(
private var validated: Boolean = false
+ /**
+ * Validates that the types of all values in this object match their expected types
+ * recursively.
+ *
+ * This method is _not_ forwards compatible with new types from the API for existing fields.
+ *
+ * @throws OpenAIInvalidDataException if any value type in this object doesn't match its
+ * expected type.
+ */
fun validate(): BucketWidth = apply {
if (validated) {
return@apply
@@ -646,6 +655,15 @@ private constructor(
private var validated: Boolean = false
+ /**
+ * Validates that the types of all values in this object match their expected types
+ * recursively.
+ *
+ * This method is _not_ forwards compatible with new types from the API for existing fields.
+ *
+ * @throws OpenAIInvalidDataException if any value type in this object doesn't match its
+ * expected type.
+ */
fun validate(): GroupBy = apply {
if (validated) {
return@apply
diff --git a/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/usage/UsageAudioSpeechesResponse.kt b/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/usage/UsageAudioSpeechesResponse.kt
index 5335640f4..1aa7725dc 100644
--- a/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/usage/UsageAudioSpeechesResponse.kt
+++ b/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/usage/UsageAudioSpeechesResponse.kt
@@ -248,6 +248,14 @@ private constructor(
private var validated: Boolean = false
+ /**
+ * Validates that the types of all values in this object match their expected types recursively.
+ *
+ * This method is _not_ forwards compatible with new types from the API for existing fields.
+ *
+ * @throws OpenAIInvalidDataException if any value type in this object doesn't match its
+ * expected type.
+ */
fun validate(): UsageAudioSpeechesResponse = apply {
if (validated) {
return@apply
@@ -615,6 +623,15 @@ private constructor(
private var validated: Boolean = false
+ /**
+ * Validates that the types of all values in this object match their expected types
+ * recursively.
+ *
+ * This method is _not_ forwards compatible with new types from the API for existing fields.
+ *
+ * @throws OpenAIInvalidDataException if any value type in this object doesn't match its
+ * expected type.
+ */
fun validate(): Data = apply {
if (validated) {
return@apply
@@ -780,6 +797,36 @@ private constructor(
fun _json(): Optional = Optional.ofNullable(_json)
+ /**
+ * Maps this instance's current variant to a value of type [T] using the given
+ * [visitor].
+ *
+ * Note that this method is _not_ forwards compatible with new variants from the API,
+ * unless [visitor] overrides [Visitor.unknown]. To handle variants not known to this
+ * version of the SDK gracefully, consider overriding [Visitor.unknown]:
+ * ```java
+ * import com.openai.core.JsonValue;
+ * import java.util.Optional;
+ *
+ * Optional result = result.accept(new Result.Visitor>() {
+ * @Override
+ * public Optional visitOrganizationUsageCompletions(OrganizationUsageCompletionsResult organizationUsageCompletions) {
+ * return Optional.of(organizationUsageCompletions.toString());
+ * }
+ *
+ * // ...
+ *
+ * @Override
+ * public Optional unknown(JsonValue json) {
+ * // Or inspect the `json`.
+ * return Optional.empty();
+ * }
+ * });
+ * ```
+ *
+ * @throws OpenAIInvalidDataException if [Visitor.unknown] is not overridden in
+ * [visitor] and the current variant is unknown.
+ */
fun accept(visitor: Visitor): T =
when {
organizationUsageCompletions != null ->
@@ -808,6 +855,16 @@ private constructor(
private var validated: Boolean = false
+ /**
+ * Validates that the types of all values in this object match their expected types
+ * recursively.
+ *
+ * This method is _not_ forwards compatible with new types from the API for existing
+ * fields.
+ *
+ * @throws OpenAIInvalidDataException if any value type in this object doesn't match its
+ * expected type.
+ */
fun validate(): Result = apply {
if (validated) {
return@apply
@@ -1920,6 +1977,16 @@ private constructor(
private var validated: Boolean = false
+ /**
+ * Validates that the types of all values in this object match their expected types
+ * recursively.
+ *
+ * This method is _not_ forwards compatible with new types from the API for existing
+ * fields.
+ *
+ * @throws OpenAIInvalidDataException if any value type in this object doesn't match
+ * its expected type.
+ */
fun validate(): OrganizationUsageCompletionsResult = apply {
if (validated) {
return@apply
@@ -2414,6 +2481,16 @@ private constructor(
private var validated: Boolean = false
+ /**
+ * Validates that the types of all values in this object match their expected types
+ * recursively.
+ *
+ * This method is _not_ forwards compatible with new types from the API for existing
+ * fields.
+ *
+ * @throws OpenAIInvalidDataException if any value type in this object doesn't match
+ * its expected type.
+ */
fun validate(): OrganizationUsageEmbeddingsResult = apply {
if (validated) {
return@apply
@@ -2884,6 +2961,16 @@ private constructor(
private var validated: Boolean = false
+ /**
+ * Validates that the types of all values in this object match their expected types
+ * recursively.
+ *
+ * This method is _not_ forwards compatible with new types from the API for existing
+ * fields.
+ *
+ * @throws OpenAIInvalidDataException if any value type in this object doesn't match
+ * its expected type.
+ */
fun validate(): OrganizationUsageModerationsResult = apply {
if (validated) {
return@apply
@@ -3437,6 +3524,16 @@ private constructor(
private var validated: Boolean = false
+ /**
+ * Validates that the types of all values in this object match their expected types
+ * recursively.
+ *
+ * This method is _not_ forwards compatible with new types from the API for existing
+ * fields.
+ *
+ * @throws OpenAIInvalidDataException if any value type in this object doesn't match
+ * its expected type.
+ */
fun validate(): OrganizationUsageImagesResult = apply {
if (validated) {
return@apply
@@ -3914,6 +4011,16 @@ private constructor(
private var validated: Boolean = false
+ /**
+ * Validates that the types of all values in this object match their expected types
+ * recursively.
+ *
+ * This method is _not_ forwards compatible with new types from the API for existing
+ * fields.
+ *
+ * @throws OpenAIInvalidDataException if any value type in this object doesn't match
+ * its expected type.
+ */
fun validate(): OrganizationUsageAudioSpeechesResult = apply {
if (validated) {
return@apply
@@ -4384,6 +4491,16 @@ private constructor(
private var validated: Boolean = false
+ /**
+ * Validates that the types of all values in this object match their expected types
+ * recursively.
+ *
+ * This method is _not_ forwards compatible with new types from the API for existing
+ * fields.
+ *
+ * @throws OpenAIInvalidDataException if any value type in this object doesn't match
+ * its expected type.
+ */
fun validate(): OrganizationUsageAudioTranscriptionsResult = apply {
if (validated) {
return@apply
@@ -4680,6 +4797,16 @@ private constructor(
private var validated: Boolean = false
+ /**
+ * Validates that the types of all values in this object match their expected types
+ * recursively.
+ *
+ * This method is _not_ forwards compatible with new types from the API for existing
+ * fields.
+ *
+ * @throws OpenAIInvalidDataException if any value type in this object doesn't match
+ * its expected type.
+ */
fun validate(): OrganizationUsageVectorStoresResult = apply {
if (validated) {
return@apply
@@ -4954,6 +5081,16 @@ private constructor(
private var validated: Boolean = false
+ /**
+ * Validates that the types of all values in this object match their expected types
+ * recursively.
+ *
+ * This method is _not_ forwards compatible with new types from the API for existing
+ * fields.
+ *
+ * @throws OpenAIInvalidDataException if any value type in this object doesn't match
+ * its expected type.
+ */
fun validate(): OrganizationUsageCodeInterpreterSessionsResult = apply {
if (validated) {
return@apply
@@ -5034,6 +5171,7 @@ private constructor(
private val apiKeyId: JsonField,
private val lineItem: JsonField,
private val projectId: JsonField,
+ private val quantity: JsonField,
private val additionalProperties: MutableMap,
) {
@@ -5052,7 +5190,10 @@ private constructor(
@JsonProperty("project_id")
@ExcludeMissing
projectId: JsonField = JsonMissing.of(),
- ) : this(object_, amount, apiKeyId, lineItem, projectId, mutableMapOf())
+ @JsonProperty("quantity")
+ @ExcludeMissing
+ quantity: JsonField = JsonMissing.of(),
+ ) : this(object_, amount, apiKeyId, lineItem, projectId, quantity, mutableMapOf())
/**
* Expected to always return the following:
@@ -5100,6 +5241,15 @@ private constructor(
*/
fun projectId(): Optional = projectId.getOptional("project_id")
+ /**
+ * When `group_by=line_item`, this field provides the quantity of the grouped costs
+ * result.
+ *
+ * @throws OpenAIInvalidDataException if the JSON field has an unexpected type (e.g.
+ * if the server responded with an unexpected value).
+ */
+ fun quantity(): Optional = quantity.getOptional("quantity")
+
/**
* Returns the raw JSON value of [amount].
*
@@ -5138,6 +5288,16 @@ private constructor(
@ExcludeMissing
fun _projectId(): JsonField = projectId
+ /**
+ * Returns the raw JSON value of [quantity].
+ *
+ * Unlike [quantity], this method doesn't throw if the JSON field has an unexpected
+ * type.
+ */
+ @JsonProperty("quantity")
+ @ExcludeMissing
+ fun _quantity(): JsonField = quantity
+
@JsonAnySetter
private fun putAdditionalProperty(key: String, value: JsonValue) {
additionalProperties.put(key, value)
@@ -5167,6 +5327,7 @@ private constructor(
private var apiKeyId: JsonField = JsonMissing.of()
private var lineItem: JsonField = JsonMissing.of()
private var projectId: JsonField = JsonMissing.of()
+ private var quantity: JsonField = JsonMissing.of()
private var additionalProperties: MutableMap = mutableMapOf()
@JvmSynthetic
@@ -5176,6 +5337,7 @@ private constructor(
apiKeyId = organizationCostsResult.apiKeyId
lineItem = organizationCostsResult.lineItem
projectId = organizationCostsResult.projectId
+ quantity = organizationCostsResult.quantity
additionalProperties =
organizationCostsResult.additionalProperties.toMutableMap()
}
@@ -5262,6 +5424,31 @@ private constructor(
this.projectId = projectId
}
+ /**
+ * When `group_by=line_item`, this field provides the quantity of the grouped
+ * costs result.
+ */
+ fun quantity(quantity: Double?) = quantity(JsonField.ofNullable(quantity))
+
+ /**
+ * Alias for [Builder.quantity].
+ *
+ * This unboxed primitive overload exists for backwards compatibility.
+ */
+ fun quantity(quantity: Double) = quantity(quantity as Double?)
+
+ /** Alias for calling [Builder.quantity] with `quantity.orElse(null)`. */
+ fun quantity(quantity: Optional) = quantity(quantity.getOrNull())
+
+ /**
+ * Sets [Builder.quantity] to an arbitrary JSON value.
+ *
+ * You should usually call [Builder.quantity] with a well-typed [Double] value
+ * instead. This method is primarily for setting the field to an undocumented or
+ * not yet supported value.
+ */
+ fun quantity(quantity: JsonField) = apply { this.quantity = quantity }
+
fun additionalProperties(additionalProperties: Map) = apply {
this.additionalProperties.clear()
putAllAdditionalProperties(additionalProperties)
@@ -5296,12 +5483,23 @@ private constructor(
apiKeyId,
lineItem,
projectId,
+ quantity,
additionalProperties.toMutableMap(),
)
}
private var validated: Boolean = false
+ /**
+ * Validates that the types of all values in this object match their expected types
+ * recursively.
+ *
+ * This method is _not_ forwards compatible with new types from the API for existing
+ * fields.
+ *
+ * @throws OpenAIInvalidDataException if any value type in this object doesn't match
+ * its expected type.
+ */
fun validate(): OrganizationCostsResult = apply {
if (validated) {
return@apply
@@ -5316,6 +5514,7 @@ private constructor(
apiKeyId()
lineItem()
projectId()
+ quantity()
validated = true
}
@@ -5341,7 +5540,8 @@ private constructor(
(amount.asKnown().getOrNull()?.validity() ?: 0) +
(if (apiKeyId.asKnown().isPresent) 1 else 0) +
(if (lineItem.asKnown().isPresent) 1 else 0) +
- (if (projectId.asKnown().isPresent) 1 else 0)
+ (if (projectId.asKnown().isPresent) 1 else 0) +
+ (if (quantity.asKnown().isPresent) 1 else 0)
/** The monetary value in its associated currency. */
class Amount
@@ -5488,6 +5688,16 @@ private constructor(
private var validated: Boolean = false
+ /**
+ * Validates that the types of all values in this object match their expected
+ * types recursively.
+ *
+ * This method is _not_ forwards compatible with new types from the API for
+ * existing fields.
+ *
+ * @throws OpenAIInvalidDataException if any value type in this object doesn't
+ * match its expected type.
+ */
fun validate(): Amount = apply {
if (validated) {
return@apply
@@ -5549,6 +5759,7 @@ private constructor(
apiKeyId == other.apiKeyId &&
lineItem == other.lineItem &&
projectId == other.projectId &&
+ quantity == other.quantity &&
additionalProperties == other.additionalProperties
}
@@ -5559,6 +5770,7 @@ private constructor(
apiKeyId,
lineItem,
projectId,
+ quantity,
additionalProperties,
)
}
@@ -5566,7 +5778,7 @@ private constructor(
override fun hashCode(): Int = hashCode
override fun toString() =
- "OrganizationCostsResult{object_=$object_, amount=$amount, apiKeyId=$apiKeyId, lineItem=$lineItem, projectId=$projectId, additionalProperties=$additionalProperties}"
+ "OrganizationCostsResult{object_=$object_, amount=$amount, apiKeyId=$apiKeyId, lineItem=$lineItem, projectId=$projectId, quantity=$quantity, additionalProperties=$additionalProperties}"
}
}
diff --git a/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/usage/UsageAudioTranscriptionsParams.kt b/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/usage/UsageAudioTranscriptionsParams.kt
index 9237bcaf7..a338e3c8b 100644
--- a/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/usage/UsageAudioTranscriptionsParams.kt
+++ b/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/usage/UsageAudioTranscriptionsParams.kt
@@ -510,6 +510,15 @@ private constructor(
private var validated: Boolean = false
+ /**
+ * Validates that the types of all values in this object match their expected types
+ * recursively.
+ *
+ * This method is _not_ forwards compatible with new types from the API for existing fields.
+ *
+ * @throws OpenAIInvalidDataException if any value type in this object doesn't match its
+ * expected type.
+ */
fun validate(): BucketWidth = apply {
if (validated) {
return@apply
@@ -647,6 +656,15 @@ private constructor(
private var validated: Boolean = false
+ /**
+ * Validates that the types of all values in this object match their expected types
+ * recursively.
+ *
+ * This method is _not_ forwards compatible with new types from the API for existing fields.
+ *
+ * @throws OpenAIInvalidDataException if any value type in this object doesn't match its
+ * expected type.
+ */
fun validate(): GroupBy = apply {
if (validated) {
return@apply
diff --git a/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/usage/UsageAudioTranscriptionsResponse.kt b/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/usage/UsageAudioTranscriptionsResponse.kt
index c2513c557..069f27748 100644
--- a/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/usage/UsageAudioTranscriptionsResponse.kt
+++ b/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/usage/UsageAudioTranscriptionsResponse.kt
@@ -251,6 +251,14 @@ private constructor(
private var validated: Boolean = false
+ /**
+ * Validates that the types of all values in this object match their expected types recursively.
+ *
+ * This method is _not_ forwards compatible with new types from the API for existing fields.
+ *
+ * @throws OpenAIInvalidDataException if any value type in this object doesn't match its
+ * expected type.
+ */
fun validate(): UsageAudioTranscriptionsResponse = apply {
if (validated) {
return@apply
@@ -618,6 +626,15 @@ private constructor(
private var validated: Boolean = false
+ /**
+ * Validates that the types of all values in this object match their expected types
+ * recursively.
+ *
+ * This method is _not_ forwards compatible with new types from the API for existing fields.
+ *
+ * @throws OpenAIInvalidDataException if any value type in this object doesn't match its
+ * expected type.
+ */
fun validate(): Data = apply {
if (validated) {
return@apply
@@ -783,6 +800,36 @@ private constructor(
fun _json(): Optional = Optional.ofNullable(_json)
+ /**
+ * Maps this instance's current variant to a value of type [T] using the given
+ * [visitor].
+ *
+ * Note that this method is _not_ forwards compatible with new variants from the API,
+ * unless [visitor] overrides [Visitor.unknown]. To handle variants not known to this
+ * version of the SDK gracefully, consider overriding [Visitor.unknown]:
+ * ```java
+ * import com.openai.core.JsonValue;
+ * import java.util.Optional;
+ *
+ * Optional result = result.accept(new Result.Visitor>() {
+ * @Override
+ * public Optional visitOrganizationUsageCompletions(OrganizationUsageCompletionsResult organizationUsageCompletions) {
+ * return Optional.of(organizationUsageCompletions.toString());
+ * }
+ *
+ * // ...
+ *
+ * @Override
+ * public Optional unknown(JsonValue json) {
+ * // Or inspect the `json`.
+ * return Optional.empty();
+ * }
+ * });
+ * ```
+ *
+ * @throws OpenAIInvalidDataException if [Visitor.unknown] is not overridden in
+ * [visitor] and the current variant is unknown.
+ */
fun accept(visitor: Visitor): T =
when {
organizationUsageCompletions != null ->
@@ -811,6 +858,16 @@ private constructor(
private var validated: Boolean = false
+ /**
+ * Validates that the types of all values in this object match their expected types
+ * recursively.
+ *
+ * This method is _not_ forwards compatible with new types from the API for existing
+ * fields.
+ *
+ * @throws OpenAIInvalidDataException if any value type in this object doesn't match its
+ * expected type.
+ */
fun validate(): Result = apply {
if (validated) {
return@apply
@@ -1923,6 +1980,16 @@ private constructor(
private var validated: Boolean = false
+ /**
+ * Validates that the types of all values in this object match their expected types
+ * recursively.
+ *
+ * This method is _not_ forwards compatible with new types from the API for existing
+ * fields.
+ *
+ * @throws OpenAIInvalidDataException if any value type in this object doesn't match
+ * its expected type.
+ */
fun validate(): OrganizationUsageCompletionsResult = apply {
if (validated) {
return@apply
@@ -2417,6 +2484,16 @@ private constructor(
private var validated: Boolean = false
+ /**
+ * Validates that the types of all values in this object match their expected types
+ * recursively.
+ *
+ * This method is _not_ forwards compatible with new types from the API for existing
+ * fields.
+ *
+ * @throws OpenAIInvalidDataException if any value type in this object doesn't match
+ * its expected type.
+ */
fun validate(): OrganizationUsageEmbeddingsResult = apply {
if (validated) {
return@apply
@@ -2887,6 +2964,16 @@ private constructor(
private var validated: Boolean = false
+ /**
+ * Validates that the types of all values in this object match their expected types
+ * recursively.
+ *
+ * This method is _not_ forwards compatible with new types from the API for existing
+ * fields.
+ *
+ * @throws OpenAIInvalidDataException if any value type in this object doesn't match
+ * its expected type.
+ */
fun validate(): OrganizationUsageModerationsResult = apply {
if (validated) {
return@apply
@@ -3440,6 +3527,16 @@ private constructor(
private var validated: Boolean = false
+ /**
+ * Validates that the types of all values in this object match their expected types
+ * recursively.
+ *
+ * This method is _not_ forwards compatible with new types from the API for existing
+ * fields.
+ *
+ * @throws OpenAIInvalidDataException if any value type in this object doesn't match
+ * its expected type.
+ */
fun validate(): OrganizationUsageImagesResult = apply {
if (validated) {
return@apply
@@ -3917,6 +4014,16 @@ private constructor(
private var validated: Boolean = false
+ /**
+ * Validates that the types of all values in this object match their expected types
+ * recursively.
+ *
+ * This method is _not_ forwards compatible with new types from the API for existing
+ * fields.
+ *
+ * @throws OpenAIInvalidDataException if any value type in this object doesn't match
+ * its expected type.
+ */
fun validate(): OrganizationUsageAudioSpeechesResult = apply {
if (validated) {
return@apply
@@ -4387,6 +4494,16 @@ private constructor(
private var validated: Boolean = false
+ /**
+ * Validates that the types of all values in this object match their expected types
+ * recursively.
+ *
+ * This method is _not_ forwards compatible with new types from the API for existing
+ * fields.
+ *
+ * @throws OpenAIInvalidDataException if any value type in this object doesn't match
+ * its expected type.
+ */
fun validate(): OrganizationUsageAudioTranscriptionsResult = apply {
if (validated) {
return@apply
@@ -4683,6 +4800,16 @@ private constructor(
private var validated: Boolean = false
+ /**
+ * Validates that the types of all values in this object match their expected types
+ * recursively.
+ *
+ * This method is _not_ forwards compatible with new types from the API for existing
+ * fields.
+ *
+ * @throws OpenAIInvalidDataException if any value type in this object doesn't match
+ * its expected type.
+ */
fun validate(): OrganizationUsageVectorStoresResult = apply {
if (validated) {
return@apply
@@ -4957,6 +5084,16 @@ private constructor(
private var validated: Boolean = false
+ /**
+ * Validates that the types of all values in this object match their expected types
+ * recursively.
+ *
+ * This method is _not_ forwards compatible with new types from the API for existing
+ * fields.
+ *
+ * @throws OpenAIInvalidDataException if any value type in this object doesn't match
+ * its expected type.
+ */
fun validate(): OrganizationUsageCodeInterpreterSessionsResult = apply {
if (validated) {
return@apply
@@ -5037,6 +5174,7 @@ private constructor(
private val apiKeyId: JsonField,
private val lineItem: JsonField,
private val projectId: JsonField,
+ private val quantity: JsonField,
private val additionalProperties: MutableMap,
) {
@@ -5055,7 +5193,10 @@ private constructor(
@JsonProperty("project_id")
@ExcludeMissing
projectId: JsonField = JsonMissing.of(),
- ) : this(object_, amount, apiKeyId, lineItem, projectId, mutableMapOf())
+ @JsonProperty("quantity")
+ @ExcludeMissing
+ quantity: JsonField = JsonMissing.of(),
+ ) : this(object_, amount, apiKeyId, lineItem, projectId, quantity, mutableMapOf())
/**
* Expected to always return the following:
@@ -5103,6 +5244,15 @@ private constructor(
*/
fun projectId(): Optional = projectId.getOptional("project_id")
+ /**
+ * When `group_by=line_item`, this field provides the quantity of the grouped costs
+ * result.
+ *
+ * @throws OpenAIInvalidDataException if the JSON field has an unexpected type (e.g.
+ * if the server responded with an unexpected value).
+ */
+ fun quantity(): Optional = quantity.getOptional("quantity")
+
/**
* Returns the raw JSON value of [amount].
*
@@ -5141,6 +5291,16 @@ private constructor(
@ExcludeMissing
fun _projectId(): JsonField = projectId
+ /**
+ * Returns the raw JSON value of [quantity].
+ *
+ * Unlike [quantity], this method doesn't throw if the JSON field has an unexpected
+ * type.
+ */
+ @JsonProperty("quantity")
+ @ExcludeMissing
+ fun _quantity(): JsonField = quantity
+
@JsonAnySetter
private fun putAdditionalProperty(key: String, value: JsonValue) {
additionalProperties.put(key, value)
@@ -5170,6 +5330,7 @@ private constructor(
private var apiKeyId: JsonField = JsonMissing.of()
private var lineItem: JsonField = JsonMissing.of()
private var projectId: JsonField = JsonMissing.of()
+ private var quantity: JsonField = JsonMissing.of()
private var additionalProperties: MutableMap = mutableMapOf()
@JvmSynthetic
@@ -5179,6 +5340,7 @@ private constructor(
apiKeyId = organizationCostsResult.apiKeyId
lineItem = organizationCostsResult.lineItem
projectId = organizationCostsResult.projectId
+ quantity = organizationCostsResult.quantity
additionalProperties =
organizationCostsResult.additionalProperties.toMutableMap()
}
@@ -5265,6 +5427,31 @@ private constructor(
this.projectId = projectId
}
+ /**
+ * When `group_by=line_item`, this field provides the quantity of the grouped
+ * costs result.
+ */
+ fun quantity(quantity: Double?) = quantity(JsonField.ofNullable(quantity))
+
+ /**
+ * Alias for [Builder.quantity].
+ *
+ * This unboxed primitive overload exists for backwards compatibility.
+ */
+ fun quantity(quantity: Double) = quantity(quantity as Double?)
+
+ /** Alias for calling [Builder.quantity] with `quantity.orElse(null)`. */
+ fun quantity(quantity: Optional) = quantity(quantity.getOrNull())
+
+ /**
+ * Sets [Builder.quantity] to an arbitrary JSON value.
+ *
+ * You should usually call [Builder.quantity] with a well-typed [Double] value
+ * instead. This method is primarily for setting the field to an undocumented or
+ * not yet supported value.
+ */
+ fun quantity(quantity: JsonField) = apply { this.quantity = quantity }
+
fun additionalProperties(additionalProperties: Map) = apply {
this.additionalProperties.clear()
putAllAdditionalProperties(additionalProperties)
@@ -5299,12 +5486,23 @@ private constructor(
apiKeyId,
lineItem,
projectId,
+ quantity,
additionalProperties.toMutableMap(),
)
}
private var validated: Boolean = false
+ /**
+ * Validates that the types of all values in this object match their expected types
+ * recursively.
+ *
+ * This method is _not_ forwards compatible with new types from the API for existing
+ * fields.
+ *
+ * @throws OpenAIInvalidDataException if any value type in this object doesn't match
+ * its expected type.
+ */
fun validate(): OrganizationCostsResult = apply {
if (validated) {
return@apply
@@ -5319,6 +5517,7 @@ private constructor(
apiKeyId()
lineItem()
projectId()
+ quantity()
validated = true
}
@@ -5344,7 +5543,8 @@ private constructor(
(amount.asKnown().getOrNull()?.validity() ?: 0) +
(if (apiKeyId.asKnown().isPresent) 1 else 0) +
(if (lineItem.asKnown().isPresent) 1 else 0) +
- (if (projectId.asKnown().isPresent) 1 else 0)
+ (if (projectId.asKnown().isPresent) 1 else 0) +
+ (if (quantity.asKnown().isPresent) 1 else 0)
/** The monetary value in its associated currency. */
class Amount
@@ -5491,6 +5691,16 @@ private constructor(
private var validated: Boolean = false
+ /**
+ * Validates that the types of all values in this object match their expected
+ * types recursively.
+ *
+ * This method is _not_ forwards compatible with new types from the API for
+ * existing fields.
+ *
+ * @throws OpenAIInvalidDataException if any value type in this object doesn't
+ * match its expected type.
+ */
fun validate(): Amount = apply {
if (validated) {
return@apply
@@ -5552,6 +5762,7 @@ private constructor(
apiKeyId == other.apiKeyId &&
lineItem == other.lineItem &&
projectId == other.projectId &&
+ quantity == other.quantity &&
additionalProperties == other.additionalProperties
}
@@ -5562,6 +5773,7 @@ private constructor(
apiKeyId,
lineItem,
projectId,
+ quantity,
additionalProperties,
)
}
@@ -5569,7 +5781,7 @@ private constructor(
override fun hashCode(): Int = hashCode
override fun toString() =
- "OrganizationCostsResult{object_=$object_, amount=$amount, apiKeyId=$apiKeyId, lineItem=$lineItem, projectId=$projectId, additionalProperties=$additionalProperties}"
+ "OrganizationCostsResult{object_=$object_, amount=$amount, apiKeyId=$apiKeyId, lineItem=$lineItem, projectId=$projectId, quantity=$quantity, additionalProperties=$additionalProperties}"
}
}
diff --git a/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/usage/UsageCodeInterpreterSessionsParams.kt b/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/usage/UsageCodeInterpreterSessionsParams.kt
index e672252be..be717480f 100644
--- a/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/usage/UsageCodeInterpreterSessionsParams.kt
+++ b/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/usage/UsageCodeInterpreterSessionsParams.kt
@@ -435,6 +435,15 @@ private constructor(
private var validated: Boolean = false
+ /**
+ * Validates that the types of all values in this object match their expected types
+ * recursively.
+ *
+ * This method is _not_ forwards compatible with new types from the API for existing fields.
+ *
+ * @throws OpenAIInvalidDataException if any value type in this object doesn't match its
+ * expected type.
+ */
fun validate(): BucketWidth = apply {
if (validated) {
return@apply
@@ -554,6 +563,15 @@ private constructor(
private var validated: Boolean = false
+ /**
+ * Validates that the types of all values in this object match their expected types
+ * recursively.
+ *
+ * This method is _not_ forwards compatible with new types from the API for existing fields.
+ *
+ * @throws OpenAIInvalidDataException if any value type in this object doesn't match its
+ * expected type.
+ */
fun validate(): GroupBy = apply {
if (validated) {
return@apply
diff --git a/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/usage/UsageCodeInterpreterSessionsResponse.kt b/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/usage/UsageCodeInterpreterSessionsResponse.kt
index 61f3f7b76..c7256b358 100644
--- a/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/usage/UsageCodeInterpreterSessionsResponse.kt
+++ b/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/usage/UsageCodeInterpreterSessionsResponse.kt
@@ -252,6 +252,14 @@ private constructor(
private var validated: Boolean = false
+ /**
+ * Validates that the types of all values in this object match their expected types recursively.
+ *
+ * This method is _not_ forwards compatible with new types from the API for existing fields.
+ *
+ * @throws OpenAIInvalidDataException if any value type in this object doesn't match its
+ * expected type.
+ */
fun validate(): UsageCodeInterpreterSessionsResponse = apply {
if (validated) {
return@apply
@@ -619,6 +627,15 @@ private constructor(
private var validated: Boolean = false
+ /**
+ * Validates that the types of all values in this object match their expected types
+ * recursively.
+ *
+ * This method is _not_ forwards compatible with new types from the API for existing fields.
+ *
+ * @throws OpenAIInvalidDataException if any value type in this object doesn't match its
+ * expected type.
+ */
fun validate(): Data = apply {
if (validated) {
return@apply
@@ -784,6 +801,36 @@ private constructor(
fun _json(): Optional = Optional.ofNullable(_json)
+ /**
+ * Maps this instance's current variant to a value of type [T] using the given
+ * [visitor].
+ *
+ * Note that this method is _not_ forwards compatible with new variants from the API,
+ * unless [visitor] overrides [Visitor.unknown]. To handle variants not known to this
+ * version of the SDK gracefully, consider overriding [Visitor.unknown]:
+ * ```java
+ * import com.openai.core.JsonValue;
+ * import java.util.Optional;
+ *
+ * Optional result = result.accept(new Result.Visitor>() {
+ * @Override
+ * public Optional visitOrganizationUsageCompletions(OrganizationUsageCompletionsResult organizationUsageCompletions) {
+ * return Optional.of(organizationUsageCompletions.toString());
+ * }
+ *
+ * // ...
+ *
+ * @Override
+ * public Optional unknown(JsonValue json) {
+ * // Or inspect the `json`.
+ * return Optional.empty();
+ * }
+ * });
+ * ```
+ *
+ * @throws OpenAIInvalidDataException if [Visitor.unknown] is not overridden in
+ * [visitor] and the current variant is unknown.
+ */
fun accept(visitor: Visitor): T =
when {
organizationUsageCompletions != null ->
@@ -812,6 +859,16 @@ private constructor(
private var validated: Boolean = false
+ /**
+ * Validates that the types of all values in this object match their expected types
+ * recursively.
+ *
+ * This method is _not_ forwards compatible with new types from the API for existing
+ * fields.
+ *
+ * @throws OpenAIInvalidDataException if any value type in this object doesn't match its
+ * expected type.
+ */
fun validate(): Result = apply {
if (validated) {
return@apply
@@ -1924,6 +1981,16 @@ private constructor(
private var validated: Boolean = false
+ /**
+ * Validates that the types of all values in this object match their expected types
+ * recursively.
+ *
+ * This method is _not_ forwards compatible with new types from the API for existing
+ * fields.
+ *
+ * @throws OpenAIInvalidDataException if any value type in this object doesn't match
+ * its expected type.
+ */
fun validate(): OrganizationUsageCompletionsResult = apply {
if (validated) {
return@apply
@@ -2418,6 +2485,16 @@ private constructor(
private var validated: Boolean = false
+ /**
+ * Validates that the types of all values in this object match their expected types
+ * recursively.
+ *
+ * This method is _not_ forwards compatible with new types from the API for existing
+ * fields.
+ *
+ * @throws OpenAIInvalidDataException if any value type in this object doesn't match
+ * its expected type.
+ */
fun validate(): OrganizationUsageEmbeddingsResult = apply {
if (validated) {
return@apply
@@ -2888,6 +2965,16 @@ private constructor(
private var validated: Boolean = false
+ /**
+ * Validates that the types of all values in this object match their expected types
+ * recursively.
+ *
+ * This method is _not_ forwards compatible with new types from the API for existing
+ * fields.
+ *
+ * @throws OpenAIInvalidDataException if any value type in this object doesn't match
+ * its expected type.
+ */
fun validate(): OrganizationUsageModerationsResult = apply {
if (validated) {
return@apply
@@ -3441,6 +3528,16 @@ private constructor(
private var validated: Boolean = false
+ /**
+ * Validates that the types of all values in this object match their expected types
+ * recursively.
+ *
+ * This method is _not_ forwards compatible with new types from the API for existing
+ * fields.
+ *
+ * @throws OpenAIInvalidDataException if any value type in this object doesn't match
+ * its expected type.
+ */
fun validate(): OrganizationUsageImagesResult = apply {
if (validated) {
return@apply
@@ -3918,6 +4015,16 @@ private constructor(
private var validated: Boolean = false
+ /**
+ * Validates that the types of all values in this object match their expected types
+ * recursively.
+ *
+ * This method is _not_ forwards compatible with new types from the API for existing
+ * fields.
+ *
+ * @throws OpenAIInvalidDataException if any value type in this object doesn't match
+ * its expected type.
+ */
fun validate(): OrganizationUsageAudioSpeechesResult = apply {
if (validated) {
return@apply
@@ -4388,6 +4495,16 @@ private constructor(
private var validated: Boolean = false
+ /**
+ * Validates that the types of all values in this object match their expected types
+ * recursively.
+ *
+ * This method is _not_ forwards compatible with new types from the API for existing
+ * fields.
+ *
+ * @throws OpenAIInvalidDataException if any value type in this object doesn't match
+ * its expected type.
+ */
fun validate(): OrganizationUsageAudioTranscriptionsResult = apply {
if (validated) {
return@apply
@@ -4684,6 +4801,16 @@ private constructor(
private var validated: Boolean = false
+ /**
+ * Validates that the types of all values in this object match their expected types
+ * recursively.
+ *
+ * This method is _not_ forwards compatible with new types from the API for existing
+ * fields.
+ *
+ * @throws OpenAIInvalidDataException if any value type in this object doesn't match
+ * its expected type.
+ */
fun validate(): OrganizationUsageVectorStoresResult = apply {
if (validated) {
return@apply
@@ -4958,6 +5085,16 @@ private constructor(
private var validated: Boolean = false
+ /**
+ * Validates that the types of all values in this object match their expected types
+ * recursively.
+ *
+ * This method is _not_ forwards compatible with new types from the API for existing
+ * fields.
+ *
+ * @throws OpenAIInvalidDataException if any value type in this object doesn't match
+ * its expected type.
+ */
fun validate(): OrganizationUsageCodeInterpreterSessionsResult = apply {
if (validated) {
return@apply
@@ -5038,6 +5175,7 @@ private constructor(
private val apiKeyId: JsonField,
private val lineItem: JsonField,
private val projectId: JsonField,
+ private val quantity: JsonField,
private val additionalProperties: MutableMap,
) {
@@ -5056,7 +5194,10 @@ private constructor(
@JsonProperty("project_id")
@ExcludeMissing
projectId: JsonField = JsonMissing.of(),
- ) : this(object_, amount, apiKeyId, lineItem, projectId, mutableMapOf())
+ @JsonProperty("quantity")
+ @ExcludeMissing
+ quantity: JsonField = JsonMissing.of(),
+ ) : this(object_, amount, apiKeyId, lineItem, projectId, quantity, mutableMapOf())
/**
* Expected to always return the following:
@@ -5104,6 +5245,15 @@ private constructor(
*/
fun projectId(): Optional = projectId.getOptional("project_id")
+ /**
+ * When `group_by=line_item`, this field provides the quantity of the grouped costs
+ * result.
+ *
+ * @throws OpenAIInvalidDataException if the JSON field has an unexpected type (e.g.
+ * if the server responded with an unexpected value).
+ */
+ fun quantity(): Optional = quantity.getOptional("quantity")
+
/**
* Returns the raw JSON value of [amount].
*
@@ -5142,6 +5292,16 @@ private constructor(
@ExcludeMissing
fun _projectId(): JsonField = projectId
+ /**
+ * Returns the raw JSON value of [quantity].
+ *
+ * Unlike [quantity], this method doesn't throw if the JSON field has an unexpected
+ * type.
+ */
+ @JsonProperty("quantity")
+ @ExcludeMissing
+ fun _quantity(): JsonField = quantity
+
@JsonAnySetter
private fun putAdditionalProperty(key: String, value: JsonValue) {
additionalProperties.put(key, value)
@@ -5171,6 +5331,7 @@ private constructor(
private var apiKeyId: JsonField = JsonMissing.of()
private var lineItem: JsonField = JsonMissing.of()
private var projectId: JsonField = JsonMissing.of()
+ private var quantity: JsonField = JsonMissing.of()
private var additionalProperties: MutableMap = mutableMapOf()
@JvmSynthetic
@@ -5180,6 +5341,7 @@ private constructor(
apiKeyId = organizationCostsResult.apiKeyId
lineItem = organizationCostsResult.lineItem
projectId = organizationCostsResult.projectId
+ quantity = organizationCostsResult.quantity
additionalProperties =
organizationCostsResult.additionalProperties.toMutableMap()
}
@@ -5266,6 +5428,31 @@ private constructor(
this.projectId = projectId
}
+ /**
+ * When `group_by=line_item`, this field provides the quantity of the grouped
+ * costs result.
+ */
+ fun quantity(quantity: Double?) = quantity(JsonField.ofNullable(quantity))
+
+ /**
+ * Alias for [Builder.quantity].
+ *
+ * This unboxed primitive overload exists for backwards compatibility.
+ */
+ fun quantity(quantity: Double) = quantity(quantity as Double?)
+
+ /** Alias for calling [Builder.quantity] with `quantity.orElse(null)`. */
+ fun quantity(quantity: Optional) = quantity(quantity.getOrNull())
+
+ /**
+ * Sets [Builder.quantity] to an arbitrary JSON value.
+ *
+ * You should usually call [Builder.quantity] with a well-typed [Double] value
+ * instead. This method is primarily for setting the field to an undocumented or
+ * not yet supported value.
+ */
+ fun quantity(quantity: JsonField) = apply { this.quantity = quantity }
+
fun additionalProperties(additionalProperties: Map) = apply {
this.additionalProperties.clear()
putAllAdditionalProperties(additionalProperties)
@@ -5300,12 +5487,23 @@ private constructor(
apiKeyId,
lineItem,
projectId,
+ quantity,
additionalProperties.toMutableMap(),
)
}
private var validated: Boolean = false
+ /**
+ * Validates that the types of all values in this object match their expected types
+ * recursively.
+ *
+ * This method is _not_ forwards compatible with new types from the API for existing
+ * fields.
+ *
+ * @throws OpenAIInvalidDataException if any value type in this object doesn't match
+ * its expected type.
+ */
fun validate(): OrganizationCostsResult = apply {
if (validated) {
return@apply
@@ -5320,6 +5518,7 @@ private constructor(
apiKeyId()
lineItem()
projectId()
+ quantity()
validated = true
}
@@ -5345,7 +5544,8 @@ private constructor(
(amount.asKnown().getOrNull()?.validity() ?: 0) +
(if (apiKeyId.asKnown().isPresent) 1 else 0) +
(if (lineItem.asKnown().isPresent) 1 else 0) +
- (if (projectId.asKnown().isPresent) 1 else 0)
+ (if (projectId.asKnown().isPresent) 1 else 0) +
+ (if (quantity.asKnown().isPresent) 1 else 0)
/** The monetary value in its associated currency. */
class Amount
@@ -5492,6 +5692,16 @@ private constructor(
private var validated: Boolean = false
+ /**
+ * Validates that the types of all values in this object match their expected
+ * types recursively.
+ *
+ * This method is _not_ forwards compatible with new types from the API for
+ * existing fields.
+ *
+ * @throws OpenAIInvalidDataException if any value type in this object doesn't
+ * match its expected type.
+ */
fun validate(): Amount = apply {
if (validated) {
return@apply
@@ -5553,6 +5763,7 @@ private constructor(
apiKeyId == other.apiKeyId &&
lineItem == other.lineItem &&
projectId == other.projectId &&
+ quantity == other.quantity &&
additionalProperties == other.additionalProperties
}
@@ -5563,6 +5774,7 @@ private constructor(
apiKeyId,
lineItem,
projectId,
+ quantity,
additionalProperties,
)
}
@@ -5570,7 +5782,7 @@ private constructor(
override fun hashCode(): Int = hashCode
override fun toString() =
- "OrganizationCostsResult{object_=$object_, amount=$amount, apiKeyId=$apiKeyId, lineItem=$lineItem, projectId=$projectId, additionalProperties=$additionalProperties}"
+ "OrganizationCostsResult{object_=$object_, amount=$amount, apiKeyId=$apiKeyId, lineItem=$lineItem, projectId=$projectId, quantity=$quantity, additionalProperties=$additionalProperties}"
}
}
diff --git a/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/usage/UsageCompletionsParams.kt b/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/usage/UsageCompletionsParams.kt
index b9ad2fb9f..8b262f689 100644
--- a/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/usage/UsageCompletionsParams.kt
+++ b/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/usage/UsageCompletionsParams.kt
@@ -536,6 +536,15 @@ private constructor(
private var validated: Boolean = false
+ /**
+ * Validates that the types of all values in this object match their expected types
+ * recursively.
+ *
+ * This method is _not_ forwards compatible with new types from the API for existing fields.
+ *
+ * @throws OpenAIInvalidDataException if any value type in this object doesn't match its
+ * expected type.
+ */
fun validate(): BucketWidth = apply {
if (validated) {
return@apply
@@ -685,6 +694,15 @@ private constructor(
private var validated: Boolean = false
+ /**
+ * Validates that the types of all values in this object match their expected types
+ * recursively.
+ *
+ * This method is _not_ forwards compatible with new types from the API for existing fields.
+ *
+ * @throws OpenAIInvalidDataException if any value type in this object doesn't match its
+ * expected type.
+ */
fun validate(): GroupBy = apply {
if (validated) {
return@apply
diff --git a/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/usage/UsageCompletionsResponse.kt b/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/usage/UsageCompletionsResponse.kt
index f7b054541..e376b595b 100644
--- a/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/usage/UsageCompletionsResponse.kt
+++ b/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/usage/UsageCompletionsResponse.kt
@@ -248,6 +248,14 @@ private constructor(
private var validated: Boolean = false
+ /**
+ * Validates that the types of all values in this object match their expected types recursively.
+ *
+ * This method is _not_ forwards compatible with new types from the API for existing fields.
+ *
+ * @throws OpenAIInvalidDataException if any value type in this object doesn't match its
+ * expected type.
+ */
fun validate(): UsageCompletionsResponse = apply {
if (validated) {
return@apply
@@ -615,6 +623,15 @@ private constructor(
private var validated: Boolean = false
+ /**
+ * Validates that the types of all values in this object match their expected types
+ * recursively.
+ *
+ * This method is _not_ forwards compatible with new types from the API for existing fields.
+ *
+ * @throws OpenAIInvalidDataException if any value type in this object doesn't match its
+ * expected type.
+ */
fun validate(): Data = apply {
if (validated) {
return@apply
@@ -780,6 +797,36 @@ private constructor(
fun _json(): Optional = Optional.ofNullable(_json)
+ /**
+ * Maps this instance's current variant to a value of type [T] using the given
+ * [visitor].
+ *
+ * Note that this method is _not_ forwards compatible with new variants from the API,
+ * unless [visitor] overrides [Visitor.unknown]. To handle variants not known to this
+ * version of the SDK gracefully, consider overriding [Visitor.unknown]:
+ * ```java
+ * import com.openai.core.JsonValue;
+ * import java.util.Optional;
+ *
+ * Optional result = result.accept(new Result.Visitor>() {
+ * @Override
+ * public Optional visitOrganizationUsageCompletions(OrganizationUsageCompletionsResult organizationUsageCompletions) {
+ * return Optional.of(organizationUsageCompletions.toString());
+ * }
+ *
+ * // ...
+ *
+ * @Override
+ * public Optional