diff --git a/.release-please-manifest.json b/.release-please-manifest.json
index 934f2cc0..3d5f4e35 100644
--- a/.release-please-manifest.json
+++ b/.release-please-manifest.json
@@ -1,3 +1,3 @@
{
- ".": "4.4.0"
+ ".": "4.5.0"
}
\ No newline at end of file
diff --git a/.stats.yml b/.stats.yml
index 09d2eb1d..3a558a91 100644
--- a/.stats.yml
+++ b/.stats.yml
@@ -1,4 +1,4 @@
-configured_endpoints: 135
-openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/openai%2Fopenai-104cced8f4c7436a76eea02e26307828166405ccfb296faffb008b72772c11a7.yml
-openapi_spec_hash: fdc03ed84a65a31b80da909255e53924
-config_hash: 03b48e9b8c7231a902403210dbd7dfa0
+configured_endpoints: 134
+openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/openai%2Fopenai-f59befea071ed7729cbb7bce219e7f837eccfdb57e01698514e6a0bd6052ff60.yml
+openapi_spec_hash: 49da48619d37932b2e257c532078b2bb
+config_hash: 1af83449a09a3b4f276444dbcdd3eb67
diff --git a/CHANGELOG.md b/CHANGELOG.md
index ed4eba82..d51abb72 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,5 +1,13 @@
# Changelog
+## 4.5.0 (2025-10-17)
+
+Full Changelog: [v4.4.0...v4.5.0](https://github.com/openai/openai-java/compare/v4.4.0...v4.5.0)
+
+### Features
+
+* **api:** api update ([09dd95f](https://github.com/openai/openai-java/commit/09dd95f948bca9e26597a9971d7799a1defb6a28))
+
## 4.4.0 (2025-10-16)
Full Changelog: [v4.3.0...v4.4.0](https://github.com/openai/openai-java/compare/v4.3.0...v4.4.0)
diff --git a/README.md b/README.md
index 223eb98c..3de7c0aa 100644
--- a/README.md
+++ b/README.md
@@ -2,8 +2,8 @@
-[](https://central.sonatype.com/artifact/com.openai/openai-java/4.4.0)
-[](https://javadoc.io/doc/com.openai/openai-java/4.4.0)
+[](https://central.sonatype.com/artifact/com.openai/openai-java/4.5.0)
+[](https://javadoc.io/doc/com.openai/openai-java/4.5.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.4.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.5.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.4.0")
+implementation("com.openai:openai-java:4.5.0")
```
### Maven
@@ -33,7 +33,7 @@ implementation("com.openai:openai-java:4.4.0")
com.openai
openai-java
- 4.4.0
+ 4.5.0
```
@@ -1342,7 +1342,7 @@ If you're using Spring Boot, then you can use the SDK's [Spring Boot starter](ht
#### Gradle
```kotlin
-implementation("com.openai:openai-java-spring-boot-starter:4.4.0")
+implementation("com.openai:openai-java-spring-boot-starter:4.5.0")
```
#### Maven
@@ -1351,7 +1351,7 @@ implementation("com.openai:openai-java-spring-boot-starter:4.4.0")
com.openai
openai-java-spring-boot-starter
- 4.4.0
+ 4.5.0
```
diff --git a/build.gradle.kts b/build.gradle.kts
index 70207938..d41efe34 100644
--- a/build.gradle.kts
+++ b/build.gradle.kts
@@ -8,7 +8,7 @@ repositories {
allprojects {
group = "com.openai"
- version = "4.4.0" // x-release-please-version
+ version = "4.5.0" // x-release-please-version
}
subprojects {
diff --git a/openai-java-core/src/main/kotlin/com/openai/models/beta/chatkit/ChatKitUploadFileParams.kt b/openai-java-core/src/main/kotlin/com/openai/models/beta/chatkit/ChatKitUploadFileParams.kt
deleted file mode 100644
index c1f77347..00000000
--- a/openai-java-core/src/main/kotlin/com/openai/models/beta/chatkit/ChatKitUploadFileParams.kt
+++ /dev/null
@@ -1,446 +0,0 @@
-// File generated from our OpenAPI spec by Stainless.
-
-package com.openai.models.beta.chatkit
-
-import com.fasterxml.jackson.annotation.JsonAnyGetter
-import com.fasterxml.jackson.annotation.JsonAnySetter
-import com.fasterxml.jackson.annotation.JsonProperty
-import com.openai.core.ExcludeMissing
-import com.openai.core.JsonValue
-import com.openai.core.MultipartField
-import com.openai.core.Params
-import com.openai.core.checkRequired
-import com.openai.core.http.Headers
-import com.openai.core.http.QueryParams
-import com.openai.core.toImmutable
-import com.openai.errors.OpenAIInvalidDataException
-import java.io.InputStream
-import java.nio.file.Path
-import java.util.Collections
-import java.util.Objects
-import kotlin.io.path.inputStream
-import kotlin.io.path.name
-
-/** Upload a ChatKit file */
-class ChatKitUploadFileParams
-private constructor(
- private val body: Body,
- private val additionalHeaders: Headers,
- private val additionalQueryParams: QueryParams,
-) : Params {
-
- /**
- * Binary file contents to store with the ChatKit session. Supports PDFs and PNG, JPG, JPEG,
- * GIF, or WEBP images.
- *
- * @throws OpenAIInvalidDataException if the JSON field has an unexpected type or is
- * unexpectedly missing or null (e.g. if the server responded with an unexpected value).
- */
- fun file(): InputStream = body.file()
-
- /**
- * Returns the raw multipart value of [file].
- *
- * Unlike [file], this method doesn't throw if the multipart field has an unexpected type.
- */
- fun _file(): MultipartField = body._file()
-
- fun _additionalBodyProperties(): Map = body._additionalProperties()
-
- /** Additional headers to send with the request. */
- fun _additionalHeaders(): Headers = additionalHeaders
-
- /** Additional query param to send with the request. */
- fun _additionalQueryParams(): QueryParams = additionalQueryParams
-
- fun toBuilder() = Builder().from(this)
-
- companion object {
-
- /**
- * Returns a mutable builder for constructing an instance of [ChatKitUploadFileParams].
- *
- * The following fields are required:
- * ```java
- * .file()
- * ```
- */
- @JvmStatic fun builder() = Builder()
- }
-
- /** A builder for [ChatKitUploadFileParams]. */
- class Builder internal constructor() {
-
- private var body: Body.Builder = Body.builder()
- private var additionalHeaders: Headers.Builder = Headers.builder()
- private var additionalQueryParams: QueryParams.Builder = QueryParams.builder()
-
- @JvmSynthetic
- internal fun from(chatkitUploadFileParams: ChatKitUploadFileParams) = apply {
- body = chatkitUploadFileParams.body.toBuilder()
- additionalHeaders = chatkitUploadFileParams.additionalHeaders.toBuilder()
- additionalQueryParams = chatkitUploadFileParams.additionalQueryParams.toBuilder()
- }
-
- /**
- * Sets the entire request body.
- *
- * This is generally only useful if you are already constructing the body separately.
- * Otherwise, it's more convenient to use the top-level setters instead:
- * - [file]
- */
- fun body(body: Body) = apply { this.body = body.toBuilder() }
-
- /**
- * Binary file contents to store with the ChatKit session. Supports PDFs and PNG, JPG, JPEG,
- * GIF, or WEBP images.
- */
- fun file(file: InputStream) = apply { body.file(file) }
-
- /**
- * Sets [Builder.file] to an arbitrary multipart value.
- *
- * You should usually call [Builder.file] with a well-typed [InputStream] value instead.
- * This method is primarily for setting the field to an undocumented or not yet supported
- * value.
- */
- fun file(file: MultipartField) = apply { body.file(file) }
-
- /**
- * Binary file contents to store with the ChatKit session. Supports PDFs and PNG, JPG, JPEG,
- * GIF, or WEBP images.
- */
- fun file(file: ByteArray) = apply { body.file(file) }
-
- /**
- * Binary file contents to store with the ChatKit session. Supports PDFs and PNG, JPG, JPEG,
- * GIF, or WEBP images.
- */
- fun file(path: Path) = apply { body.file(path) }
-
- fun additionalBodyProperties(additionalBodyProperties: Map) = apply {
- body.additionalProperties(additionalBodyProperties)
- }
-
- fun putAdditionalBodyProperty(key: String, value: JsonValue) = apply {
- body.putAdditionalProperty(key, value)
- }
-
- fun putAllAdditionalBodyProperties(additionalBodyProperties: Map) =
- apply {
- body.putAllAdditionalProperties(additionalBodyProperties)
- }
-
- fun removeAdditionalBodyProperty(key: String) = apply { body.removeAdditionalProperty(key) }
-
- fun removeAllAdditionalBodyProperties(keys: Set) = apply {
- body.removeAllAdditionalProperties(keys)
- }
-
- fun additionalHeaders(additionalHeaders: Headers) = apply {
- this.additionalHeaders.clear()
- putAllAdditionalHeaders(additionalHeaders)
- }
-
- fun additionalHeaders(additionalHeaders: Map>) = apply {
- this.additionalHeaders.clear()
- putAllAdditionalHeaders(additionalHeaders)
- }
-
- fun putAdditionalHeader(name: String, value: String) = apply {
- additionalHeaders.put(name, value)
- }
-
- fun putAdditionalHeaders(name: String, values: Iterable) = apply {
- additionalHeaders.put(name, values)
- }
-
- fun putAllAdditionalHeaders(additionalHeaders: Headers) = apply {
- this.additionalHeaders.putAll(additionalHeaders)
- }
-
- fun putAllAdditionalHeaders(additionalHeaders: Map>) = apply {
- this.additionalHeaders.putAll(additionalHeaders)
- }
-
- fun replaceAdditionalHeaders(name: String, value: String) = apply {
- additionalHeaders.replace(name, value)
- }
-
- fun replaceAdditionalHeaders(name: String, values: Iterable) = apply {
- additionalHeaders.replace(name, values)
- }
-
- fun replaceAllAdditionalHeaders(additionalHeaders: Headers) = apply {
- this.additionalHeaders.replaceAll(additionalHeaders)
- }
-
- fun replaceAllAdditionalHeaders(additionalHeaders: Map>) = apply {
- this.additionalHeaders.replaceAll(additionalHeaders)
- }
-
- fun removeAdditionalHeaders(name: String) = apply { additionalHeaders.remove(name) }
-
- fun removeAllAdditionalHeaders(names: Set) = apply {
- additionalHeaders.removeAll(names)
- }
-
- fun additionalQueryParams(additionalQueryParams: QueryParams) = apply {
- this.additionalQueryParams.clear()
- putAllAdditionalQueryParams(additionalQueryParams)
- }
-
- fun additionalQueryParams(additionalQueryParams: Map>) = apply {
- this.additionalQueryParams.clear()
- putAllAdditionalQueryParams(additionalQueryParams)
- }
-
- fun putAdditionalQueryParam(key: String, value: String) = apply {
- additionalQueryParams.put(key, value)
- }
-
- fun putAdditionalQueryParams(key: String, values: Iterable) = apply {
- additionalQueryParams.put(key, values)
- }
-
- fun putAllAdditionalQueryParams(additionalQueryParams: QueryParams) = apply {
- this.additionalQueryParams.putAll(additionalQueryParams)
- }
-
- fun putAllAdditionalQueryParams(additionalQueryParams: Map>) =
- apply {
- this.additionalQueryParams.putAll(additionalQueryParams)
- }
-
- fun replaceAdditionalQueryParams(key: String, value: String) = apply {
- additionalQueryParams.replace(key, value)
- }
-
- fun replaceAdditionalQueryParams(key: String, values: Iterable) = apply {
- additionalQueryParams.replace(key, values)
- }
-
- fun replaceAllAdditionalQueryParams(additionalQueryParams: QueryParams) = apply {
- this.additionalQueryParams.replaceAll(additionalQueryParams)
- }
-
- fun replaceAllAdditionalQueryParams(additionalQueryParams: Map>) =
- apply {
- this.additionalQueryParams.replaceAll(additionalQueryParams)
- }
-
- fun removeAdditionalQueryParams(key: String) = apply { additionalQueryParams.remove(key) }
-
- fun removeAllAdditionalQueryParams(keys: Set) = apply {
- additionalQueryParams.removeAll(keys)
- }
-
- /**
- * Returns an immutable instance of [ChatKitUploadFileParams].
- *
- * Further updates to this [Builder] will not mutate the returned instance.
- *
- * The following fields are required:
- * ```java
- * .file()
- * ```
- *
- * @throws IllegalStateException if any required field is unset.
- */
- fun build(): ChatKitUploadFileParams =
- ChatKitUploadFileParams(
- body.build(),
- additionalHeaders.build(),
- additionalQueryParams.build(),
- )
- }
-
- fun _body(): Map> =
- (mapOf("file" to _file()) +
- _additionalBodyProperties().mapValues { (_, value) -> MultipartField.of(value) })
- .toImmutable()
-
- override fun _headers(): Headers = additionalHeaders
-
- override fun _queryParams(): QueryParams = additionalQueryParams
-
- /** Parameters for uploading an attachment to the active ChatKit session. */
- class Body
- private constructor(
- private val file: MultipartField,
- private val additionalProperties: MutableMap,
- ) {
-
- /**
- * Binary file contents to store with the ChatKit session. Supports PDFs and PNG, JPG, JPEG,
- * GIF, or WEBP images.
- *
- * @throws OpenAIInvalidDataException if the JSON field has an unexpected type or is
- * unexpectedly missing or null (e.g. if the server responded with an unexpected value).
- */
- fun file(): InputStream = file.value.getRequired("file")
-
- /**
- * Returns the raw multipart value of [file].
- *
- * Unlike [file], this method doesn't throw if the multipart field has an unexpected type.
- */
- @JsonProperty("file") @ExcludeMissing fun _file(): MultipartField = file
-
- @JsonAnySetter
- private fun putAdditionalProperty(key: String, value: JsonValue) {
- additionalProperties.put(key, value)
- }
-
- @JsonAnyGetter
- @ExcludeMissing
- fun _additionalProperties(): Map =
- Collections.unmodifiableMap(additionalProperties)
-
- fun toBuilder() = Builder().from(this)
-
- companion object {
-
- /**
- * Returns a mutable builder for constructing an instance of [Body].
- *
- * The following fields are required:
- * ```java
- * .file()
- * ```
- */
- @JvmStatic fun builder() = Builder()
- }
-
- /** A builder for [Body]. */
- class Builder internal constructor() {
-
- private var file: MultipartField? = null
- private var additionalProperties: MutableMap = mutableMapOf()
-
- @JvmSynthetic
- internal fun from(body: Body) = apply {
- file = body.file
- additionalProperties = body.additionalProperties.toMutableMap()
- }
-
- /**
- * Binary file contents to store with the ChatKit session. Supports PDFs and PNG, JPG,
- * JPEG, GIF, or WEBP images.
- */
- fun file(file: InputStream) = file(MultipartField.of(file))
-
- /**
- * Sets [Builder.file] to an arbitrary multipart value.
- *
- * You should usually call [Builder.file] with a well-typed [InputStream] value instead.
- * This method is primarily for setting the field to an undocumented or not yet
- * supported value.
- */
- fun file(file: MultipartField) = apply { this.file = file }
-
- /**
- * Binary file contents to store with the ChatKit session. Supports PDFs and PNG, JPG,
- * JPEG, GIF, or WEBP images.
- */
- fun file(file: ByteArray) = file(file.inputStream())
-
- /**
- * Binary file contents to store with the ChatKit session. Supports PDFs and PNG, JPG,
- * JPEG, GIF, or WEBP images.
- */
- fun file(path: Path) =
- file(
- MultipartField.builder()
- .value(path.inputStream())
- .filename(path.name)
- .build()
- )
-
- fun additionalProperties(additionalProperties: Map) = apply {
- this.additionalProperties.clear()
- putAllAdditionalProperties(additionalProperties)
- }
-
- fun putAdditionalProperty(key: String, value: JsonValue) = apply {
- additionalProperties.put(key, value)
- }
-
- fun putAllAdditionalProperties(additionalProperties: Map) = apply {
- this.additionalProperties.putAll(additionalProperties)
- }
-
- fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) }
-
- fun removeAllAdditionalProperties(keys: Set) = apply {
- keys.forEach(::removeAdditionalProperty)
- }
-
- /**
- * Returns an immutable instance of [Body].
- *
- * Further updates to this [Builder] will not mutate the returned instance.
- *
- * The following fields are required:
- * ```java
- * .file()
- * ```
- *
- * @throws IllegalStateException if any required field is unset.
- */
- fun build(): Body =
- Body(checkRequired("file", file), additionalProperties.toMutableMap())
- }
-
- private var validated: Boolean = false
-
- fun validate(): Body = apply {
- if (validated) {
- return@apply
- }
-
- file()
- validated = true
- }
-
- fun isValid(): Boolean =
- try {
- validate()
- true
- } catch (e: OpenAIInvalidDataException) {
- false
- }
-
- override fun equals(other: Any?): Boolean {
- if (this === other) {
- return true
- }
-
- return other is Body &&
- file == other.file &&
- additionalProperties == other.additionalProperties
- }
-
- private val hashCode: Int by lazy { Objects.hash(file, additionalProperties) }
-
- override fun hashCode(): Int = hashCode
-
- override fun toString() = "Body{file=$file, additionalProperties=$additionalProperties}"
- }
-
- override fun equals(other: Any?): Boolean {
- if (this === other) {
- return true
- }
-
- return other is ChatKitUploadFileParams &&
- body == other.body &&
- additionalHeaders == other.additionalHeaders &&
- additionalQueryParams == other.additionalQueryParams
- }
-
- override fun hashCode(): Int = Objects.hash(body, additionalHeaders, additionalQueryParams)
-
- override fun toString() =
- "ChatKitUploadFileParams{body=$body, additionalHeaders=$additionalHeaders, additionalQueryParams=$additionalQueryParams}"
-}
diff --git a/openai-java-core/src/main/kotlin/com/openai/models/beta/chatkit/ChatKitUploadFileResponse.kt b/openai-java-core/src/main/kotlin/com/openai/models/beta/chatkit/ChatKitUploadFileResponse.kt
deleted file mode 100644
index 9f38aedc..00000000
--- a/openai-java-core/src/main/kotlin/com/openai/models/beta/chatkit/ChatKitUploadFileResponse.kt
+++ /dev/null
@@ -1,196 +0,0 @@
-// File generated from our OpenAPI spec by Stainless.
-
-package com.openai.models.beta.chatkit
-
-import com.fasterxml.jackson.core.JsonGenerator
-import com.fasterxml.jackson.core.ObjectCodec
-import com.fasterxml.jackson.databind.JsonNode
-import com.fasterxml.jackson.databind.SerializerProvider
-import com.fasterxml.jackson.databind.annotation.JsonDeserialize
-import com.fasterxml.jackson.databind.annotation.JsonSerialize
-import com.fasterxml.jackson.module.kotlin.jacksonTypeRef
-import com.openai.core.BaseDeserializer
-import com.openai.core.BaseSerializer
-import com.openai.core.JsonValue
-import com.openai.core.getOrThrow
-import com.openai.errors.OpenAIInvalidDataException
-import java.util.Objects
-import java.util.Optional
-import kotlin.jvm.optionals.getOrNull
-
-/** Represents either a file or image attachment. */
-@JsonDeserialize(using = ChatKitUploadFileResponse.Deserializer::class)
-@JsonSerialize(using = ChatKitUploadFileResponse.Serializer::class)
-class ChatKitUploadFileResponse
-private constructor(
- private val file: FilePart? = null,
- private val image: ImagePart? = null,
- private val _json: JsonValue? = null,
-) {
-
- /** Metadata for a non-image file uploaded through ChatKit. */
- fun file(): Optional = Optional.ofNullable(file)
-
- /** Metadata for an image uploaded through ChatKit. */
- fun image(): Optional = Optional.ofNullable(image)
-
- fun isFile(): Boolean = file != null
-
- fun isImage(): Boolean = image != null
-
- /** Metadata for a non-image file uploaded through ChatKit. */
- fun asFile(): FilePart = file.getOrThrow("file")
-
- /** Metadata for an image uploaded through ChatKit. */
- fun asImage(): ImagePart = image.getOrThrow("image")
-
- fun _json(): Optional = Optional.ofNullable(_json)
-
- fun accept(visitor: Visitor): T =
- when {
- file != null -> visitor.visitFile(file)
- image != null -> visitor.visitImage(image)
- else -> visitor.unknown(_json)
- }
-
- private var validated: Boolean = false
-
- fun validate(): ChatKitUploadFileResponse = apply {
- if (validated) {
- return@apply
- }
-
- accept(
- object : Visitor {
- override fun visitFile(file: FilePart) {
- file.validate()
- }
-
- override fun visitImage(image: ImagePart) {
- image.validate()
- }
- }
- )
- validated = true
- }
-
- fun isValid(): Boolean =
- try {
- validate()
- true
- } catch (e: OpenAIInvalidDataException) {
- false
- }
-
- /**
- * Returns a score indicating how many valid values are contained in this object recursively.
- *
- * Used for best match union deserialization.
- */
- @JvmSynthetic
- internal fun validity(): Int =
- accept(
- object : Visitor {
- override fun visitFile(file: FilePart) = file.validity()
-
- override fun visitImage(image: ImagePart) = image.validity()
-
- override fun unknown(json: JsonValue?) = 0
- }
- )
-
- override fun equals(other: Any?): Boolean {
- if (this === other) {
- return true
- }
-
- return other is ChatKitUploadFileResponse && file == other.file && image == other.image
- }
-
- override fun hashCode(): Int = Objects.hash(file, image)
-
- override fun toString(): String =
- when {
- file != null -> "ChatKitUploadFileResponse{file=$file}"
- image != null -> "ChatKitUploadFileResponse{image=$image}"
- _json != null -> "ChatKitUploadFileResponse{_unknown=$_json}"
- else -> throw IllegalStateException("Invalid ChatKitUploadFileResponse")
- }
-
- companion object {
-
- /** Metadata for a non-image file uploaded through ChatKit. */
- @JvmStatic fun ofFile(file: FilePart) = ChatKitUploadFileResponse(file = file)
-
- /** Metadata for an image uploaded through ChatKit. */
- @JvmStatic fun ofImage(image: ImagePart) = ChatKitUploadFileResponse(image = image)
- }
-
- /**
- * An interface that defines how to map each variant of [ChatKitUploadFileResponse] to a value
- * of type [T].
- */
- interface Visitor {
-
- /** Metadata for a non-image file uploaded through ChatKit. */
- fun visitFile(file: FilePart): T
-
- /** Metadata for an image uploaded through ChatKit. */
- fun visitImage(image: ImagePart): T
-
- /**
- * Maps an unknown variant of [ChatKitUploadFileResponse] to a value of type [T].
- *
- * An instance of [ChatKitUploadFileResponse] can contain an unknown variant if it was
- * deserialized from data that doesn't match any known variant. For example, if the SDK is
- * on an older version than the API, then the API may respond with new variants that the SDK
- * is unaware of.
- *
- * @throws OpenAIInvalidDataException in the default implementation.
- */
- fun unknown(json: JsonValue?): T {
- throw OpenAIInvalidDataException("Unknown ChatKitUploadFileResponse: $json")
- }
- }
-
- internal class Deserializer :
- BaseDeserializer(ChatKitUploadFileResponse::class) {
-
- override fun ObjectCodec.deserialize(node: JsonNode): ChatKitUploadFileResponse {
- val json = JsonValue.fromJsonNode(node)
- val type = json.asObject().getOrNull()?.get("type")?.asString()?.getOrNull()
-
- when (type) {
- "file" -> {
- return tryDeserialize(node, jacksonTypeRef())?.let {
- ChatKitUploadFileResponse(file = it, _json = json)
- } ?: ChatKitUploadFileResponse(_json = json)
- }
- "image" -> {
- return tryDeserialize(node, jacksonTypeRef())?.let {
- ChatKitUploadFileResponse(image = it, _json = json)
- } ?: ChatKitUploadFileResponse(_json = json)
- }
- }
-
- return ChatKitUploadFileResponse(_json = json)
- }
- }
-
- internal class Serializer :
- BaseSerializer(ChatKitUploadFileResponse::class) {
-
- override fun serialize(
- value: ChatKitUploadFileResponse,
- generator: JsonGenerator,
- provider: SerializerProvider,
- ) {
- when {
- value.file != null -> generator.writeObject(value.file)
- value.image != null -> generator.writeObject(value.image)
- value._json != null -> generator.writeObject(value._json)
- else -> throw IllegalStateException("Invalid ChatKitUploadFileResponse")
- }
- }
- }
-}
diff --git a/openai-java-core/src/main/kotlin/com/openai/models/beta/chatkit/FilePart.kt b/openai-java-core/src/main/kotlin/com/openai/models/beta/chatkit/FilePart.kt
deleted file mode 100644
index 02fd2a27..00000000
--- a/openai-java-core/src/main/kotlin/com/openai/models/beta/chatkit/FilePart.kt
+++ /dev/null
@@ -1,341 +0,0 @@
-// File generated from our OpenAPI spec by Stainless.
-
-package com.openai.models.beta.chatkit
-
-import com.fasterxml.jackson.annotation.JsonAnyGetter
-import com.fasterxml.jackson.annotation.JsonAnySetter
-import com.fasterxml.jackson.annotation.JsonCreator
-import com.fasterxml.jackson.annotation.JsonProperty
-import com.openai.core.ExcludeMissing
-import com.openai.core.JsonField
-import com.openai.core.JsonMissing
-import com.openai.core.JsonValue
-import com.openai.core.checkRequired
-import com.openai.errors.OpenAIInvalidDataException
-import java.util.Collections
-import java.util.Objects
-import java.util.Optional
-import kotlin.jvm.optionals.getOrNull
-
-/** Metadata for a non-image file uploaded through ChatKit. */
-class FilePart
-@JsonCreator(mode = JsonCreator.Mode.DISABLED)
-private constructor(
- private val id: JsonField,
- private val mimeType: JsonField,
- private val name: JsonField,
- private val type: JsonValue,
- private val uploadUrl: JsonField,
- private val additionalProperties: MutableMap,
-) {
-
- @JsonCreator
- private constructor(
- @JsonProperty("id") @ExcludeMissing id: JsonField = JsonMissing.of(),
- @JsonProperty("mime_type") @ExcludeMissing mimeType: JsonField = JsonMissing.of(),
- @JsonProperty("name") @ExcludeMissing name: JsonField = JsonMissing.of(),
- @JsonProperty("type") @ExcludeMissing type: JsonValue = JsonMissing.of(),
- @JsonProperty("upload_url") @ExcludeMissing uploadUrl: JsonField = JsonMissing.of(),
- ) : this(id, mimeType, name, type, uploadUrl, mutableMapOf())
-
- /**
- * Unique identifier for the uploaded file.
- *
- * @throws OpenAIInvalidDataException if the JSON field has an unexpected type or is
- * unexpectedly missing or null (e.g. if the server responded with an unexpected value).
- */
- fun id(): String = id.getRequired("id")
-
- /**
- * MIME type reported for the uploaded file. Defaults to null when unknown.
- *
- * @throws OpenAIInvalidDataException if the JSON field has an unexpected type (e.g. if the
- * server responded with an unexpected value).
- */
- fun mimeType(): Optional = mimeType.getOptional("mime_type")
-
- /**
- * Original filename supplied by the uploader. Defaults to null when unnamed.
- *
- * @throws OpenAIInvalidDataException if the JSON field has an unexpected type (e.g. if the
- * server responded with an unexpected value).
- */
- fun name(): Optional = name.getOptional("name")
-
- /**
- * Type discriminator that is always `file`.
- *
- * Expected to always return the following:
- * ```java
- * JsonValue.from("file")
- * ```
- *
- * However, this method can be useful for debugging and logging (e.g. if the server responded
- * with an unexpected value).
- */
- @JsonProperty("type") @ExcludeMissing fun _type(): JsonValue = type
-
- /**
- * Signed URL for downloading the uploaded file. Defaults to null when no download link is
- * available.
- *
- * @throws OpenAIInvalidDataException if the JSON field has an unexpected type (e.g. if the
- * server responded with an unexpected value).
- */
- fun uploadUrl(): Optional = uploadUrl.getOptional("upload_url")
-
- /**
- * Returns the raw JSON value of [id].
- *
- * Unlike [id], this method doesn't throw if the JSON field has an unexpected type.
- */
- @JsonProperty("id") @ExcludeMissing fun _id(): JsonField = id
-
- /**
- * Returns the raw JSON value of [mimeType].
- *
- * Unlike [mimeType], this method doesn't throw if the JSON field has an unexpected type.
- */
- @JsonProperty("mime_type") @ExcludeMissing fun _mimeType(): JsonField = mimeType
-
- /**
- * Returns the raw JSON value of [name].
- *
- * Unlike [name], this method doesn't throw if the JSON field has an unexpected type.
- */
- @JsonProperty("name") @ExcludeMissing fun _name(): JsonField = name
-
- /**
- * Returns the raw JSON value of [uploadUrl].
- *
- * Unlike [uploadUrl], this method doesn't throw if the JSON field has an unexpected type.
- */
- @JsonProperty("upload_url") @ExcludeMissing fun _uploadUrl(): JsonField = uploadUrl
-
- @JsonAnySetter
- private fun putAdditionalProperty(key: String, value: JsonValue) {
- additionalProperties.put(key, value)
- }
-
- @JsonAnyGetter
- @ExcludeMissing
- fun _additionalProperties(): Map =
- Collections.unmodifiableMap(additionalProperties)
-
- fun toBuilder() = Builder().from(this)
-
- companion object {
-
- /**
- * Returns a mutable builder for constructing an instance of [FilePart].
- *
- * The following fields are required:
- * ```java
- * .id()
- * .mimeType()
- * .name()
- * .uploadUrl()
- * ```
- */
- @JvmStatic fun builder() = Builder()
- }
-
- /** A builder for [FilePart]. */
- class Builder internal constructor() {
-
- private var id: JsonField? = null
- private var mimeType: JsonField? = null
- private var name: JsonField? = null
- private var type: JsonValue = JsonValue.from("file")
- private var uploadUrl: JsonField? = null
- private var additionalProperties: MutableMap = mutableMapOf()
-
- @JvmSynthetic
- internal fun from(filePart: FilePart) = apply {
- id = filePart.id
- mimeType = filePart.mimeType
- name = filePart.name
- type = filePart.type
- uploadUrl = filePart.uploadUrl
- additionalProperties = filePart.additionalProperties.toMutableMap()
- }
-
- /** Unique identifier for the uploaded file. */
- fun id(id: String) = id(JsonField.of(id))
-
- /**
- * Sets [Builder.id] to an arbitrary JSON value.
- *
- * You should usually call [Builder.id] with a well-typed [String] value instead. This
- * method is primarily for setting the field to an undocumented or not yet supported value.
- */
- fun id(id: JsonField) = apply { this.id = id }
-
- /** MIME type reported for the uploaded file. Defaults to null when unknown. */
- fun mimeType(mimeType: String?) = mimeType(JsonField.ofNullable(mimeType))
-
- /** Alias for calling [Builder.mimeType] with `mimeType.orElse(null)`. */
- fun mimeType(mimeType: Optional) = mimeType(mimeType.getOrNull())
-
- /**
- * Sets [Builder.mimeType] to an arbitrary JSON value.
- *
- * You should usually call [Builder.mimeType] with a well-typed [String] value instead. This
- * method is primarily for setting the field to an undocumented or not yet supported value.
- */
- fun mimeType(mimeType: JsonField) = apply { this.mimeType = mimeType }
-
- /** Original filename supplied by the uploader. Defaults to null when unnamed. */
- fun name(name: String?) = name(JsonField.ofNullable(name))
-
- /** Alias for calling [Builder.name] with `name.orElse(null)`. */
- fun name(name: Optional) = name(name.getOrNull())
-
- /**
- * Sets [Builder.name] to an arbitrary JSON value.
- *
- * You should usually call [Builder.name] with a well-typed [String] value instead. This
- * method is primarily for setting the field to an undocumented or not yet supported value.
- */
- fun name(name: JsonField) = apply { this.name = name }
-
- /**
- * Sets the field to an arbitrary JSON value.
- *
- * It is usually unnecessary to call this method because the field defaults to the
- * following:
- * ```java
- * JsonValue.from("file")
- * ```
- *
- * This method is primarily for setting the field to an undocumented or not yet supported
- * value.
- */
- fun type(type: JsonValue) = apply { this.type = type }
-
- /**
- * Signed URL for downloading the uploaded file. Defaults to null when no download link is
- * available.
- */
- fun uploadUrl(uploadUrl: String?) = uploadUrl(JsonField.ofNullable(uploadUrl))
-
- /** Alias for calling [Builder.uploadUrl] with `uploadUrl.orElse(null)`. */
- fun uploadUrl(uploadUrl: Optional) = uploadUrl(uploadUrl.getOrNull())
-
- /**
- * Sets [Builder.uploadUrl] to an arbitrary JSON value.
- *
- * You should usually call [Builder.uploadUrl] with a well-typed [String] value instead.
- * This method is primarily for setting the field to an undocumented or not yet supported
- * value.
- */
- fun uploadUrl(uploadUrl: JsonField) = apply { this.uploadUrl = uploadUrl }
-
- fun additionalProperties(additionalProperties: Map) = apply {
- this.additionalProperties.clear()
- putAllAdditionalProperties(additionalProperties)
- }
-
- fun putAdditionalProperty(key: String, value: JsonValue) = apply {
- additionalProperties.put(key, value)
- }
-
- fun putAllAdditionalProperties(additionalProperties: Map) = apply {
- this.additionalProperties.putAll(additionalProperties)
- }
-
- fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) }
-
- fun removeAllAdditionalProperties(keys: Set) = apply {
- keys.forEach(::removeAdditionalProperty)
- }
-
- /**
- * Returns an immutable instance of [FilePart].
- *
- * Further updates to this [Builder] will not mutate the returned instance.
- *
- * The following fields are required:
- * ```java
- * .id()
- * .mimeType()
- * .name()
- * .uploadUrl()
- * ```
- *
- * @throws IllegalStateException if any required field is unset.
- */
- fun build(): FilePart =
- FilePart(
- checkRequired("id", id),
- checkRequired("mimeType", mimeType),
- checkRequired("name", name),
- type,
- checkRequired("uploadUrl", uploadUrl),
- additionalProperties.toMutableMap(),
- )
- }
-
- private var validated: Boolean = false
-
- fun validate(): FilePart = apply {
- if (validated) {
- return@apply
- }
-
- id()
- mimeType()
- name()
- _type().let {
- if (it != JsonValue.from("file")) {
- throw OpenAIInvalidDataException("'type' is invalid, received $it")
- }
- }
- uploadUrl()
- validated = true
- }
-
- fun isValid(): Boolean =
- try {
- validate()
- true
- } catch (e: OpenAIInvalidDataException) {
- false
- }
-
- /**
- * Returns a score indicating how many valid values are contained in this object recursively.
- *
- * Used for best match union deserialization.
- */
- @JvmSynthetic
- internal fun validity(): Int =
- (if (id.asKnown().isPresent) 1 else 0) +
- (if (mimeType.asKnown().isPresent) 1 else 0) +
- (if (name.asKnown().isPresent) 1 else 0) +
- type.let { if (it == JsonValue.from("file")) 1 else 0 } +
- (if (uploadUrl.asKnown().isPresent) 1 else 0)
-
- override fun equals(other: Any?): Boolean {
- if (this === other) {
- return true
- }
-
- return other is FilePart &&
- id == other.id &&
- mimeType == other.mimeType &&
- name == other.name &&
- type == other.type &&
- uploadUrl == other.uploadUrl &&
- additionalProperties == other.additionalProperties
- }
-
- private val hashCode: Int by lazy {
- Objects.hash(id, mimeType, name, type, uploadUrl, additionalProperties)
- }
-
- override fun hashCode(): Int = hashCode
-
- override fun toString() =
- "FilePart{id=$id, mimeType=$mimeType, name=$name, type=$type, uploadUrl=$uploadUrl, additionalProperties=$additionalProperties}"
-}
diff --git a/openai-java-core/src/main/kotlin/com/openai/models/beta/chatkit/ImagePart.kt b/openai-java-core/src/main/kotlin/com/openai/models/beta/chatkit/ImagePart.kt
deleted file mode 100644
index 148a7003..00000000
--- a/openai-java-core/src/main/kotlin/com/openai/models/beta/chatkit/ImagePart.kt
+++ /dev/null
@@ -1,377 +0,0 @@
-// File generated from our OpenAPI spec by Stainless.
-
-package com.openai.models.beta.chatkit
-
-import com.fasterxml.jackson.annotation.JsonAnyGetter
-import com.fasterxml.jackson.annotation.JsonAnySetter
-import com.fasterxml.jackson.annotation.JsonCreator
-import com.fasterxml.jackson.annotation.JsonProperty
-import com.openai.core.ExcludeMissing
-import com.openai.core.JsonField
-import com.openai.core.JsonMissing
-import com.openai.core.JsonValue
-import com.openai.core.checkRequired
-import com.openai.errors.OpenAIInvalidDataException
-import java.util.Collections
-import java.util.Objects
-import java.util.Optional
-import kotlin.jvm.optionals.getOrNull
-
-/** Metadata for an image uploaded through ChatKit. */
-class ImagePart
-@JsonCreator(mode = JsonCreator.Mode.DISABLED)
-private constructor(
- private val id: JsonField,
- private val mimeType: JsonField,
- private val name: JsonField,
- private val previewUrl: JsonField,
- private val type: JsonValue,
- private val uploadUrl: JsonField,
- private val additionalProperties: MutableMap,
-) {
-
- @JsonCreator
- private constructor(
- @JsonProperty("id") @ExcludeMissing id: JsonField = JsonMissing.of(),
- @JsonProperty("mime_type") @ExcludeMissing mimeType: JsonField = JsonMissing.of(),
- @JsonProperty("name") @ExcludeMissing name: JsonField = JsonMissing.of(),
- @JsonProperty("preview_url")
- @ExcludeMissing
- previewUrl: JsonField = JsonMissing.of(),
- @JsonProperty("type") @ExcludeMissing type: JsonValue = JsonMissing.of(),
- @JsonProperty("upload_url") @ExcludeMissing uploadUrl: JsonField = JsonMissing.of(),
- ) : this(id, mimeType, name, previewUrl, type, uploadUrl, mutableMapOf())
-
- /**
- * Unique identifier for the uploaded image.
- *
- * @throws OpenAIInvalidDataException if the JSON field has an unexpected type or is
- * unexpectedly missing or null (e.g. if the server responded with an unexpected value).
- */
- fun id(): String = id.getRequired("id")
-
- /**
- * MIME type of the uploaded image.
- *
- * @throws OpenAIInvalidDataException if the JSON field has an unexpected type or is
- * unexpectedly missing or null (e.g. if the server responded with an unexpected value).
- */
- fun mimeType(): String = mimeType.getRequired("mime_type")
-
- /**
- * Original filename for the uploaded image. Defaults to null when unnamed.
- *
- * @throws OpenAIInvalidDataException if the JSON field has an unexpected type (e.g. if the
- * server responded with an unexpected value).
- */
- fun name(): Optional = name.getOptional("name")
-
- /**
- * Preview URL that can be rendered inline for the image.
- *
- * @throws OpenAIInvalidDataException if the JSON field has an unexpected type or is
- * unexpectedly missing or null (e.g. if the server responded with an unexpected value).
- */
- fun previewUrl(): String = previewUrl.getRequired("preview_url")
-
- /**
- * Type discriminator that is always `image`.
- *
- * Expected to always return the following:
- * ```java
- * JsonValue.from("image")
- * ```
- *
- * However, this method can be useful for debugging and logging (e.g. if the server responded
- * with an unexpected value).
- */
- @JsonProperty("type") @ExcludeMissing fun _type(): JsonValue = type
-
- /**
- * Signed URL for downloading the uploaded image. Defaults to null when no download link is
- * available.
- *
- * @throws OpenAIInvalidDataException if the JSON field has an unexpected type (e.g. if the
- * server responded with an unexpected value).
- */
- fun uploadUrl(): Optional = uploadUrl.getOptional("upload_url")
-
- /**
- * Returns the raw JSON value of [id].
- *
- * Unlike [id], this method doesn't throw if the JSON field has an unexpected type.
- */
- @JsonProperty("id") @ExcludeMissing fun _id(): JsonField = id
-
- /**
- * Returns the raw JSON value of [mimeType].
- *
- * Unlike [mimeType], this method doesn't throw if the JSON field has an unexpected type.
- */
- @JsonProperty("mime_type") @ExcludeMissing fun _mimeType(): JsonField = mimeType
-
- /**
- * Returns the raw JSON value of [name].
- *
- * Unlike [name], this method doesn't throw if the JSON field has an unexpected type.
- */
- @JsonProperty("name") @ExcludeMissing fun _name(): JsonField = name
-
- /**
- * Returns the raw JSON value of [previewUrl].
- *
- * Unlike [previewUrl], this method doesn't throw if the JSON field has an unexpected type.
- */
- @JsonProperty("preview_url") @ExcludeMissing fun _previewUrl(): JsonField = previewUrl
-
- /**
- * Returns the raw JSON value of [uploadUrl].
- *
- * Unlike [uploadUrl], this method doesn't throw if the JSON field has an unexpected type.
- */
- @JsonProperty("upload_url") @ExcludeMissing fun _uploadUrl(): JsonField = uploadUrl
-
- @JsonAnySetter
- private fun putAdditionalProperty(key: String, value: JsonValue) {
- additionalProperties.put(key, value)
- }
-
- @JsonAnyGetter
- @ExcludeMissing
- fun _additionalProperties(): Map =
- Collections.unmodifiableMap(additionalProperties)
-
- fun toBuilder() = Builder().from(this)
-
- companion object {
-
- /**
- * Returns a mutable builder for constructing an instance of [ImagePart].
- *
- * The following fields are required:
- * ```java
- * .id()
- * .mimeType()
- * .name()
- * .previewUrl()
- * .uploadUrl()
- * ```
- */
- @JvmStatic fun builder() = Builder()
- }
-
- /** A builder for [ImagePart]. */
- class Builder internal constructor() {
-
- private var id: JsonField? = null
- private var mimeType: JsonField? = null
- private var name: JsonField? = null
- private var previewUrl: JsonField? = null
- private var type: JsonValue = JsonValue.from("image")
- private var uploadUrl: JsonField? = null
- private var additionalProperties: MutableMap = mutableMapOf()
-
- @JvmSynthetic
- internal fun from(imagePart: ImagePart) = apply {
- id = imagePart.id
- mimeType = imagePart.mimeType
- name = imagePart.name
- previewUrl = imagePart.previewUrl
- type = imagePart.type
- uploadUrl = imagePart.uploadUrl
- additionalProperties = imagePart.additionalProperties.toMutableMap()
- }
-
- /** Unique identifier for the uploaded image. */
- fun id(id: String) = id(JsonField.of(id))
-
- /**
- * Sets [Builder.id] to an arbitrary JSON value.
- *
- * You should usually call [Builder.id] with a well-typed [String] value instead. This
- * method is primarily for setting the field to an undocumented or not yet supported value.
- */
- fun id(id: JsonField) = apply { this.id = id }
-
- /** MIME type of the uploaded image. */
- fun mimeType(mimeType: String) = mimeType(JsonField.of(mimeType))
-
- /**
- * Sets [Builder.mimeType] to an arbitrary JSON value.
- *
- * You should usually call [Builder.mimeType] with a well-typed [String] value instead. This
- * method is primarily for setting the field to an undocumented or not yet supported value.
- */
- fun mimeType(mimeType: JsonField) = apply { this.mimeType = mimeType }
-
- /** Original filename for the uploaded image. Defaults to null when unnamed. */
- fun name(name: String?) = name(JsonField.ofNullable(name))
-
- /** Alias for calling [Builder.name] with `name.orElse(null)`. */
- fun name(name: Optional) = name(name.getOrNull())
-
- /**
- * Sets [Builder.name] to an arbitrary JSON value.
- *
- * You should usually call [Builder.name] with a well-typed [String] value instead. This
- * method is primarily for setting the field to an undocumented or not yet supported value.
- */
- fun name(name: JsonField) = apply { this.name = name }
-
- /** Preview URL that can be rendered inline for the image. */
- fun previewUrl(previewUrl: String) = previewUrl(JsonField.of(previewUrl))
-
- /**
- * Sets [Builder.previewUrl] to an arbitrary JSON value.
- *
- * You should usually call [Builder.previewUrl] with a well-typed [String] value instead.
- * This method is primarily for setting the field to an undocumented or not yet supported
- * value.
- */
- fun previewUrl(previewUrl: JsonField) = apply { this.previewUrl = previewUrl }
-
- /**
- * Sets the field to an arbitrary JSON value.
- *
- * It is usually unnecessary to call this method because the field defaults to the
- * following:
- * ```java
- * JsonValue.from("image")
- * ```
- *
- * This method is primarily for setting the field to an undocumented or not yet supported
- * value.
- */
- fun type(type: JsonValue) = apply { this.type = type }
-
- /**
- * Signed URL for downloading the uploaded image. Defaults to null when no download link is
- * available.
- */
- fun uploadUrl(uploadUrl: String?) = uploadUrl(JsonField.ofNullable(uploadUrl))
-
- /** Alias for calling [Builder.uploadUrl] with `uploadUrl.orElse(null)`. */
- fun uploadUrl(uploadUrl: Optional) = uploadUrl(uploadUrl.getOrNull())
-
- /**
- * Sets [Builder.uploadUrl] to an arbitrary JSON value.
- *
- * You should usually call [Builder.uploadUrl] with a well-typed [String] value instead.
- * This method is primarily for setting the field to an undocumented or not yet supported
- * value.
- */
- fun uploadUrl(uploadUrl: JsonField) = apply { this.uploadUrl = uploadUrl }
-
- fun additionalProperties(additionalProperties: Map) = apply {
- this.additionalProperties.clear()
- putAllAdditionalProperties(additionalProperties)
- }
-
- fun putAdditionalProperty(key: String, value: JsonValue) = apply {
- additionalProperties.put(key, value)
- }
-
- fun putAllAdditionalProperties(additionalProperties: Map) = apply {
- this.additionalProperties.putAll(additionalProperties)
- }
-
- fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) }
-
- fun removeAllAdditionalProperties(keys: Set) = apply {
- keys.forEach(::removeAdditionalProperty)
- }
-
- /**
- * Returns an immutable instance of [ImagePart].
- *
- * Further updates to this [Builder] will not mutate the returned instance.
- *
- * The following fields are required:
- * ```java
- * .id()
- * .mimeType()
- * .name()
- * .previewUrl()
- * .uploadUrl()
- * ```
- *
- * @throws IllegalStateException if any required field is unset.
- */
- fun build(): ImagePart =
- ImagePart(
- checkRequired("id", id),
- checkRequired("mimeType", mimeType),
- checkRequired("name", name),
- checkRequired("previewUrl", previewUrl),
- type,
- checkRequired("uploadUrl", uploadUrl),
- additionalProperties.toMutableMap(),
- )
- }
-
- private var validated: Boolean = false
-
- fun validate(): ImagePart = apply {
- if (validated) {
- return@apply
- }
-
- id()
- mimeType()
- name()
- previewUrl()
- _type().let {
- if (it != JsonValue.from("image")) {
- throw OpenAIInvalidDataException("'type' is invalid, received $it")
- }
- }
- uploadUrl()
- validated = true
- }
-
- fun isValid(): Boolean =
- try {
- validate()
- true
- } catch (e: OpenAIInvalidDataException) {
- false
- }
-
- /**
- * Returns a score indicating how many valid values are contained in this object recursively.
- *
- * Used for best match union deserialization.
- */
- @JvmSynthetic
- internal fun validity(): Int =
- (if (id.asKnown().isPresent) 1 else 0) +
- (if (mimeType.asKnown().isPresent) 1 else 0) +
- (if (name.asKnown().isPresent) 1 else 0) +
- (if (previewUrl.asKnown().isPresent) 1 else 0) +
- type.let { if (it == JsonValue.from("image")) 1 else 0 } +
- (if (uploadUrl.asKnown().isPresent) 1 else 0)
-
- override fun equals(other: Any?): Boolean {
- if (this === other) {
- return true
- }
-
- return other is ImagePart &&
- id == other.id &&
- mimeType == other.mimeType &&
- name == other.name &&
- previewUrl == other.previewUrl &&
- type == other.type &&
- uploadUrl == other.uploadUrl &&
- additionalProperties == other.additionalProperties
- }
-
- private val hashCode: Int by lazy {
- Objects.hash(id, mimeType, name, previewUrl, type, uploadUrl, additionalProperties)
- }
-
- override fun hashCode(): Int = hashCode
-
- override fun toString() =
- "ImagePart{id=$id, mimeType=$mimeType, name=$name, previewUrl=$previewUrl, type=$type, uploadUrl=$uploadUrl, additionalProperties=$additionalProperties}"
-}
diff --git a/openai-java-core/src/main/kotlin/com/openai/services/async/beta/ChatKitServiceAsync.kt b/openai-java-core/src/main/kotlin/com/openai/services/async/beta/ChatKitServiceAsync.kt
index 2ac145d6..f2fd48c6 100644
--- a/openai-java-core/src/main/kotlin/com/openai/services/async/beta/ChatKitServiceAsync.kt
+++ b/openai-java-core/src/main/kotlin/com/openai/services/async/beta/ChatKitServiceAsync.kt
@@ -3,13 +3,8 @@
package com.openai.services.async.beta
import com.openai.core.ClientOptions
-import com.openai.core.RequestOptions
-import com.openai.core.http.HttpResponseFor
-import com.openai.models.beta.chatkit.ChatKitUploadFileParams
-import com.openai.models.beta.chatkit.ChatKitUploadFileResponse
import com.openai.services.async.beta.chatkit.SessionServiceAsync
import com.openai.services.async.beta.chatkit.ThreadServiceAsync
-import java.util.concurrent.CompletableFuture
import java.util.function.Consumer
interface ChatKitServiceAsync {
@@ -30,16 +25,6 @@ interface ChatKitServiceAsync {
fun threads(): ThreadServiceAsync
- /** Upload a ChatKit file */
- fun uploadFile(params: ChatKitUploadFileParams): CompletableFuture =
- uploadFile(params, RequestOptions.none())
-
- /** @see uploadFile */
- fun uploadFile(
- params: ChatKitUploadFileParams,
- requestOptions: RequestOptions = RequestOptions.none(),
- ): CompletableFuture
-
/**
* A view of [ChatKitServiceAsync] that provides access to raw HTTP responses for each method.
*/
@@ -57,20 +42,5 @@ interface ChatKitServiceAsync {
fun sessions(): SessionServiceAsync.WithRawResponse
fun threads(): ThreadServiceAsync.WithRawResponse
-
- /**
- * Returns a raw HTTP response for `post /chatkit/files`, but is otherwise the same as
- * [ChatKitServiceAsync.uploadFile].
- */
- fun uploadFile(
- params: ChatKitUploadFileParams
- ): CompletableFuture> =
- uploadFile(params, RequestOptions.none())
-
- /** @see uploadFile */
- fun uploadFile(
- params: ChatKitUploadFileParams,
- requestOptions: RequestOptions = RequestOptions.none(),
- ): CompletableFuture>
}
}
diff --git a/openai-java-core/src/main/kotlin/com/openai/services/async/beta/ChatKitServiceAsyncImpl.kt b/openai-java-core/src/main/kotlin/com/openai/services/async/beta/ChatKitServiceAsyncImpl.kt
index 00192dae..df50de0d 100644
--- a/openai-java-core/src/main/kotlin/com/openai/services/async/beta/ChatKitServiceAsyncImpl.kt
+++ b/openai-java-core/src/main/kotlin/com/openai/services/async/beta/ChatKitServiceAsyncImpl.kt
@@ -3,37 +3,15 @@
package com.openai.services.async.beta
import com.openai.core.ClientOptions
-import com.openai.core.RequestOptions
-import com.openai.core.handlers.errorBodyHandler
-import com.openai.core.handlers.errorHandler
-import com.openai.core.handlers.jsonHandler
-import com.openai.core.http.Headers
-import com.openai.core.http.HttpMethod
-import com.openai.core.http.HttpRequest
-import com.openai.core.http.HttpResponse
-import com.openai.core.http.HttpResponse.Handler
-import com.openai.core.http.HttpResponseFor
-import com.openai.core.http.multipartFormData
-import com.openai.core.http.parseable
-import com.openai.core.prepareAsync
-import com.openai.models.beta.chatkit.ChatKitUploadFileParams
-import com.openai.models.beta.chatkit.ChatKitUploadFileResponse
import com.openai.services.async.beta.chatkit.SessionServiceAsync
import com.openai.services.async.beta.chatkit.SessionServiceAsyncImpl
import com.openai.services.async.beta.chatkit.ThreadServiceAsync
import com.openai.services.async.beta.chatkit.ThreadServiceAsyncImpl
-import java.util.concurrent.CompletableFuture
import java.util.function.Consumer
class ChatKitServiceAsyncImpl internal constructor(private val clientOptions: ClientOptions) :
ChatKitServiceAsync {
- companion object {
-
- private val DEFAULT_HEADERS =
- Headers.builder().put("OpenAI-Beta", "chatkit_beta=v1").build()
- }
-
private val withRawResponse: ChatKitServiceAsync.WithRawResponse by lazy {
WithRawResponseImpl(clientOptions)
}
@@ -51,19 +29,9 @@ class ChatKitServiceAsyncImpl internal constructor(private val clientOptions: Cl
override fun threads(): ThreadServiceAsync = threads
- override fun uploadFile(
- params: ChatKitUploadFileParams,
- requestOptions: RequestOptions,
- ): CompletableFuture =
- // post /chatkit/files
- withRawResponse().uploadFile(params, requestOptions).thenApply { it.parse() }
-
class WithRawResponseImpl internal constructor(private val clientOptions: ClientOptions) :
ChatKitServiceAsync.WithRawResponse {
- private val errorHandler: Handler =
- errorHandler(errorBodyHandler(clientOptions.jsonMapper))
-
private val sessions: SessionServiceAsync.WithRawResponse by lazy {
SessionServiceAsyncImpl.WithRawResponseImpl(clientOptions)
}
@@ -82,37 +50,5 @@ class ChatKitServiceAsyncImpl internal constructor(private val clientOptions: Cl
override fun sessions(): SessionServiceAsync.WithRawResponse = sessions
override fun threads(): ThreadServiceAsync.WithRawResponse = threads
-
- private val uploadFileHandler: Handler =
- jsonHandler(clientOptions.jsonMapper)
-
- override fun uploadFile(
- params: ChatKitUploadFileParams,
- requestOptions: RequestOptions,
- ): CompletableFuture> {
- val request =
- HttpRequest.builder()
- .method(HttpMethod.POST)
- .baseUrl(clientOptions.baseUrl())
- .addPathSegments("chatkit", "files")
- .putAllHeaders(DEFAULT_HEADERS)
- .body(multipartFormData(clientOptions.jsonMapper, params._body()))
- .build()
- .prepareAsync(clientOptions, params)
- val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions))
- return request
- .thenComposeAsync { clientOptions.httpClient.executeAsync(it, requestOptions) }
- .thenApply { response ->
- errorHandler.handle(response).parseable {
- response
- .use { uploadFileHandler.handle(it) }
- .also {
- if (requestOptions.responseValidation!!) {
- it.validate()
- }
- }
- }
- }
- }
}
}
diff --git a/openai-java-core/src/main/kotlin/com/openai/services/blocking/beta/ChatKitService.kt b/openai-java-core/src/main/kotlin/com/openai/services/blocking/beta/ChatKitService.kt
index b5a2230b..358f3d12 100644
--- a/openai-java-core/src/main/kotlin/com/openai/services/blocking/beta/ChatKitService.kt
+++ b/openai-java-core/src/main/kotlin/com/openai/services/blocking/beta/ChatKitService.kt
@@ -2,12 +2,7 @@
package com.openai.services.blocking.beta
-import com.google.errorprone.annotations.MustBeClosed
import com.openai.core.ClientOptions
-import com.openai.core.RequestOptions
-import com.openai.core.http.HttpResponseFor
-import com.openai.models.beta.chatkit.ChatKitUploadFileParams
-import com.openai.models.beta.chatkit.ChatKitUploadFileResponse
import com.openai.services.blocking.beta.chatkit.SessionService
import com.openai.services.blocking.beta.chatkit.ThreadService
import java.util.function.Consumer
@@ -30,16 +25,6 @@ interface ChatKitService {
fun threads(): ThreadService
- /** Upload a ChatKit file */
- fun uploadFile(params: ChatKitUploadFileParams): ChatKitUploadFileResponse =
- uploadFile(params, RequestOptions.none())
-
- /** @see uploadFile */
- fun uploadFile(
- params: ChatKitUploadFileParams,
- requestOptions: RequestOptions = RequestOptions.none(),
- ): ChatKitUploadFileResponse
-
/** A view of [ChatKitService] that provides access to raw HTTP responses for each method. */
interface WithRawResponse {
@@ -53,21 +38,5 @@ interface ChatKitService {
fun sessions(): SessionService.WithRawResponse
fun threads(): ThreadService.WithRawResponse
-
- /**
- * Returns a raw HTTP response for `post /chatkit/files`, but is otherwise the same as
- * [ChatKitService.uploadFile].
- */
- @MustBeClosed
- fun uploadFile(
- params: ChatKitUploadFileParams
- ): HttpResponseFor = uploadFile(params, RequestOptions.none())
-
- /** @see uploadFile */
- @MustBeClosed
- fun uploadFile(
- params: ChatKitUploadFileParams,
- requestOptions: RequestOptions = RequestOptions.none(),
- ): HttpResponseFor
}
}
diff --git a/openai-java-core/src/main/kotlin/com/openai/services/blocking/beta/ChatKitServiceImpl.kt b/openai-java-core/src/main/kotlin/com/openai/services/blocking/beta/ChatKitServiceImpl.kt
index 9d764c75..f75f45a0 100644
--- a/openai-java-core/src/main/kotlin/com/openai/services/blocking/beta/ChatKitServiceImpl.kt
+++ b/openai-java-core/src/main/kotlin/com/openai/services/blocking/beta/ChatKitServiceImpl.kt
@@ -3,21 +3,6 @@
package com.openai.services.blocking.beta
import com.openai.core.ClientOptions
-import com.openai.core.RequestOptions
-import com.openai.core.handlers.errorBodyHandler
-import com.openai.core.handlers.errorHandler
-import com.openai.core.handlers.jsonHandler
-import com.openai.core.http.Headers
-import com.openai.core.http.HttpMethod
-import com.openai.core.http.HttpRequest
-import com.openai.core.http.HttpResponse
-import com.openai.core.http.HttpResponse.Handler
-import com.openai.core.http.HttpResponseFor
-import com.openai.core.http.multipartFormData
-import com.openai.core.http.parseable
-import com.openai.core.prepare
-import com.openai.models.beta.chatkit.ChatKitUploadFileParams
-import com.openai.models.beta.chatkit.ChatKitUploadFileResponse
import com.openai.services.blocking.beta.chatkit.SessionService
import com.openai.services.blocking.beta.chatkit.SessionServiceImpl
import com.openai.services.blocking.beta.chatkit.ThreadService
@@ -27,12 +12,6 @@ import java.util.function.Consumer
class ChatKitServiceImpl internal constructor(private val clientOptions: ClientOptions) :
ChatKitService {
- companion object {
-
- private val DEFAULT_HEADERS =
- Headers.builder().put("OpenAI-Beta", "chatkit_beta=v1").build()
- }
-
private val withRawResponse: ChatKitService.WithRawResponse by lazy {
WithRawResponseImpl(clientOptions)
}
@@ -50,19 +29,9 @@ class ChatKitServiceImpl internal constructor(private val clientOptions: ClientO
override fun threads(): ThreadService = threads
- override fun uploadFile(
- params: ChatKitUploadFileParams,
- requestOptions: RequestOptions,
- ): ChatKitUploadFileResponse =
- // post /chatkit/files
- withRawResponse().uploadFile(params, requestOptions).parse()
-
class WithRawResponseImpl internal constructor(private val clientOptions: ClientOptions) :
ChatKitService.WithRawResponse {
- private val errorHandler: Handler =
- errorHandler(errorBodyHandler(clientOptions.jsonMapper))
-
private val sessions: SessionService.WithRawResponse by lazy {
SessionServiceImpl.WithRawResponseImpl(clientOptions)
}
@@ -81,34 +50,5 @@ class ChatKitServiceImpl internal constructor(private val clientOptions: ClientO
override fun sessions(): SessionService.WithRawResponse = sessions
override fun threads(): ThreadService.WithRawResponse = threads
-
- private val uploadFileHandler: Handler =
- jsonHandler(clientOptions.jsonMapper)
-
- override fun uploadFile(
- params: ChatKitUploadFileParams,
- requestOptions: RequestOptions,
- ): HttpResponseFor {
- val request =
- HttpRequest.builder()
- .method(HttpMethod.POST)
- .baseUrl(clientOptions.baseUrl())
- .addPathSegments("chatkit", "files")
- .putAllHeaders(DEFAULT_HEADERS)
- .body(multipartFormData(clientOptions.jsonMapper, params._body()))
- .build()
- .prepare(clientOptions, params)
- val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions))
- val response = clientOptions.httpClient.execute(request, requestOptions)
- return errorHandler.handle(response).parseable {
- response
- .use { uploadFileHandler.handle(it) }
- .also {
- if (requestOptions.responseValidation!!) {
- it.validate()
- }
- }
- }
- }
}
}
diff --git a/openai-java-core/src/test/kotlin/com/openai/models/beta/chatkit/ChatKitUploadFileParamsTest.kt b/openai-java-core/src/test/kotlin/com/openai/models/beta/chatkit/ChatKitUploadFileParamsTest.kt
deleted file mode 100644
index 9b76c771..00000000
--- a/openai-java-core/src/test/kotlin/com/openai/models/beta/chatkit/ChatKitUploadFileParamsTest.kt
+++ /dev/null
@@ -1,39 +0,0 @@
-// File generated from our OpenAPI spec by Stainless.
-
-package com.openai.models.beta.chatkit
-
-import com.openai.core.MultipartField
-import java.io.InputStream
-import org.assertj.core.api.Assertions.assertThat
-import org.junit.jupiter.api.Test
-
-internal class ChatKitUploadFileParamsTest {
-
- @Test
- fun create() {
- ChatKitUploadFileParams.builder().file("some content".byteInputStream()).build()
- }
-
- @Test
- fun body() {
- val params =
- ChatKitUploadFileParams.builder().file("some content".byteInputStream()).build()
-
- val body = params._body()
-
- assertThat(body.filterValues { !it.value.isNull() })
- .usingRecursiveComparison()
- // TODO(AssertJ): Replace this and the `mapValues` below with:
- // https://github.com/assertj/assertj/issues/3165
- .withEqualsForType(
- { a, b -> a.readBytes() contentEquals b.readBytes() },
- InputStream::class.java,
- )
- .isEqualTo(
- mapOf("file" to MultipartField.of("some content".byteInputStream())).mapValues {
- (_, field) ->
- field.map { (it as? ByteArray)?.inputStream() ?: it }
- }
- )
- }
-}
diff --git a/openai-java-core/src/test/kotlin/com/openai/models/beta/chatkit/ChatKitUploadFileResponseTest.kt b/openai-java-core/src/test/kotlin/com/openai/models/beta/chatkit/ChatKitUploadFileResponseTest.kt
deleted file mode 100644
index 9e5b1f83..00000000
--- a/openai-java-core/src/test/kotlin/com/openai/models/beta/chatkit/ChatKitUploadFileResponseTest.kt
+++ /dev/null
@@ -1,112 +0,0 @@
-// File generated from our OpenAPI spec by Stainless.
-
-package com.openai.models.beta.chatkit
-
-import com.fasterxml.jackson.module.kotlin.jacksonTypeRef
-import com.openai.core.JsonValue
-import com.openai.core.jsonMapper
-import com.openai.errors.OpenAIInvalidDataException
-import org.assertj.core.api.Assertions.assertThat
-import org.junit.jupiter.api.Test
-import org.junit.jupiter.api.assertThrows
-import org.junit.jupiter.params.ParameterizedTest
-import org.junit.jupiter.params.provider.EnumSource
-
-internal class ChatKitUploadFileResponseTest {
-
- @Test
- fun ofFile() {
- val file =
- FilePart.builder()
- .id("id")
- .mimeType("mime_type")
- .name("name")
- .uploadUrl("upload_url")
- .build()
-
- val chatkitUploadFileResponse = ChatKitUploadFileResponse.ofFile(file)
-
- assertThat(chatkitUploadFileResponse.file()).contains(file)
- assertThat(chatkitUploadFileResponse.image()).isEmpty
- }
-
- @Test
- fun ofFileRoundtrip() {
- val jsonMapper = jsonMapper()
- val chatkitUploadFileResponse =
- ChatKitUploadFileResponse.ofFile(
- FilePart.builder()
- .id("id")
- .mimeType("mime_type")
- .name("name")
- .uploadUrl("upload_url")
- .build()
- )
-
- val roundtrippedChatKitUploadFileResponse =
- jsonMapper.readValue(
- jsonMapper.writeValueAsString(chatkitUploadFileResponse),
- jacksonTypeRef(),
- )
-
- assertThat(roundtrippedChatKitUploadFileResponse).isEqualTo(chatkitUploadFileResponse)
- }
-
- @Test
- fun ofImage() {
- val image =
- ImagePart.builder()
- .id("id")
- .mimeType("mime_type")
- .name("name")
- .previewUrl("preview_url")
- .uploadUrl("upload_url")
- .build()
-
- val chatkitUploadFileResponse = ChatKitUploadFileResponse.ofImage(image)
-
- assertThat(chatkitUploadFileResponse.file()).isEmpty
- assertThat(chatkitUploadFileResponse.image()).contains(image)
- }
-
- @Test
- fun ofImageRoundtrip() {
- val jsonMapper = jsonMapper()
- val chatkitUploadFileResponse =
- ChatKitUploadFileResponse.ofImage(
- ImagePart.builder()
- .id("id")
- .mimeType("mime_type")
- .name("name")
- .previewUrl("preview_url")
- .uploadUrl("upload_url")
- .build()
- )
-
- val roundtrippedChatKitUploadFileResponse =
- jsonMapper.readValue(
- jsonMapper.writeValueAsString(chatkitUploadFileResponse),
- jacksonTypeRef(),
- )
-
- assertThat(roundtrippedChatKitUploadFileResponse).isEqualTo(chatkitUploadFileResponse)
- }
-
- enum class IncompatibleJsonShapeTestCase(val value: JsonValue) {
- BOOLEAN(JsonValue.from(false)),
- STRING(JsonValue.from("invalid")),
- INTEGER(JsonValue.from(-1)),
- FLOAT(JsonValue.from(3.14)),
- ARRAY(JsonValue.from(listOf("invalid", "array"))),
- }
-
- @ParameterizedTest
- @EnumSource
- fun incompatibleJsonShapeDeserializesToUnknown(testCase: IncompatibleJsonShapeTestCase) {
- val chatkitUploadFileResponse =
- jsonMapper().convertValue(testCase.value, jacksonTypeRef())
-
- val e = assertThrows { chatkitUploadFileResponse.validate() }
- assertThat(e).hasMessageStartingWith("Unknown ")
- }
-}
diff --git a/openai-java-core/src/test/kotlin/com/openai/models/beta/chatkit/FilePartTest.kt b/openai-java-core/src/test/kotlin/com/openai/models/beta/chatkit/FilePartTest.kt
deleted file mode 100644
index 16ae1cb2..00000000
--- a/openai-java-core/src/test/kotlin/com/openai/models/beta/chatkit/FilePartTest.kt
+++ /dev/null
@@ -1,47 +0,0 @@
-// File generated from our OpenAPI spec by Stainless.
-
-package com.openai.models.beta.chatkit
-
-import com.fasterxml.jackson.module.kotlin.jacksonTypeRef
-import com.openai.core.jsonMapper
-import org.assertj.core.api.Assertions.assertThat
-import org.junit.jupiter.api.Test
-
-internal class FilePartTest {
-
- @Test
- fun create() {
- val filePart =
- FilePart.builder()
- .id("id")
- .mimeType("mime_type")
- .name("name")
- .uploadUrl("upload_url")
- .build()
-
- assertThat(filePart.id()).isEqualTo("id")
- assertThat(filePart.mimeType()).contains("mime_type")
- assertThat(filePart.name()).contains("name")
- assertThat(filePart.uploadUrl()).contains("upload_url")
- }
-
- @Test
- fun roundtrip() {
- val jsonMapper = jsonMapper()
- val filePart =
- FilePart.builder()
- .id("id")
- .mimeType("mime_type")
- .name("name")
- .uploadUrl("upload_url")
- .build()
-
- val roundtrippedFilePart =
- jsonMapper.readValue(
- jsonMapper.writeValueAsString(filePart),
- jacksonTypeRef(),
- )
-
- assertThat(roundtrippedFilePart).isEqualTo(filePart)
- }
-}
diff --git a/openai-java-core/src/test/kotlin/com/openai/models/beta/chatkit/ImagePartTest.kt b/openai-java-core/src/test/kotlin/com/openai/models/beta/chatkit/ImagePartTest.kt
deleted file mode 100644
index 59015b22..00000000
--- a/openai-java-core/src/test/kotlin/com/openai/models/beta/chatkit/ImagePartTest.kt
+++ /dev/null
@@ -1,50 +0,0 @@
-// File generated from our OpenAPI spec by Stainless.
-
-package com.openai.models.beta.chatkit
-
-import com.fasterxml.jackson.module.kotlin.jacksonTypeRef
-import com.openai.core.jsonMapper
-import org.assertj.core.api.Assertions.assertThat
-import org.junit.jupiter.api.Test
-
-internal class ImagePartTest {
-
- @Test
- fun create() {
- val imagePart =
- ImagePart.builder()
- .id("id")
- .mimeType("mime_type")
- .name("name")
- .previewUrl("preview_url")
- .uploadUrl("upload_url")
- .build()
-
- assertThat(imagePart.id()).isEqualTo("id")
- assertThat(imagePart.mimeType()).isEqualTo("mime_type")
- assertThat(imagePart.name()).contains("name")
- assertThat(imagePart.previewUrl()).isEqualTo("preview_url")
- assertThat(imagePart.uploadUrl()).contains("upload_url")
- }
-
- @Test
- fun roundtrip() {
- val jsonMapper = jsonMapper()
- val imagePart =
- ImagePart.builder()
- .id("id")
- .mimeType("mime_type")
- .name("name")
- .previewUrl("preview_url")
- .uploadUrl("upload_url")
- .build()
-
- val roundtrippedImagePart =
- jsonMapper.readValue(
- jsonMapper.writeValueAsString(imagePart),
- jacksonTypeRef(),
- )
-
- assertThat(roundtrippedImagePart).isEqualTo(imagePart)
- }
-}
diff --git a/openai-java-core/src/test/kotlin/com/openai/services/async/beta/ChatKitServiceAsyncTest.kt b/openai-java-core/src/test/kotlin/com/openai/services/async/beta/ChatKitServiceAsyncTest.kt
deleted file mode 100644
index c0d46b7b..00000000
--- a/openai-java-core/src/test/kotlin/com/openai/services/async/beta/ChatKitServiceAsyncTest.kt
+++ /dev/null
@@ -1,31 +0,0 @@
-// File generated from our OpenAPI spec by Stainless.
-
-package com.openai.services.async.beta
-
-import com.openai.TestServerExtension
-import com.openai.client.okhttp.OpenAIOkHttpClientAsync
-import com.openai.models.beta.chatkit.ChatKitUploadFileParams
-import org.junit.jupiter.api.Test
-import org.junit.jupiter.api.extension.ExtendWith
-
-@ExtendWith(TestServerExtension::class)
-internal class ChatKitServiceAsyncTest {
-
- @Test
- fun uploadFile() {
- val client =
- OpenAIOkHttpClientAsync.builder()
- .baseUrl(TestServerExtension.BASE_URL)
- .apiKey("My API Key")
- .build()
- val chatkitServiceAsync = client.beta().chatkit()
-
- val responseFuture =
- chatkitServiceAsync.uploadFile(
- ChatKitUploadFileParams.builder().file("some content".byteInputStream()).build()
- )
-
- val response = responseFuture.get()
- response.validate()
- }
-}
diff --git a/openai-java-core/src/test/kotlin/com/openai/services/blocking/beta/ChatKitServiceTest.kt b/openai-java-core/src/test/kotlin/com/openai/services/blocking/beta/ChatKitServiceTest.kt
deleted file mode 100644
index 1cd044b5..00000000
--- a/openai-java-core/src/test/kotlin/com/openai/services/blocking/beta/ChatKitServiceTest.kt
+++ /dev/null
@@ -1,30 +0,0 @@
-// File generated from our OpenAPI spec by Stainless.
-
-package com.openai.services.blocking.beta
-
-import com.openai.TestServerExtension
-import com.openai.client.okhttp.OpenAIOkHttpClient
-import com.openai.models.beta.chatkit.ChatKitUploadFileParams
-import org.junit.jupiter.api.Test
-import org.junit.jupiter.api.extension.ExtendWith
-
-@ExtendWith(TestServerExtension::class)
-internal class ChatKitServiceTest {
-
- @Test
- fun uploadFile() {
- val client =
- OpenAIOkHttpClient.builder()
- .baseUrl(TestServerExtension.BASE_URL)
- .apiKey("My API Key")
- .build()
- val chatkitService = client.beta().chatkit()
-
- val response =
- chatkitService.uploadFile(
- ChatKitUploadFileParams.builder().file("some content".byteInputStream()).build()
- )
-
- response.validate()
- }
-}