diff --git a/.release-please-manifest.json b/.release-please-manifest.json index 7412044d8..88ca3ecec 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "0.7.2" + ".": "0.7.3" } \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index 4972ae32d..35c6690f6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,19 @@ # Changelog +## 0.7.3 (2024-12-11) + +Full Changelog: [v0.7.2...v0.7.3](https://github.com/openai/openai-java/compare/v0.7.2...v0.7.3) + +### Chores + +* **internal:** remove unused imports ([#38](https://github.com/openai/openai-java/issues/38)) ([021177f](https://github.com/openai/openai-java/commit/021177f995fb11e9a17ebf3950e0d46591e3c354)) + + +### Styles + +* **internal:** make enum value definitions less verbose ([#35](https://github.com/openai/openai-java/issues/35)) ([1effd49](https://github.com/openai/openai-java/commit/1effd49f5c1585c54e46454945df3fe2314ef05d)) +* **internal:** move enum identity methods to bottom of class ([#37](https://github.com/openai/openai-java/issues/37)) ([7a9d27a](https://github.com/openai/openai-java/commit/7a9d27a7ef5d59f78479e1af83a980eb52097fcc)) + ## 0.7.2 (2024-12-11) Full Changelog: [v0.7.1...v0.7.2](https://github.com/openai/openai-java/compare/v0.7.1...v0.7.2) diff --git a/README.md b/README.md index 4fc24412c..05ac5aa9f 100644 --- a/README.md +++ b/README.md @@ -7,7 +7,7 @@ -[![Maven Central](https://img.shields.io/maven-central/v/com.openai/openai-java)](https://central.sonatype.com/artifact/com.openai/openai-java/0.7.2) +[![Maven Central](https://img.shields.io/maven-central/v/com.openai/openai-java)](https://central.sonatype.com/artifact/com.openai/openai-java/0.7.3) @@ -30,7 +30,7 @@ The REST API documentation can be foundĀ on [platform.openai.com](https://platfo ```kotlin -implementation("com.openai:openai-java:0.7.2") +implementation("com.openai:openai-java:0.7.3") ``` #### Maven @@ -39,7 +39,7 @@ implementation("com.openai:openai-java:0.7.2") com.openai openai-java - 0.7.2 + 0.7.3 ``` diff --git a/build.gradle.kts b/build.gradle.kts index f91481cd9..5752be787 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -4,7 +4,7 @@ plugins { allprojects { group = "com.openai" - version = "0.7.2" // x-release-please-version + version = "0.7.3" // x-release-please-version } diff --git a/openai-java-core/src/main/kotlin/com/openai/models/Batch.kt b/openai-java-core/src/main/kotlin/com/openai/models/Batch.kt index 43c5f2bd4..c4d8a6d03 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/Batch.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/Batch.kt @@ -466,21 +466,9 @@ private constructor( @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is Object && value == other.value /* spotless:on */ - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - companion object { - @JvmField val BATCH = Object(JsonField.of("batch")) + @JvmField val BATCH = of("batch") @JvmStatic fun of(value: String) = Object(JsonField.of(value)) } @@ -507,45 +495,45 @@ private constructor( } fun asString(): String = _value().asStringOrThrow() - } - - class Status - @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { - - @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value override fun equals(other: Any?): Boolean { if (this === other) { return true } - return /* spotless:off */ other is Status && value == other.value /* spotless:on */ + return /* spotless:off */ other is Object && value == other.value /* spotless:on */ } override fun hashCode() = value.hashCode() override fun toString() = value.toString() + } + + class Status + @JsonCreator + private constructor( + private val value: JsonField, + ) : Enum { + + @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value companion object { - @JvmField val VALIDATING = Status(JsonField.of("validating")) + @JvmField val VALIDATING = of("validating") - @JvmField val FAILED = Status(JsonField.of("failed")) + @JvmField val FAILED = of("failed") - @JvmField val IN_PROGRESS = Status(JsonField.of("in_progress")) + @JvmField val IN_PROGRESS = of("in_progress") - @JvmField val FINALIZING = Status(JsonField.of("finalizing")) + @JvmField val FINALIZING = of("finalizing") - @JvmField val COMPLETED = Status(JsonField.of("completed")) + @JvmField val COMPLETED = of("completed") - @JvmField val EXPIRED = Status(JsonField.of("expired")) + @JvmField val EXPIRED = of("expired") - @JvmField val CANCELLING = Status(JsonField.of("cancelling")) + @JvmField val CANCELLING = of("cancelling") - @JvmField val CANCELLED = Status(JsonField.of("cancelled")) + @JvmField val CANCELLED = of("cancelled") @JvmStatic fun of(value: String) = Status(JsonField.of(value)) } @@ -600,6 +588,18 @@ private constructor( } fun asString(): String = _value().asStringOrThrow() + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return /* spotless:off */ other is Status && value == other.value /* spotless:on */ + } + + override fun hashCode() = value.hashCode() + + override fun toString() = value.toString() } @JsonDeserialize(builder = Errors.Builder::class) diff --git a/openai-java-core/src/main/kotlin/com/openai/models/BatchCreateParams.kt b/openai-java-core/src/main/kotlin/com/openai/models/BatchCreateParams.kt index 2e8fd5dac..debe5e0fa 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/BatchCreateParams.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/BatchCreateParams.kt @@ -411,21 +411,9 @@ constructor( @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is CompletionWindow && value == other.value /* spotless:on */ - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - companion object { - @JvmField val _24H = CompletionWindow(JsonField.of("24h")) + @JvmField val _24H = of("24h") @JvmStatic fun of(value: String) = CompletionWindow(JsonField.of(value)) } @@ -452,35 +440,35 @@ constructor( } fun asString(): String = _value().asStringOrThrow() - } - - class Endpoint - @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { - - @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value override fun equals(other: Any?): Boolean { if (this === other) { return true } - return /* spotless:off */ other is Endpoint && value == other.value /* spotless:on */ + return /* spotless:off */ other is CompletionWindow && value == other.value /* spotless:on */ } override fun hashCode() = value.hashCode() override fun toString() = value.toString() + } + + class Endpoint + @JsonCreator + private constructor( + private val value: JsonField, + ) : Enum { + + @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value companion object { - @JvmField val V1_CHAT_COMPLETIONS = Endpoint(JsonField.of("/v1/chat/completions")) + @JvmField val V1_CHAT_COMPLETIONS = of("/v1/chat/completions") - @JvmField val V1_EMBEDDINGS = Endpoint(JsonField.of("/v1/embeddings")) + @JvmField val V1_EMBEDDINGS = of("/v1/embeddings") - @JvmField val V1_COMPLETIONS = Endpoint(JsonField.of("/v1/completions")) + @JvmField val V1_COMPLETIONS = of("/v1/completions") @JvmStatic fun of(value: String) = Endpoint(JsonField.of(value)) } @@ -515,6 +503,18 @@ constructor( } fun asString(): String = _value().asStringOrThrow() + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return /* spotless:off */ other is Endpoint && value == other.value /* spotless:on */ + } + + override fun hashCode() = value.hashCode() + + override fun toString() = value.toString() } /** Optional custom metadata for the batch. */ diff --git a/openai-java-core/src/main/kotlin/com/openai/models/ChatCompletion.kt b/openai-java-core/src/main/kotlin/com/openai/models/ChatCompletion.kt index 3c62de316..74dace7fe 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/ChatCompletion.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/ChatCompletion.kt @@ -430,29 +430,17 @@ private constructor( @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is FinishReason && value == other.value /* spotless:on */ - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - companion object { - @JvmField val STOP = FinishReason(JsonField.of("stop")) + @JvmField val STOP = of("stop") - @JvmField val LENGTH = FinishReason(JsonField.of("length")) + @JvmField val LENGTH = of("length") - @JvmField val TOOL_CALLS = FinishReason(JsonField.of("tool_calls")) + @JvmField val TOOL_CALLS = of("tool_calls") - @JvmField val CONTENT_FILTER = FinishReason(JsonField.of("content_filter")) + @JvmField val CONTENT_FILTER = of("content_filter") - @JvmField val FUNCTION_CALL = FinishReason(JsonField.of("function_call")) + @JvmField val FUNCTION_CALL = of("function_call") @JvmStatic fun of(value: String) = FinishReason(JsonField.of(value)) } @@ -495,6 +483,18 @@ private constructor( } fun asString(): String = _value().asStringOrThrow() + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return /* spotless:off */ other is FinishReason && value == other.value /* spotless:on */ + } + + override fun hashCode() = value.hashCode() + + override fun toString() = value.toString() } /** Log probability information for the choice. */ @@ -644,21 +644,9 @@ private constructor( @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is Object && value == other.value /* spotless:on */ - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - companion object { - @JvmField val CHAT_COMPLETION = Object(JsonField.of("chat.completion")) + @JvmField val CHAT_COMPLETION = of("chat.completion") @JvmStatic fun of(value: String) = Object(JsonField.of(value)) } @@ -685,33 +673,33 @@ private constructor( } fun asString(): String = _value().asStringOrThrow() - } - - class ServiceTier - @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { - - @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value override fun equals(other: Any?): Boolean { if (this === other) { return true } - return /* spotless:off */ other is ServiceTier && value == other.value /* spotless:on */ + return /* spotless:off */ other is Object && value == other.value /* spotless:on */ } override fun hashCode() = value.hashCode() override fun toString() = value.toString() + } + + class ServiceTier + @JsonCreator + private constructor( + private val value: JsonField, + ) : Enum { + + @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value companion object { - @JvmField val SCALE = ServiceTier(JsonField.of("scale")) + @JvmField val SCALE = of("scale") - @JvmField val DEFAULT = ServiceTier(JsonField.of("default")) + @JvmField val DEFAULT = of("default") @JvmStatic fun of(value: String) = ServiceTier(JsonField.of(value)) } @@ -742,6 +730,18 @@ private constructor( } fun asString(): String = _value().asStringOrThrow() + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return /* spotless:off */ other is ServiceTier && value == other.value /* spotless:on */ + } + + override fun hashCode() = value.hashCode() + + override fun toString() = value.toString() } override fun equals(other: Any?): Boolean { diff --git a/openai-java-core/src/main/kotlin/com/openai/models/ChatCompletionAssistantMessageParam.kt b/openai-java-core/src/main/kotlin/com/openai/models/ChatCompletionAssistantMessageParam.kt index ae9861f22..ed29819b6 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/ChatCompletionAssistantMessageParam.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/ChatCompletionAssistantMessageParam.kt @@ -281,21 +281,9 @@ private constructor( @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is Role && value == other.value /* spotless:on */ - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - companion object { - @JvmField val ASSISTANT = Role(JsonField.of("assistant")) + @JvmField val ASSISTANT = of("assistant") @JvmStatic fun of(value: String) = Role(JsonField.of(value)) } @@ -322,6 +310,18 @@ private constructor( } fun asString(): String = _value().asStringOrThrow() + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return /* spotless:off */ other is Role && value == other.value /* spotless:on */ + } + + override fun hashCode() = value.hashCode() + + override fun toString() = value.toString() } /** diff --git a/openai-java-core/src/main/kotlin/com/openai/models/ChatCompletionAudioParam.kt b/openai-java-core/src/main/kotlin/com/openai/models/ChatCompletionAudioParam.kt index f954c7a71..55434c73e 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/ChatCompletionAudioParam.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/ChatCompletionAudioParam.kt @@ -148,29 +148,17 @@ private constructor( @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is Format && value == other.value /* spotless:on */ - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - companion object { - @JvmField val WAV = Format(JsonField.of("wav")) + @JvmField val WAV = of("wav") - @JvmField val MP3 = Format(JsonField.of("mp3")) + @JvmField val MP3 = of("mp3") - @JvmField val FLAC = Format(JsonField.of("flac")) + @JvmField val FLAC = of("flac") - @JvmField val OPUS = Format(JsonField.of("opus")) + @JvmField val OPUS = of("opus") - @JvmField val PCM16 = Format(JsonField.of("pcm16")) + @JvmField val PCM16 = of("pcm16") @JvmStatic fun of(value: String) = Format(JsonField.of(value)) } @@ -213,45 +201,45 @@ private constructor( } fun asString(): String = _value().asStringOrThrow() - } - - class Voice - @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { - - @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value override fun equals(other: Any?): Boolean { if (this === other) { return true } - return /* spotless:off */ other is Voice && value == other.value /* spotless:on */ + return /* spotless:off */ other is Format && value == other.value /* spotless:on */ } override fun hashCode() = value.hashCode() override fun toString() = value.toString() + } + + class Voice + @JsonCreator + private constructor( + private val value: JsonField, + ) : Enum { + + @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value companion object { - @JvmField val ALLOY = Voice(JsonField.of("alloy")) + @JvmField val ALLOY = of("alloy") - @JvmField val ASH = Voice(JsonField.of("ash")) + @JvmField val ASH = of("ash") - @JvmField val BALLAD = Voice(JsonField.of("ballad")) + @JvmField val BALLAD = of("ballad") - @JvmField val CORAL = Voice(JsonField.of("coral")) + @JvmField val CORAL = of("coral") - @JvmField val ECHO = Voice(JsonField.of("echo")) + @JvmField val ECHO = of("echo") - @JvmField val SAGE = Voice(JsonField.of("sage")) + @JvmField val SAGE = of("sage") - @JvmField val SHIMMER = Voice(JsonField.of("shimmer")) + @JvmField val SHIMMER = of("shimmer") - @JvmField val VERSE = Voice(JsonField.of("verse")) + @JvmField val VERSE = of("verse") @JvmStatic fun of(value: String) = Voice(JsonField.of(value)) } @@ -306,6 +294,18 @@ private constructor( } fun asString(): String = _value().asStringOrThrow() + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return /* spotless:off */ other is Voice && value == other.value /* spotless:on */ + } + + override fun hashCode() = value.hashCode() + + override fun toString() = value.toString() } override fun equals(other: Any?): Boolean { diff --git a/openai-java-core/src/main/kotlin/com/openai/models/ChatCompletionChunk.kt b/openai-java-core/src/main/kotlin/com/openai/models/ChatCompletionChunk.kt index c32925320..f6547d929 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/ChatCompletionChunk.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/ChatCompletionChunk.kt @@ -778,27 +778,15 @@ private constructor( @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is Role && value == other.value /* spotless:on */ - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - companion object { - @JvmField val SYSTEM = Role(JsonField.of("system")) + @JvmField val SYSTEM = of("system") - @JvmField val USER = Role(JsonField.of("user")) + @JvmField val USER = of("user") - @JvmField val ASSISTANT = Role(JsonField.of("assistant")) + @JvmField val ASSISTANT = of("assistant") - @JvmField val TOOL = Role(JsonField.of("tool")) + @JvmField val TOOL = of("tool") @JvmStatic fun of(value: String) = Role(JsonField.of(value)) } @@ -837,6 +825,18 @@ private constructor( } fun asString(): String = _value().asStringOrThrow() + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return /* spotless:off */ other is Role && value == other.value /* spotless:on */ + } + + override fun hashCode() = value.hashCode() + + override fun toString() = value.toString() } @JsonDeserialize(builder = ToolCall.Builder::class) @@ -1109,21 +1109,9 @@ private constructor( @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is Type && value == other.value /* spotless:on */ - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - companion object { - @JvmField val FUNCTION = Type(JsonField.of("function")) + @JvmField val FUNCTION = of("function") @JvmStatic fun of(value: String) = Type(JsonField.of(value)) } @@ -1150,6 +1138,18 @@ private constructor( } fun asString(): String = _value().asStringOrThrow() + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return /* spotless:off */ other is Type && value == other.value /* spotless:on */ + } + + override fun hashCode() = value.hashCode() + + override fun toString() = value.toString() } override fun equals(other: Any?): Boolean { @@ -1196,29 +1196,17 @@ private constructor( @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is FinishReason && value == other.value /* spotless:on */ - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - companion object { - @JvmField val STOP = FinishReason(JsonField.of("stop")) + @JvmField val STOP = of("stop") - @JvmField val LENGTH = FinishReason(JsonField.of("length")) + @JvmField val LENGTH = of("length") - @JvmField val TOOL_CALLS = FinishReason(JsonField.of("tool_calls")) + @JvmField val TOOL_CALLS = of("tool_calls") - @JvmField val CONTENT_FILTER = FinishReason(JsonField.of("content_filter")) + @JvmField val CONTENT_FILTER = of("content_filter") - @JvmField val FUNCTION_CALL = FinishReason(JsonField.of("function_call")) + @JvmField val FUNCTION_CALL = of("function_call") @JvmStatic fun of(value: String) = FinishReason(JsonField.of(value)) } @@ -1261,6 +1249,18 @@ private constructor( } fun asString(): String = _value().asStringOrThrow() + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return /* spotless:off */ other is FinishReason && value == other.value /* spotless:on */ + } + + override fun hashCode() = value.hashCode() + + override fun toString() = value.toString() } /** Log probability information for the choice. */ @@ -1410,21 +1410,9 @@ private constructor( @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is Object && value == other.value /* spotless:on */ - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - companion object { - @JvmField val CHAT_COMPLETION_CHUNK = Object(JsonField.of("chat.completion.chunk")) + @JvmField val CHAT_COMPLETION_CHUNK = of("chat.completion.chunk") @JvmStatic fun of(value: String) = Object(JsonField.of(value)) } @@ -1451,33 +1439,33 @@ private constructor( } fun asString(): String = _value().asStringOrThrow() - } - - class ServiceTier - @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { - - @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value override fun equals(other: Any?): Boolean { if (this === other) { return true } - return /* spotless:off */ other is ServiceTier && value == other.value /* spotless:on */ + return /* spotless:off */ other is Object && value == other.value /* spotless:on */ } override fun hashCode() = value.hashCode() override fun toString() = value.toString() + } + + class ServiceTier + @JsonCreator + private constructor( + private val value: JsonField, + ) : Enum { + + @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value companion object { - @JvmField val SCALE = ServiceTier(JsonField.of("scale")) + @JvmField val SCALE = of("scale") - @JvmField val DEFAULT = ServiceTier(JsonField.of("default")) + @JvmField val DEFAULT = of("default") @JvmStatic fun of(value: String) = ServiceTier(JsonField.of(value)) } @@ -1508,6 +1496,18 @@ private constructor( } fun asString(): String = _value().asStringOrThrow() + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return /* spotless:off */ other is ServiceTier && value == other.value /* spotless:on */ + } + + override fun hashCode() = value.hashCode() + + override fun toString() = value.toString() } override fun equals(other: Any?): Boolean { diff --git a/openai-java-core/src/main/kotlin/com/openai/models/ChatCompletionContentPartImage.kt b/openai-java-core/src/main/kotlin/com/openai/models/ChatCompletionContentPartImage.kt index c2b07a3b9..b4fd1f25b 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/ChatCompletionContentPartImage.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/ChatCompletionContentPartImage.kt @@ -221,25 +221,13 @@ private constructor( @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is Detail && value == other.value /* spotless:on */ - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - companion object { - @JvmField val AUTO = Detail(JsonField.of("auto")) + @JvmField val AUTO = of("auto") - @JvmField val LOW = Detail(JsonField.of("low")) + @JvmField val LOW = of("low") - @JvmField val HIGH = Detail(JsonField.of("high")) + @JvmField val HIGH = of("high") @JvmStatic fun of(value: String) = Detail(JsonField.of(value)) } @@ -274,6 +262,18 @@ private constructor( } fun asString(): String = _value().asStringOrThrow() + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return /* spotless:off */ other is Detail && value == other.value /* spotless:on */ + } + + override fun hashCode() = value.hashCode() + + override fun toString() = value.toString() } override fun equals(other: Any?): Boolean { @@ -302,21 +302,9 @@ private constructor( @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is Type && value == other.value /* spotless:on */ - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - companion object { - @JvmField val IMAGE_URL = Type(JsonField.of("image_url")) + @JvmField val IMAGE_URL = of("image_url") @JvmStatic fun of(value: String) = Type(JsonField.of(value)) } @@ -343,6 +331,18 @@ private constructor( } fun asString(): String = _value().asStringOrThrow() + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return /* spotless:off */ other is Type && value == other.value /* spotless:on */ + } + + override fun hashCode() = value.hashCode() + + override fun toString() = value.toString() } override fun equals(other: Any?): Boolean { diff --git a/openai-java-core/src/main/kotlin/com/openai/models/ChatCompletionContentPartInputAudio.kt b/openai-java-core/src/main/kotlin/com/openai/models/ChatCompletionContentPartInputAudio.kt index 55196eb62..d38fd276c 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/ChatCompletionContentPartInputAudio.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/ChatCompletionContentPartInputAudio.kt @@ -210,23 +210,11 @@ private constructor( @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is Format && value == other.value /* spotless:on */ - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - companion object { - @JvmField val WAV = Format(JsonField.of("wav")) + @JvmField val WAV = of("wav") - @JvmField val MP3 = Format(JsonField.of("mp3")) + @JvmField val MP3 = of("mp3") @JvmStatic fun of(value: String) = Format(JsonField.of(value)) } @@ -257,6 +245,18 @@ private constructor( } fun asString(): String = _value().asStringOrThrow() + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return /* spotless:off */ other is Format && value == other.value /* spotless:on */ + } + + override fun hashCode() = value.hashCode() + + override fun toString() = value.toString() } override fun equals(other: Any?): Boolean { @@ -285,21 +285,9 @@ private constructor( @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is Type && value == other.value /* spotless:on */ - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - companion object { - @JvmField val INPUT_AUDIO = Type(JsonField.of("input_audio")) + @JvmField val INPUT_AUDIO = of("input_audio") @JvmStatic fun of(value: String) = Type(JsonField.of(value)) } @@ -326,6 +314,18 @@ private constructor( } fun asString(): String = _value().asStringOrThrow() + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return /* spotless:off */ other is Type && value == other.value /* spotless:on */ + } + + override fun hashCode() = value.hashCode() + + override fun toString() = value.toString() } override fun equals(other: Any?): Boolean { diff --git a/openai-java-core/src/main/kotlin/com/openai/models/ChatCompletionContentPartRefusal.kt b/openai-java-core/src/main/kotlin/com/openai/models/ChatCompletionContentPartRefusal.kt index fde7193a7..de3eadd32 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/ChatCompletionContentPartRefusal.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/ChatCompletionContentPartRefusal.kt @@ -119,21 +119,9 @@ private constructor( @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is Type && value == other.value /* spotless:on */ - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - companion object { - @JvmField val REFUSAL = Type(JsonField.of("refusal")) + @JvmField val REFUSAL = of("refusal") @JvmStatic fun of(value: String) = Type(JsonField.of(value)) } @@ -160,6 +148,18 @@ private constructor( } fun asString(): String = _value().asStringOrThrow() + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return /* spotless:off */ other is Type && value == other.value /* spotless:on */ + } + + override fun hashCode() = value.hashCode() + + override fun toString() = value.toString() } override fun equals(other: Any?): Boolean { diff --git a/openai-java-core/src/main/kotlin/com/openai/models/ChatCompletionContentPartText.kt b/openai-java-core/src/main/kotlin/com/openai/models/ChatCompletionContentPartText.kt index deca739b7..b20c390c7 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/ChatCompletionContentPartText.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/ChatCompletionContentPartText.kt @@ -119,21 +119,9 @@ private constructor( @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is Type && value == other.value /* spotless:on */ - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - companion object { - @JvmField val TEXT = Type(JsonField.of("text")) + @JvmField val TEXT = of("text") @JvmStatic fun of(value: String) = Type(JsonField.of(value)) } @@ -160,6 +148,18 @@ private constructor( } fun asString(): String = _value().asStringOrThrow() + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return /* spotless:off */ other is Type && value == other.value /* spotless:on */ + } + + override fun hashCode() = value.hashCode() + + override fun toString() = value.toString() } override fun equals(other: Any?): Boolean { diff --git a/openai-java-core/src/main/kotlin/com/openai/models/ChatCompletionCreateParams.kt b/openai-java-core/src/main/kotlin/com/openai/models/ChatCompletionCreateParams.kt index aabf057e9..6b0ec6d49 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/ChatCompletionCreateParams.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/ChatCompletionCreateParams.kt @@ -1719,23 +1719,11 @@ constructor( @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is Behavior && value == other.value /* spotless:on */ - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - companion object { - @JvmField val NONE = Behavior(JsonField.of("none")) + @JvmField val NONE = of("none") - @JvmField val AUTO = Behavior(JsonField.of("auto")) + @JvmField val AUTO = of("auto") @JvmStatic fun of(value: String) = Behavior(JsonField.of(value)) } @@ -1766,6 +1754,18 @@ constructor( } fun asString(): String = _value().asStringOrThrow() + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return /* spotless:off */ other is Behavior && value == other.value /* spotless:on */ + } + + override fun hashCode() = value.hashCode() + + override fun toString() = value.toString() } } @@ -2193,23 +2193,11 @@ constructor( @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is ServiceTier && value == other.value /* spotless:on */ - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - companion object { - @JvmField val AUTO = ServiceTier(JsonField.of("auto")) + @JvmField val AUTO = of("auto") - @JvmField val DEFAULT = ServiceTier(JsonField.of("default")) + @JvmField val DEFAULT = of("default") @JvmStatic fun of(value: String) = ServiceTier(JsonField.of(value)) } @@ -2240,6 +2228,18 @@ constructor( } fun asString(): String = _value().asStringOrThrow() + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return /* spotless:off */ other is ServiceTier && value == other.value /* spotless:on */ + } + + override fun hashCode() = value.hashCode() + + override fun toString() = value.toString() } @JsonDeserialize(using = Stop.Deserializer::class) diff --git a/openai-java-core/src/main/kotlin/com/openai/models/ChatCompletionFunctionMessageParam.kt b/openai-java-core/src/main/kotlin/com/openai/models/ChatCompletionFunctionMessageParam.kt index 97d8e1550..b8582701e 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/ChatCompletionFunctionMessageParam.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/ChatCompletionFunctionMessageParam.kt @@ -139,21 +139,9 @@ private constructor( @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is Role && value == other.value /* spotless:on */ - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - companion object { - @JvmField val FUNCTION = Role(JsonField.of("function")) + @JvmField val FUNCTION = of("function") @JvmStatic fun of(value: String) = Role(JsonField.of(value)) } @@ -180,6 +168,18 @@ private constructor( } fun asString(): String = _value().asStringOrThrow() + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return /* spotless:off */ other is Role && value == other.value /* spotless:on */ + } + + override fun hashCode() = value.hashCode() + + override fun toString() = value.toString() } override fun equals(other: Any?): Boolean { diff --git a/openai-java-core/src/main/kotlin/com/openai/models/ChatCompletionMessage.kt b/openai-java-core/src/main/kotlin/com/openai/models/ChatCompletionMessage.kt index caf5e8fa4..84e48d679 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/ChatCompletionMessage.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/ChatCompletionMessage.kt @@ -227,21 +227,9 @@ private constructor( @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is Role && value == other.value /* spotless:on */ - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - companion object { - @JvmField val ASSISTANT = Role(JsonField.of("assistant")) + @JvmField val ASSISTANT = of("assistant") @JvmStatic fun of(value: String) = Role(JsonField.of(value)) } @@ -268,6 +256,18 @@ private constructor( } fun asString(): String = _value().asStringOrThrow() + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return /* spotless:off */ other is Role && value == other.value /* spotless:on */ + } + + override fun hashCode() = value.hashCode() + + override fun toString() = value.toString() } /** diff --git a/openai-java-core/src/main/kotlin/com/openai/models/ChatCompletionMessageToolCall.kt b/openai-java-core/src/main/kotlin/com/openai/models/ChatCompletionMessageToolCall.kt index 7a6a29f65..87e151277 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/ChatCompletionMessageToolCall.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/ChatCompletionMessageToolCall.kt @@ -267,21 +267,9 @@ private constructor( @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is Type && value == other.value /* spotless:on */ - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - companion object { - @JvmField val FUNCTION = Type(JsonField.of("function")) + @JvmField val FUNCTION = of("function") @JvmStatic fun of(value: String) = Type(JsonField.of(value)) } @@ -308,6 +296,18 @@ private constructor( } fun asString(): String = _value().asStringOrThrow() + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return /* spotless:off */ other is Type && value == other.value /* spotless:on */ + } + + override fun hashCode() = value.hashCode() + + override fun toString() = value.toString() } override fun equals(other: Any?): Boolean { diff --git a/openai-java-core/src/main/kotlin/com/openai/models/ChatCompletionModality.kt b/openai-java-core/src/main/kotlin/com/openai/models/ChatCompletionModality.kt index dce38f716..e4a973018 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/ChatCompletionModality.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/ChatCompletionModality.kt @@ -5,7 +5,6 @@ package com.openai.models import com.fasterxml.jackson.annotation.JsonCreator import com.openai.core.Enum import com.openai.core.JsonField -import com.openai.core.JsonValue import com.openai.errors.OpenAIInvalidDataException class ChatCompletionModality @@ -16,23 +15,11 @@ private constructor( @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is ChatCompletionModality && value == other.value /* spotless:on */ - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - companion object { - @JvmField val TEXT = ChatCompletionModality(JsonField.of("text")) + @JvmField val TEXT = of("text") - @JvmField val AUDIO = ChatCompletionModality(JsonField.of("audio")) + @JvmField val AUDIO = of("audio") @JvmStatic fun of(value: String) = ChatCompletionModality(JsonField.of(value)) } @@ -63,4 +50,16 @@ private constructor( } fun asString(): String = _value().asStringOrThrow() + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return /* spotless:off */ other is ChatCompletionModality && value == other.value /* spotless:on */ + } + + override fun hashCode() = value.hashCode() + + override fun toString() = value.toString() } diff --git a/openai-java-core/src/main/kotlin/com/openai/models/ChatCompletionNamedToolChoice.kt b/openai-java-core/src/main/kotlin/com/openai/models/ChatCompletionNamedToolChoice.kt index 83d9a1450..ca3b88e1d 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/ChatCompletionNamedToolChoice.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/ChatCompletionNamedToolChoice.kt @@ -202,21 +202,9 @@ private constructor( @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is Type && value == other.value /* spotless:on */ - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - companion object { - @JvmField val FUNCTION = Type(JsonField.of("function")) + @JvmField val FUNCTION = of("function") @JvmStatic fun of(value: String) = Type(JsonField.of(value)) } @@ -243,6 +231,18 @@ private constructor( } fun asString(): String = _value().asStringOrThrow() + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return /* spotless:off */ other is Type && value == other.value /* spotless:on */ + } + + override fun hashCode() = value.hashCode() + + override fun toString() = value.toString() } override fun equals(other: Any?): Boolean { diff --git a/openai-java-core/src/main/kotlin/com/openai/models/ChatCompletionPredictionContent.kt b/openai-java-core/src/main/kotlin/com/openai/models/ChatCompletionPredictionContent.kt index 1ee12d152..6c5888485 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/ChatCompletionPredictionContent.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/ChatCompletionPredictionContent.kt @@ -286,21 +286,9 @@ private constructor( @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is Type && value == other.value /* spotless:on */ - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - companion object { - @JvmField val CONTENT = Type(JsonField.of("content")) + @JvmField val CONTENT = of("content") @JvmStatic fun of(value: String) = Type(JsonField.of(value)) } @@ -327,6 +315,18 @@ private constructor( } fun asString(): String = _value().asStringOrThrow() + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return /* spotless:off */ other is Type && value == other.value /* spotless:on */ + } + + override fun hashCode() = value.hashCode() + + override fun toString() = value.toString() } override fun equals(other: Any?): Boolean { diff --git a/openai-java-core/src/main/kotlin/com/openai/models/ChatCompletionRole.kt b/openai-java-core/src/main/kotlin/com/openai/models/ChatCompletionRole.kt index 8b32335e7..356fc492d 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/ChatCompletionRole.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/ChatCompletionRole.kt @@ -5,7 +5,6 @@ package com.openai.models import com.fasterxml.jackson.annotation.JsonCreator import com.openai.core.Enum import com.openai.core.JsonField -import com.openai.core.JsonValue import com.openai.errors.OpenAIInvalidDataException class ChatCompletionRole @@ -16,29 +15,17 @@ private constructor( @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is ChatCompletionRole && value == other.value /* spotless:on */ - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - companion object { - @JvmField val SYSTEM = ChatCompletionRole(JsonField.of("system")) + @JvmField val SYSTEM = of("system") - @JvmField val USER = ChatCompletionRole(JsonField.of("user")) + @JvmField val USER = of("user") - @JvmField val ASSISTANT = ChatCompletionRole(JsonField.of("assistant")) + @JvmField val ASSISTANT = of("assistant") - @JvmField val TOOL = ChatCompletionRole(JsonField.of("tool")) + @JvmField val TOOL = of("tool") - @JvmField val FUNCTION = ChatCompletionRole(JsonField.of("function")) + @JvmField val FUNCTION = of("function") @JvmStatic fun of(value: String) = ChatCompletionRole(JsonField.of(value)) } @@ -81,4 +68,16 @@ private constructor( } fun asString(): String = _value().asStringOrThrow() + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return /* spotless:off */ other is ChatCompletionRole && value == other.value /* spotless:on */ + } + + override fun hashCode() = value.hashCode() + + override fun toString() = value.toString() } diff --git a/openai-java-core/src/main/kotlin/com/openai/models/ChatCompletionSystemMessageParam.kt b/openai-java-core/src/main/kotlin/com/openai/models/ChatCompletionSystemMessageParam.kt index c23734457..04728a7f2 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/ChatCompletionSystemMessageParam.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/ChatCompletionSystemMessageParam.kt @@ -286,21 +286,9 @@ private constructor( @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is Role && value == other.value /* spotless:on */ - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - companion object { - @JvmField val SYSTEM = Role(JsonField.of("system")) + @JvmField val SYSTEM = of("system") @JvmStatic fun of(value: String) = Role(JsonField.of(value)) } @@ -327,6 +315,18 @@ private constructor( } fun asString(): String = _value().asStringOrThrow() + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return /* spotless:off */ other is Role && value == other.value /* spotless:on */ + } + + override fun hashCode() = value.hashCode() + + override fun toString() = value.toString() } override fun equals(other: Any?): Boolean { diff --git a/openai-java-core/src/main/kotlin/com/openai/models/ChatCompletionTool.kt b/openai-java-core/src/main/kotlin/com/openai/models/ChatCompletionTool.kt index 7b769ef10..f1e1f3f64 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/ChatCompletionTool.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/ChatCompletionTool.kt @@ -114,21 +114,9 @@ private constructor( @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is Type && value == other.value /* spotless:on */ - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - companion object { - @JvmField val FUNCTION = Type(JsonField.of("function")) + @JvmField val FUNCTION = of("function") @JvmStatic fun of(value: String) = Type(JsonField.of(value)) } @@ -155,6 +143,18 @@ private constructor( } fun asString(): String = _value().asStringOrThrow() + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return /* spotless:off */ other is Type && value == other.value /* spotless:on */ + } + + override fun hashCode() = value.hashCode() + + override fun toString() = value.toString() } override fun equals(other: Any?): Boolean { diff --git a/openai-java-core/src/main/kotlin/com/openai/models/ChatCompletionToolChoiceOption.kt b/openai-java-core/src/main/kotlin/com/openai/models/ChatCompletionToolChoiceOption.kt index 5519ea0cf..1d85372ab 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/ChatCompletionToolChoiceOption.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/ChatCompletionToolChoiceOption.kt @@ -166,25 +166,13 @@ private constructor( @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is Behavior && value == other.value /* spotless:on */ - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - companion object { - @JvmField val NONE = Behavior(JsonField.of("none")) + @JvmField val NONE = of("none") - @JvmField val AUTO = Behavior(JsonField.of("auto")) + @JvmField val AUTO = of("auto") - @JvmField val REQUIRED = Behavior(JsonField.of("required")) + @JvmField val REQUIRED = of("required") @JvmStatic fun of(value: String) = Behavior(JsonField.of(value)) } @@ -219,5 +207,17 @@ private constructor( } fun asString(): String = _value().asStringOrThrow() + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return /* spotless:off */ other is Behavior && value == other.value /* spotless:on */ + } + + override fun hashCode() = value.hashCode() + + override fun toString() = value.toString() } } diff --git a/openai-java-core/src/main/kotlin/com/openai/models/ChatCompletionToolMessageParam.kt b/openai-java-core/src/main/kotlin/com/openai/models/ChatCompletionToolMessageParam.kt index 8e16bbf26..0106764f3 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/ChatCompletionToolMessageParam.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/ChatCompletionToolMessageParam.kt @@ -273,21 +273,9 @@ private constructor( @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is Role && value == other.value /* spotless:on */ - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - companion object { - @JvmField val TOOL = Role(JsonField.of("tool")) + @JvmField val TOOL = of("tool") @JvmStatic fun of(value: String) = Role(JsonField.of(value)) } @@ -314,6 +302,18 @@ private constructor( } fun asString(): String = _value().asStringOrThrow() + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return /* spotless:off */ other is Role && value == other.value /* spotless:on */ + } + + override fun hashCode() = value.hashCode() + + override fun toString() = value.toString() } override fun equals(other: Any?): Boolean { diff --git a/openai-java-core/src/main/kotlin/com/openai/models/ChatCompletionUserMessageParam.kt b/openai-java-core/src/main/kotlin/com/openai/models/ChatCompletionUserMessageParam.kt index 5257b2cb2..08ea9f65f 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/ChatCompletionUserMessageParam.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/ChatCompletionUserMessageParam.kt @@ -280,21 +280,9 @@ private constructor( @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is Role && value == other.value /* spotless:on */ - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - companion object { - @JvmField val USER = Role(JsonField.of("user")) + @JvmField val USER = of("user") @JvmStatic fun of(value: String) = Role(JsonField.of(value)) } @@ -321,6 +309,18 @@ private constructor( } fun asString(): String = _value().asStringOrThrow() + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return /* spotless:off */ other is Role && value == other.value /* spotless:on */ + } + + override fun hashCode() = value.hashCode() + + override fun toString() = value.toString() } override fun equals(other: Any?): Boolean { 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 2e8840da0..984bcedf2 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 @@ -5,7 +5,6 @@ package com.openai.models import com.fasterxml.jackson.annotation.JsonCreator import com.openai.core.Enum import com.openai.core.JsonField -import com.openai.core.JsonValue import com.openai.errors.OpenAIInvalidDataException class ChatModel @@ -16,91 +15,75 @@ private constructor( @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is ChatModel && value == other.value /* spotless:on */ - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - companion object { - @JvmField val O1_PREVIEW = ChatModel(JsonField.of("o1-preview")) + @JvmField val O1_PREVIEW = of("o1-preview") - @JvmField val O1_PREVIEW_2024_09_12 = ChatModel(JsonField.of("o1-preview-2024-09-12")) + @JvmField val O1_PREVIEW_2024_09_12 = of("o1-preview-2024-09-12") - @JvmField val O1_MINI = ChatModel(JsonField.of("o1-mini")) + @JvmField val O1_MINI = of("o1-mini") - @JvmField val O1_MINI_2024_09_12 = ChatModel(JsonField.of("o1-mini-2024-09-12")) + @JvmField val O1_MINI_2024_09_12 = of("o1-mini-2024-09-12") - @JvmField val GPT_4O = ChatModel(JsonField.of("gpt-4o")) + @JvmField val GPT_4O = of("gpt-4o") - @JvmField val GPT_4O_2024_11_20 = ChatModel(JsonField.of("gpt-4o-2024-11-20")) + @JvmField val GPT_4O_2024_11_20 = of("gpt-4o-2024-11-20") - @JvmField val GPT_4O_2024_08_06 = ChatModel(JsonField.of("gpt-4o-2024-08-06")) + @JvmField val GPT_4O_2024_08_06 = of("gpt-4o-2024-08-06") - @JvmField val GPT_4O_2024_05_13 = ChatModel(JsonField.of("gpt-4o-2024-05-13")) + @JvmField val GPT_4O_2024_05_13 = of("gpt-4o-2024-05-13") - @JvmField val GPT_4O_REALTIME_PREVIEW = ChatModel(JsonField.of("gpt-4o-realtime-preview")) + @JvmField val GPT_4O_REALTIME_PREVIEW = of("gpt-4o-realtime-preview") - @JvmField - val GPT_4O_REALTIME_PREVIEW_2024_10_01 = - ChatModel(JsonField.of("gpt-4o-realtime-preview-2024-10-01")) + @JvmField val GPT_4O_REALTIME_PREVIEW_2024_10_01 = of("gpt-4o-realtime-preview-2024-10-01") - @JvmField val GPT_4O_AUDIO_PREVIEW = ChatModel(JsonField.of("gpt-4o-audio-preview")) + @JvmField val GPT_4O_AUDIO_PREVIEW = of("gpt-4o-audio-preview") - @JvmField - val GPT_4O_AUDIO_PREVIEW_2024_10_01 = - ChatModel(JsonField.of("gpt-4o-audio-preview-2024-10-01")) + @JvmField val GPT_4O_AUDIO_PREVIEW_2024_10_01 = of("gpt-4o-audio-preview-2024-10-01") - @JvmField val CHATGPT_4O_LATEST = ChatModel(JsonField.of("chatgpt-4o-latest")) + @JvmField val CHATGPT_4O_LATEST = of("chatgpt-4o-latest") - @JvmField val GPT_4O_MINI = ChatModel(JsonField.of("gpt-4o-mini")) + @JvmField val GPT_4O_MINI = of("gpt-4o-mini") - @JvmField val GPT_4O_MINI_2024_07_18 = ChatModel(JsonField.of("gpt-4o-mini-2024-07-18")) + @JvmField val GPT_4O_MINI_2024_07_18 = of("gpt-4o-mini-2024-07-18") - @JvmField val GPT_4_TURBO = ChatModel(JsonField.of("gpt-4-turbo")) + @JvmField val GPT_4_TURBO = of("gpt-4-turbo") - @JvmField val GPT_4_TURBO_2024_04_09 = ChatModel(JsonField.of("gpt-4-turbo-2024-04-09")) + @JvmField val GPT_4_TURBO_2024_04_09 = of("gpt-4-turbo-2024-04-09") - @JvmField val GPT_4_0125_PREVIEW = ChatModel(JsonField.of("gpt-4-0125-preview")) + @JvmField val GPT_4_0125_PREVIEW = of("gpt-4-0125-preview") - @JvmField val GPT_4_TURBO_PREVIEW = ChatModel(JsonField.of("gpt-4-turbo-preview")) + @JvmField val GPT_4_TURBO_PREVIEW = of("gpt-4-turbo-preview") - @JvmField val GPT_4_1106_PREVIEW = ChatModel(JsonField.of("gpt-4-1106-preview")) + @JvmField val GPT_4_1106_PREVIEW = of("gpt-4-1106-preview") - @JvmField val GPT_4_VISION_PREVIEW = ChatModel(JsonField.of("gpt-4-vision-preview")) + @JvmField val GPT_4_VISION_PREVIEW = of("gpt-4-vision-preview") - @JvmField val GPT_4 = ChatModel(JsonField.of("gpt-4")) + @JvmField val GPT_4 = of("gpt-4") - @JvmField val GPT_4_0314 = ChatModel(JsonField.of("gpt-4-0314")) + @JvmField val GPT_4_0314 = of("gpt-4-0314") - @JvmField val GPT_4_0613 = ChatModel(JsonField.of("gpt-4-0613")) + @JvmField val GPT_4_0613 = of("gpt-4-0613") - @JvmField val GPT_4_32K = ChatModel(JsonField.of("gpt-4-32k")) + @JvmField val GPT_4_32K = of("gpt-4-32k") - @JvmField val GPT_4_32K_0314 = ChatModel(JsonField.of("gpt-4-32k-0314")) + @JvmField val GPT_4_32K_0314 = of("gpt-4-32k-0314") - @JvmField val GPT_4_32K_0613 = ChatModel(JsonField.of("gpt-4-32k-0613")) + @JvmField val GPT_4_32K_0613 = of("gpt-4-32k-0613") - @JvmField val GPT_3_5_TURBO = ChatModel(JsonField.of("gpt-3.5-turbo")) + @JvmField val GPT_3_5_TURBO = of("gpt-3.5-turbo") - @JvmField val GPT_3_5_TURBO_16K = ChatModel(JsonField.of("gpt-3.5-turbo-16k")) + @JvmField val GPT_3_5_TURBO_16K = of("gpt-3.5-turbo-16k") - @JvmField val GPT_3_5_TURBO_0301 = ChatModel(JsonField.of("gpt-3.5-turbo-0301")) + @JvmField val GPT_3_5_TURBO_0301 = of("gpt-3.5-turbo-0301") - @JvmField val GPT_3_5_TURBO_0613 = ChatModel(JsonField.of("gpt-3.5-turbo-0613")) + @JvmField val GPT_3_5_TURBO_0613 = of("gpt-3.5-turbo-0613") - @JvmField val GPT_3_5_TURBO_1106 = ChatModel(JsonField.of("gpt-3.5-turbo-1106")) + @JvmField val GPT_3_5_TURBO_1106 = of("gpt-3.5-turbo-1106") - @JvmField val GPT_3_5_TURBO_0125 = ChatModel(JsonField.of("gpt-3.5-turbo-0125")) + @JvmField val GPT_3_5_TURBO_0125 = of("gpt-3.5-turbo-0125") - @JvmField val GPT_3_5_TURBO_16K_0613 = ChatModel(JsonField.of("gpt-3.5-turbo-16k-0613")) + @JvmField val GPT_3_5_TURBO_16K_0613 = of("gpt-3.5-turbo-16k-0613") @JvmStatic fun of(value: String) = ChatModel(JsonField.of(value)) } @@ -259,4 +242,16 @@ private constructor( } fun asString(): String = _value().asStringOrThrow() + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return /* spotless:off */ other is ChatModel && value == other.value /* spotless:on */ + } + + override fun hashCode() = value.hashCode() + + override fun toString() = value.toString() } diff --git a/openai-java-core/src/main/kotlin/com/openai/models/Completion.kt b/openai-java-core/src/main/kotlin/com/openai/models/Completion.kt index 439f45be7..e26c7c6e8 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/Completion.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/Completion.kt @@ -240,21 +240,9 @@ private constructor( @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is Object && value == other.value /* spotless:on */ - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - companion object { - @JvmField val TEXT_COMPLETION = Object(JsonField.of("text_completion")) + @JvmField val TEXT_COMPLETION = of("text_completion") @JvmStatic fun of(value: String) = Object(JsonField.of(value)) } @@ -281,6 +269,18 @@ private constructor( } fun asString(): String = _value().asStringOrThrow() + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return /* spotless:off */ other is Object && value == other.value /* spotless:on */ + } + + override fun hashCode() = value.hashCode() + + override fun toString() = value.toString() } override fun equals(other: Any?): Boolean { diff --git a/openai-java-core/src/main/kotlin/com/openai/models/CompletionChoice.kt b/openai-java-core/src/main/kotlin/com/openai/models/CompletionChoice.kt index 8fa768549..7c7c114dd 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/CompletionChoice.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/CompletionChoice.kt @@ -167,25 +167,13 @@ private constructor( @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is FinishReason && value == other.value /* spotless:on */ - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - companion object { - @JvmField val STOP = FinishReason(JsonField.of("stop")) + @JvmField val STOP = of("stop") - @JvmField val LENGTH = FinishReason(JsonField.of("length")) + @JvmField val LENGTH = of("length") - @JvmField val CONTENT_FILTER = FinishReason(JsonField.of("content_filter")) + @JvmField val CONTENT_FILTER = of("content_filter") @JvmStatic fun of(value: String) = FinishReason(JsonField.of(value)) } @@ -220,6 +208,18 @@ private constructor( } fun asString(): String = _value().asStringOrThrow() + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return /* spotless:off */ other is FinishReason && value == other.value /* spotless:on */ + } + + override fun hashCode() = value.hashCode() + + override fun toString() = value.toString() } @JsonDeserialize(builder = Logprobs.Builder::class) diff --git a/openai-java-core/src/main/kotlin/com/openai/models/CompletionCreateParams.kt b/openai-java-core/src/main/kotlin/com/openai/models/CompletionCreateParams.kt index ae346fc71..329fea123 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/CompletionCreateParams.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/CompletionCreateParams.kt @@ -995,25 +995,13 @@ constructor( @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is Model && value == other.value /* spotless:on */ - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - companion object { - @JvmField val GPT_3_5_TURBO_INSTRUCT = Model(JsonField.of("gpt-3.5-turbo-instruct")) + @JvmField val GPT_3_5_TURBO_INSTRUCT = of("gpt-3.5-turbo-instruct") - @JvmField val DAVINCI_002 = Model(JsonField.of("davinci-002")) + @JvmField val DAVINCI_002 = of("davinci-002") - @JvmField val BABBAGE_002 = Model(JsonField.of("babbage-002")) + @JvmField val BABBAGE_002 = of("babbage-002") @JvmStatic fun of(value: String) = Model(JsonField.of(value)) } @@ -1048,6 +1036,18 @@ constructor( } fun asString(): String = _value().asStringOrThrow() + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return /* spotless:off */ other is Model && value == other.value /* spotless:on */ + } + + override fun hashCode() = value.hashCode() + + override fun toString() = value.toString() } @JsonDeserialize(using = Prompt.Deserializer::class) diff --git a/openai-java-core/src/main/kotlin/com/openai/models/CreateEmbeddingResponse.kt b/openai-java-core/src/main/kotlin/com/openai/models/CreateEmbeddingResponse.kt index b2d8fbf51..07697a540 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/CreateEmbeddingResponse.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/CreateEmbeddingResponse.kt @@ -156,21 +156,9 @@ private constructor( @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is Object && value == other.value /* spotless:on */ - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - companion object { - @JvmField val LIST = Object(JsonField.of("list")) + @JvmField val LIST = of("list") @JvmStatic fun of(value: String) = Object(JsonField.of(value)) } @@ -197,6 +185,18 @@ private constructor( } fun asString(): String = _value().asStringOrThrow() + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return /* spotless:off */ other is Object && value == other.value /* spotless:on */ + } + + override fun hashCode() = value.hashCode() + + override fun toString() = value.toString() } /** The usage information for the request. */ diff --git a/openai-java-core/src/main/kotlin/com/openai/models/Embedding.kt b/openai-java-core/src/main/kotlin/com/openai/models/Embedding.kt index c8a6e9ccd..d50f0960e 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/Embedding.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/Embedding.kt @@ -152,21 +152,9 @@ private constructor( @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is Object && value == other.value /* spotless:on */ - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - companion object { - @JvmField val EMBEDDING = Object(JsonField.of("embedding")) + @JvmField val EMBEDDING = of("embedding") @JvmStatic fun of(value: String) = Object(JsonField.of(value)) } @@ -193,6 +181,18 @@ private constructor( } fun asString(): String = _value().asStringOrThrow() + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return /* spotless:off */ other is Object && value == other.value /* spotless:on */ + } + + override fun hashCode() = value.hashCode() + + override fun toString() = value.toString() } override fun equals(other: Any?): Boolean { diff --git a/openai-java-core/src/main/kotlin/com/openai/models/EmbeddingCreateParams.kt b/openai-java-core/src/main/kotlin/com/openai/models/EmbeddingCreateParams.kt index 806aac33d..9c5f13b61 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/EmbeddingCreateParams.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/EmbeddingCreateParams.kt @@ -661,23 +661,11 @@ constructor( @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is EncodingFormat && value == other.value /* spotless:on */ - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - companion object { - @JvmField val FLOAT = EncodingFormat(JsonField.of("float")) + @JvmField val FLOAT = of("float") - @JvmField val BASE64 = EncodingFormat(JsonField.of("base64")) + @JvmField val BASE64 = of("base64") @JvmStatic fun of(value: String) = EncodingFormat(JsonField.of(value)) } @@ -708,6 +696,18 @@ constructor( } fun asString(): String = _value().asStringOrThrow() + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return /* spotless:off */ other is EncodingFormat && value == other.value /* spotless:on */ + } + + override fun hashCode() = value.hashCode() + + override fun toString() = value.toString() } override fun equals(other: Any?): Boolean { diff --git a/openai-java-core/src/main/kotlin/com/openai/models/EmbeddingModel.kt b/openai-java-core/src/main/kotlin/com/openai/models/EmbeddingModel.kt index cac9df22c..e130a4b71 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/EmbeddingModel.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/EmbeddingModel.kt @@ -5,7 +5,6 @@ package com.openai.models import com.fasterxml.jackson.annotation.JsonCreator import com.openai.core.Enum import com.openai.core.JsonField -import com.openai.core.JsonValue import com.openai.errors.OpenAIInvalidDataException class EmbeddingModel @@ -16,28 +15,13 @@ private constructor( @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is EmbeddingModel && value == other.value /* spotless:on */ - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - companion object { - @JvmField - val TEXT_EMBEDDING_ADA_002 = EmbeddingModel(JsonField.of("text-embedding-ada-002")) + @JvmField val TEXT_EMBEDDING_ADA_002 = of("text-embedding-ada-002") - @JvmField - val TEXT_EMBEDDING_3_SMALL = EmbeddingModel(JsonField.of("text-embedding-3-small")) + @JvmField val TEXT_EMBEDDING_3_SMALL = of("text-embedding-3-small") - @JvmField - val TEXT_EMBEDDING_3_LARGE = EmbeddingModel(JsonField.of("text-embedding-3-large")) + @JvmField val TEXT_EMBEDDING_3_LARGE = of("text-embedding-3-large") @JvmStatic fun of(value: String) = EmbeddingModel(JsonField.of(value)) } @@ -72,4 +56,16 @@ private constructor( } fun asString(): String = _value().asStringOrThrow() + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return /* spotless:off */ other is EmbeddingModel && value == other.value /* spotless:on */ + } + + override fun hashCode() = value.hashCode() + + override fun toString() = value.toString() } diff --git a/openai-java-core/src/main/kotlin/com/openai/models/FileDeleted.kt b/openai-java-core/src/main/kotlin/com/openai/models/FileDeleted.kt index 6c290c493..9cb0bcd8c 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/FileDeleted.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/FileDeleted.kt @@ -123,21 +123,9 @@ private constructor( @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is Object && value == other.value /* spotless:on */ - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - companion object { - @JvmField val FILE = Object(JsonField.of("file")) + @JvmField val FILE = of("file") @JvmStatic fun of(value: String) = Object(JsonField.of(value)) } @@ -164,6 +152,18 @@ private constructor( } fun asString(): String = _value().asStringOrThrow() + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return /* spotless:off */ other is Object && value == other.value /* spotless:on */ + } + + override fun hashCode() = value.hashCode() + + override fun toString() = value.toString() } override fun equals(other: Any?): Boolean { diff --git a/openai-java-core/src/main/kotlin/com/openai/models/FileListParams.kt b/openai-java-core/src/main/kotlin/com/openai/models/FileListParams.kt index f4da19baf..1f9410efc 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/FileListParams.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/FileListParams.kt @@ -5,7 +5,6 @@ package com.openai.models import com.fasterxml.jackson.annotation.JsonCreator import com.openai.core.Enum import com.openai.core.JsonField -import com.openai.core.JsonValue import com.openai.core.NoAutoDetect import com.openai.core.http.Headers import com.openai.core.http.QueryParams @@ -216,23 +215,11 @@ constructor( @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is Order && value == other.value /* spotless:on */ - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - companion object { - @JvmField val ASC = Order(JsonField.of("asc")) + @JvmField val ASC = of("asc") - @JvmField val DESC = Order(JsonField.of("desc")) + @JvmField val DESC = of("desc") @JvmStatic fun of(value: String) = Order(JsonField.of(value)) } @@ -263,6 +250,18 @@ constructor( } fun asString(): String = _value().asStringOrThrow() + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return /* spotless:off */ other is Order && value == other.value /* spotless:on */ + } + + override fun hashCode() = value.hashCode() + + override fun toString() = value.toString() } override fun equals(other: Any?): Boolean { diff --git a/openai-java-core/src/main/kotlin/com/openai/models/FileObject.kt b/openai-java-core/src/main/kotlin/com/openai/models/FileObject.kt index cd38e262a..ab1fe8ad3 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/FileObject.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/FileObject.kt @@ -271,21 +271,9 @@ private constructor( @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is Object && value == other.value /* spotless:on */ - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - companion object { - @JvmField val FILE = Object(JsonField.of("file")) + @JvmField val FILE = of("file") @JvmStatic fun of(value: String) = Object(JsonField.of(value)) } @@ -312,43 +300,43 @@ private constructor( } fun asString(): String = _value().asStringOrThrow() - } - - class Purpose - @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { - - @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value override fun equals(other: Any?): Boolean { if (this === other) { return true } - return /* spotless:off */ other is Purpose && value == other.value /* spotless:on */ + return /* spotless:off */ other is Object && value == other.value /* spotless:on */ } override fun hashCode() = value.hashCode() override fun toString() = value.toString() + } + + class Purpose + @JsonCreator + private constructor( + private val value: JsonField, + ) : Enum { + + @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value companion object { - @JvmField val ASSISTANTS = Purpose(JsonField.of("assistants")) + @JvmField val ASSISTANTS = of("assistants") - @JvmField val ASSISTANTS_OUTPUT = Purpose(JsonField.of("assistants_output")) + @JvmField val ASSISTANTS_OUTPUT = of("assistants_output") - @JvmField val BATCH = Purpose(JsonField.of("batch")) + @JvmField val BATCH = of("batch") - @JvmField val BATCH_OUTPUT = Purpose(JsonField.of("batch_output")) + @JvmField val BATCH_OUTPUT = of("batch_output") - @JvmField val FINE_TUNE = Purpose(JsonField.of("fine-tune")) + @JvmField val FINE_TUNE = of("fine-tune") - @JvmField val FINE_TUNE_RESULTS = Purpose(JsonField.of("fine-tune-results")) + @JvmField val FINE_TUNE_RESULTS = of("fine-tune-results") - @JvmField val VISION = Purpose(JsonField.of("vision")) + @JvmField val VISION = of("vision") @JvmStatic fun of(value: String) = Purpose(JsonField.of(value)) } @@ -399,35 +387,35 @@ private constructor( } fun asString(): String = _value().asStringOrThrow() - } - - class Status - @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { - - @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value override fun equals(other: Any?): Boolean { if (this === other) { return true } - return /* spotless:off */ other is Status && value == other.value /* spotless:on */ + return /* spotless:off */ other is Purpose && value == other.value /* spotless:on */ } override fun hashCode() = value.hashCode() override fun toString() = value.toString() + } + + class Status + @JsonCreator + private constructor( + private val value: JsonField, + ) : Enum { + + @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value companion object { - @JvmField val UPLOADED = Status(JsonField.of("uploaded")) + @JvmField val UPLOADED = of("uploaded") - @JvmField val PROCESSED = Status(JsonField.of("processed")) + @JvmField val PROCESSED = of("processed") - @JvmField val ERROR = Status(JsonField.of("error")) + @JvmField val ERROR = of("error") @JvmStatic fun of(value: String) = Status(JsonField.of(value)) } @@ -462,6 +450,18 @@ private constructor( } fun asString(): String = _value().asStringOrThrow() + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return /* spotless:off */ other is Status && value == other.value /* spotless:on */ + } + + override fun hashCode() = value.hashCode() + + override fun toString() = value.toString() } override fun equals(other: Any?): Boolean { diff --git a/openai-java-core/src/main/kotlin/com/openai/models/FilePurpose.kt b/openai-java-core/src/main/kotlin/com/openai/models/FilePurpose.kt index 79ff551f1..88278ca5d 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/FilePurpose.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/FilePurpose.kt @@ -5,7 +5,6 @@ package com.openai.models import com.fasterxml.jackson.annotation.JsonCreator import com.openai.core.Enum import com.openai.core.JsonField -import com.openai.core.JsonValue import com.openai.errors.OpenAIInvalidDataException class FilePurpose @@ -16,27 +15,15 @@ private constructor( @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is FilePurpose && value == other.value /* spotless:on */ - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - companion object { - @JvmField val ASSISTANTS = FilePurpose(JsonField.of("assistants")) + @JvmField val ASSISTANTS = of("assistants") - @JvmField val BATCH = FilePurpose(JsonField.of("batch")) + @JvmField val BATCH = of("batch") - @JvmField val FINE_TUNE = FilePurpose(JsonField.of("fine-tune")) + @JvmField val FINE_TUNE = of("fine-tune") - @JvmField val VISION = FilePurpose(JsonField.of("vision")) + @JvmField val VISION = of("vision") @JvmStatic fun of(value: String) = FilePurpose(JsonField.of(value)) } @@ -75,4 +62,16 @@ private constructor( } fun asString(): String = _value().asStringOrThrow() + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return /* spotless:off */ other is FilePurpose && value == other.value /* spotless:on */ + } + + override fun hashCode() = value.hashCode() + + override fun toString() = value.toString() } diff --git a/openai-java-core/src/main/kotlin/com/openai/models/FineTuningJob.kt b/openai-java-core/src/main/kotlin/com/openai/models/FineTuningJob.kt index cd3cdf96d..7ed424cfe 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/FineTuningJob.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/FineTuningJob.kt @@ -916,21 +916,9 @@ private constructor( @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is Behavior && value == other.value /* spotless:on */ - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - companion object { - @JvmField val AUTO = Behavior(JsonField.of("auto")) + @JvmField val AUTO = of("auto") @JvmStatic fun of(value: String) = Behavior(JsonField.of(value)) } @@ -957,6 +945,18 @@ private constructor( } fun asString(): String = _value().asStringOrThrow() + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return /* spotless:off */ other is Behavior && value == other.value /* spotless:on */ + } + + override fun hashCode() = value.hashCode() + + override fun toString() = value.toString() } } @@ -986,21 +986,9 @@ private constructor( @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is Object && value == other.value /* spotless:on */ - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - companion object { - @JvmField val FINE_TUNING_JOB = Object(JsonField.of("fine_tuning.job")) + @JvmField val FINE_TUNING_JOB = of("fine_tuning.job") @JvmStatic fun of(value: String) = Object(JsonField.of(value)) } @@ -1027,41 +1015,41 @@ private constructor( } fun asString(): String = _value().asStringOrThrow() - } - - class Status - @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { - - @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value override fun equals(other: Any?): Boolean { if (this === other) { return true } - return /* spotless:off */ other is Status && value == other.value /* spotless:on */ + return /* spotless:off */ other is Object && value == other.value /* spotless:on */ } override fun hashCode() = value.hashCode() override fun toString() = value.toString() + } + + class Status + @JsonCreator + private constructor( + private val value: JsonField, + ) : Enum { + + @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value companion object { - @JvmField val VALIDATING_FILES = Status(JsonField.of("validating_files")) + @JvmField val VALIDATING_FILES = of("validating_files") - @JvmField val QUEUED = Status(JsonField.of("queued")) + @JvmField val QUEUED = of("queued") - @JvmField val RUNNING = Status(JsonField.of("running")) + @JvmField val RUNNING = of("running") - @JvmField val SUCCEEDED = Status(JsonField.of("succeeded")) + @JvmField val SUCCEEDED = of("succeeded") - @JvmField val FAILED = Status(JsonField.of("failed")) + @JvmField val FAILED = of("failed") - @JvmField val CANCELLED = Status(JsonField.of("cancelled")) + @JvmField val CANCELLED = of("cancelled") @JvmStatic fun of(value: String) = Status(JsonField.of(value)) } @@ -1108,6 +1096,18 @@ private constructor( } fun asString(): String = _value().asStringOrThrow() + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return /* spotless:off */ other is Status && value == other.value /* spotless:on */ + } + + override fun hashCode() = value.hashCode() + + override fun toString() = value.toString() } override fun equals(other: Any?): Boolean { diff --git a/openai-java-core/src/main/kotlin/com/openai/models/FineTuningJobCheckpoint.kt b/openai-java-core/src/main/kotlin/com/openai/models/FineTuningJobCheckpoint.kt index 5900e1a00..80a2b1127 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/FineTuningJobCheckpoint.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/FineTuningJobCheckpoint.kt @@ -427,22 +427,9 @@ private constructor( @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is Object && value == other.value /* spotless:on */ - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - companion object { - @JvmField - val FINE_TUNING_JOB_CHECKPOINT = Object(JsonField.of("fine_tuning.job.checkpoint")) + @JvmField val FINE_TUNING_JOB_CHECKPOINT = of("fine_tuning.job.checkpoint") @JvmStatic fun of(value: String) = Object(JsonField.of(value)) } @@ -469,6 +456,18 @@ private constructor( } fun asString(): String = _value().asStringOrThrow() + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return /* spotless:off */ other is Object && value == other.value /* spotless:on */ + } + + override fun hashCode() = value.hashCode() + + override fun toString() = value.toString() } override fun equals(other: Any?): Boolean { diff --git a/openai-java-core/src/main/kotlin/com/openai/models/FineTuningJobCreateParams.kt b/openai-java-core/src/main/kotlin/com/openai/models/FineTuningJobCreateParams.kt index 62cf23a60..0d08c6715 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/FineTuningJobCreateParams.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/FineTuningJobCreateParams.kt @@ -561,27 +561,15 @@ constructor( @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is Model && value == other.value /* spotless:on */ - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - companion object { - @JvmField val BABBAGE_002 = Model(JsonField.of("babbage-002")) + @JvmField val BABBAGE_002 = of("babbage-002") - @JvmField val DAVINCI_002 = Model(JsonField.of("davinci-002")) + @JvmField val DAVINCI_002 = of("davinci-002") - @JvmField val GPT_3_5_TURBO = Model(JsonField.of("gpt-3.5-turbo")) + @JvmField val GPT_3_5_TURBO = of("gpt-3.5-turbo") - @JvmField val GPT_4O_MINI = Model(JsonField.of("gpt-4o-mini")) + @JvmField val GPT_4O_MINI = of("gpt-4o-mini") @JvmStatic fun of(value: String) = Model(JsonField.of(value)) } @@ -620,6 +608,18 @@ constructor( } fun asString(): String = _value().asStringOrThrow() + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return /* spotless:off */ other is Model && value == other.value /* spotless:on */ + } + + override fun hashCode() = value.hashCode() + + override fun toString() = value.toString() } /** The hyperparameters used for the fine-tuning job. */ @@ -842,21 +842,9 @@ constructor( @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is Behavior && value == other.value /* spotless:on */ - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - companion object { - @JvmField val AUTO = Behavior(JsonField.of("auto")) + @JvmField val AUTO = of("auto") @JvmStatic fun of(value: String) = Behavior(JsonField.of(value)) } @@ -883,6 +871,18 @@ constructor( } fun asString(): String = _value().asStringOrThrow() + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return /* spotless:off */ other is Behavior && value == other.value /* spotless:on */ + } + + override fun hashCode() = value.hashCode() + + override fun toString() = value.toString() } } @@ -1007,21 +1007,9 @@ constructor( @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is Behavior && value == other.value /* spotless:on */ - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - companion object { - @JvmField val AUTO = Behavior(JsonField.of("auto")) + @JvmField val AUTO = of("auto") @JvmStatic fun of(value: String) = Behavior(JsonField.of(value)) } @@ -1048,6 +1036,18 @@ constructor( } fun asString(): String = _value().asStringOrThrow() + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return /* spotless:off */ other is Behavior && value == other.value /* spotless:on */ + } + + override fun hashCode() = value.hashCode() + + override fun toString() = value.toString() } } @@ -1169,21 +1169,9 @@ constructor( @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is Behavior && value == other.value /* spotless:on */ - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - companion object { - @JvmField val AUTO = Behavior(JsonField.of("auto")) + @JvmField val AUTO = of("auto") @JvmStatic fun of(value: String) = Behavior(JsonField.of(value)) } @@ -1210,6 +1198,18 @@ constructor( } fun asString(): String = _value().asStringOrThrow() + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return /* spotless:off */ other is Behavior && value == other.value /* spotless:on */ + } + + override fun hashCode() = value.hashCode() + + override fun toString() = value.toString() } } @@ -1322,21 +1322,9 @@ constructor( @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is Type && value == other.value /* spotless:on */ - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - companion object { - @JvmField val WANDB = Type(JsonField.of("wandb")) + @JvmField val WANDB = of("wandb") @JvmStatic fun of(value: String) = Type(JsonField.of(value)) } @@ -1363,6 +1351,18 @@ constructor( } fun asString(): String = _value().asStringOrThrow() + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return /* spotless:off */ other is Type && value == other.value /* spotless:on */ + } + + override fun hashCode() = value.hashCode() + + override fun toString() = value.toString() } /** diff --git a/openai-java-core/src/main/kotlin/com/openai/models/FineTuningJobEvent.kt b/openai-java-core/src/main/kotlin/com/openai/models/FineTuningJobEvent.kt index 26d94ad82..de60cbfe1 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/FineTuningJobEvent.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/FineTuningJobEvent.kt @@ -154,25 +154,13 @@ private constructor( @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is Level && value == other.value /* spotless:on */ - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - companion object { - @JvmField val INFO = Level(JsonField.of("info")) + @JvmField val INFO = of("info") - @JvmField val WARN = Level(JsonField.of("warn")) + @JvmField val WARN = of("warn") - @JvmField val ERROR = Level(JsonField.of("error")) + @JvmField val ERROR = of("error") @JvmStatic fun of(value: String) = Level(JsonField.of(value)) } @@ -207,31 +195,31 @@ private constructor( } fun asString(): String = _value().asStringOrThrow() - } - - class Object - @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { - - @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value override fun equals(other: Any?): Boolean { if (this === other) { return true } - return /* spotless:off */ other is Object && value == other.value /* spotless:on */ + return /* spotless:off */ other is Level && value == other.value /* spotless:on */ } override fun hashCode() = value.hashCode() override fun toString() = value.toString() + } + + class Object + @JsonCreator + private constructor( + private val value: JsonField, + ) : Enum { + + @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value companion object { - @JvmField val FINE_TUNING_JOB_EVENT = Object(JsonField.of("fine_tuning.job.event")) + @JvmField val FINE_TUNING_JOB_EVENT = of("fine_tuning.job.event") @JvmStatic fun of(value: String) = Object(JsonField.of(value)) } @@ -258,6 +246,18 @@ private constructor( } fun asString(): String = _value().asStringOrThrow() + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return /* spotless:off */ other is Object && value == other.value /* spotless:on */ + } + + override fun hashCode() = value.hashCode() + + override fun toString() = value.toString() } override fun equals(other: Any?): Boolean { diff --git a/openai-java-core/src/main/kotlin/com/openai/models/FineTuningJobWandbIntegrationObject.kt b/openai-java-core/src/main/kotlin/com/openai/models/FineTuningJobWandbIntegrationObject.kt index e6b27f8b8..e1ff04b9b 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/FineTuningJobWandbIntegrationObject.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/FineTuningJobWandbIntegrationObject.kt @@ -140,21 +140,9 @@ private constructor( @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is Type && value == other.value /* spotless:on */ - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - companion object { - @JvmField val WANDB = Type(JsonField.of("wandb")) + @JvmField val WANDB = of("wandb") @JvmStatic fun of(value: String) = Type(JsonField.of(value)) } @@ -181,6 +169,18 @@ private constructor( } fun asString(): String = _value().asStringOrThrow() + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return /* spotless:off */ other is Type && value == other.value /* spotless:on */ + } + + override fun hashCode() = value.hashCode() + + override fun toString() = value.toString() } override fun equals(other: Any?): Boolean { diff --git a/openai-java-core/src/main/kotlin/com/openai/models/ImageGenerateParams.kt b/openai-java-core/src/main/kotlin/com/openai/models/ImageGenerateParams.kt index 78768d7cf..0aae90847 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/ImageGenerateParams.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/ImageGenerateParams.kt @@ -511,23 +511,11 @@ constructor( @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is Quality && value == other.value /* spotless:on */ - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - companion object { - @JvmField val STANDARD = Quality(JsonField.of("standard")) + @JvmField val STANDARD = of("standard") - @JvmField val HD = Quality(JsonField.of("hd")) + @JvmField val HD = of("hd") @JvmStatic fun of(value: String) = Quality(JsonField.of(value)) } @@ -558,33 +546,33 @@ constructor( } fun asString(): String = _value().asStringOrThrow() - } - - class ResponseFormat - @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { - - @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value override fun equals(other: Any?): Boolean { if (this === other) { return true } - return /* spotless:off */ other is ResponseFormat && value == other.value /* spotless:on */ + return /* spotless:off */ other is Quality && value == other.value /* spotless:on */ } override fun hashCode() = value.hashCode() override fun toString() = value.toString() + } + + class ResponseFormat + @JsonCreator + private constructor( + private val value: JsonField, + ) : Enum { + + @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value companion object { - @JvmField val URL = ResponseFormat(JsonField.of("url")) + @JvmField val URL = of("url") - @JvmField val B64_JSON = ResponseFormat(JsonField.of("b64_json")) + @JvmField val B64_JSON = of("b64_json") @JvmStatic fun of(value: String) = ResponseFormat(JsonField.of(value)) } @@ -615,39 +603,39 @@ constructor( } fun asString(): String = _value().asStringOrThrow() - } - - class Size - @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { - - @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value override fun equals(other: Any?): Boolean { if (this === other) { return true } - return /* spotless:off */ other is Size && value == other.value /* spotless:on */ + return /* spotless:off */ other is ResponseFormat && value == other.value /* spotless:on */ } override fun hashCode() = value.hashCode() override fun toString() = value.toString() + } + + class Size + @JsonCreator + private constructor( + private val value: JsonField, + ) : Enum { + + @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value companion object { - @JvmField val _256X256 = Size(JsonField.of("256x256")) + @JvmField val _256X256 = of("256x256") - @JvmField val _512X512 = Size(JsonField.of("512x512")) + @JvmField val _512X512 = of("512x512") - @JvmField val _1024X1024 = Size(JsonField.of("1024x1024")) + @JvmField val _1024X1024 = of("1024x1024") - @JvmField val _1792X1024 = Size(JsonField.of("1792x1024")) + @JvmField val _1792X1024 = of("1792x1024") - @JvmField val _1024X1792 = Size(JsonField.of("1024x1792")) + @JvmField val _1024X1792 = of("1024x1792") @JvmStatic fun of(value: String) = Size(JsonField.of(value)) } @@ -690,33 +678,33 @@ constructor( } fun asString(): String = _value().asStringOrThrow() - } - - class Style - @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { - - @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value override fun equals(other: Any?): Boolean { if (this === other) { return true } - return /* spotless:off */ other is Style && value == other.value /* spotless:on */ + return /* spotless:off */ other is Size && value == other.value /* spotless:on */ } override fun hashCode() = value.hashCode() override fun toString() = value.toString() + } + + class Style + @JsonCreator + private constructor( + private val value: JsonField, + ) : Enum { + + @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value companion object { - @JvmField val VIVID = Style(JsonField.of("vivid")) + @JvmField val VIVID = of("vivid") - @JvmField val NATURAL = Style(JsonField.of("natural")) + @JvmField val NATURAL = of("natural") @JvmStatic fun of(value: String) = Style(JsonField.of(value)) } @@ -747,6 +735,18 @@ constructor( } fun asString(): String = _value().asStringOrThrow() + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return /* spotless:off */ other is Style && value == other.value /* spotless:on */ + } + + override fun hashCode() = value.hashCode() + + override fun toString() = value.toString() } override fun equals(other: Any?): Boolean { diff --git a/openai-java-core/src/main/kotlin/com/openai/models/ImageModel.kt b/openai-java-core/src/main/kotlin/com/openai/models/ImageModel.kt index af0bf357b..376f8ff5f 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/ImageModel.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/ImageModel.kt @@ -5,7 +5,6 @@ package com.openai.models import com.fasterxml.jackson.annotation.JsonCreator import com.openai.core.Enum import com.openai.core.JsonField -import com.openai.core.JsonValue import com.openai.errors.OpenAIInvalidDataException class ImageModel @@ -16,23 +15,11 @@ private constructor( @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is ImageModel && value == other.value /* spotless:on */ - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - companion object { - @JvmField val DALL_E_2 = ImageModel(JsonField.of("dall-e-2")) + @JvmField val DALL_E_2 = of("dall-e-2") - @JvmField val DALL_E_3 = ImageModel(JsonField.of("dall-e-3")) + @JvmField val DALL_E_3 = of("dall-e-3") @JvmStatic fun of(value: String) = ImageModel(JsonField.of(value)) } @@ -63,4 +50,16 @@ private constructor( } fun asString(): String = _value().asStringOrThrow() + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return /* spotless:off */ other is ImageModel && value == other.value /* spotless:on */ + } + + override fun hashCode() = value.hashCode() + + override fun toString() = value.toString() } diff --git a/openai-java-core/src/main/kotlin/com/openai/models/Model.kt b/openai-java-core/src/main/kotlin/com/openai/models/Model.kt index 575c7272d..972062d91 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/Model.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/Model.kt @@ -155,21 +155,9 @@ private constructor( @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is Object && value == other.value /* spotless:on */ - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - companion object { - @JvmField val MODEL = Object(JsonField.of("model")) + @JvmField val MODEL = of("model") @JvmStatic fun of(value: String) = Object(JsonField.of(value)) } @@ -196,6 +184,18 @@ private constructor( } fun asString(): String = _value().asStringOrThrow() + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return /* spotless:off */ other is Object && value == other.value /* spotless:on */ + } + + override fun hashCode() = value.hashCode() + + override fun toString() = value.toString() } override fun equals(other: Any?): Boolean { diff --git a/openai-java-core/src/main/kotlin/com/openai/models/Moderation.kt b/openai-java-core/src/main/kotlin/com/openai/models/Moderation.kt index a2725c30f..ab42a33f1 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/Moderation.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/Moderation.kt @@ -970,21 +970,9 @@ private constructor( @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is Harassment && value == other.value /* spotless:on */ - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - companion object { - @JvmField val TEXT = Harassment(JsonField.of("text")) + @JvmField val TEXT = of("text") @JvmStatic fun of(value: String) = Harassment(JsonField.of(value)) } @@ -1011,31 +999,31 @@ private constructor( } fun asString(): String = _value().asStringOrThrow() - } - - class HarassmentThreatening - @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { - - @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value override fun equals(other: Any?): Boolean { if (this === other) { return true } - return /* spotless:off */ other is HarassmentThreatening && value == other.value /* spotless:on */ + return /* spotless:off */ other is Harassment && value == other.value /* spotless:on */ } override fun hashCode() = value.hashCode() override fun toString() = value.toString() + } + + class HarassmentThreatening + @JsonCreator + private constructor( + private val value: JsonField, + ) : Enum { + + @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value companion object { - @JvmField val TEXT = HarassmentThreatening(JsonField.of("text")) + @JvmField val TEXT = of("text") @JvmStatic fun of(value: String) = HarassmentThreatening(JsonField.of(value)) } @@ -1063,31 +1051,31 @@ private constructor( } fun asString(): String = _value().asStringOrThrow() - } - - class Hate - @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { - - @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value override fun equals(other: Any?): Boolean { if (this === other) { return true } - return /* spotless:off */ other is Hate && value == other.value /* spotless:on */ + return /* spotless:off */ other is HarassmentThreatening && value == other.value /* spotless:on */ } override fun hashCode() = value.hashCode() override fun toString() = value.toString() + } + + class Hate + @JsonCreator + private constructor( + private val value: JsonField, + ) : Enum { + + @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value companion object { - @JvmField val TEXT = Hate(JsonField.of("text")) + @JvmField val TEXT = of("text") @JvmStatic fun of(value: String) = Hate(JsonField.of(value)) } @@ -1114,31 +1102,31 @@ private constructor( } fun asString(): String = _value().asStringOrThrow() - } - - class HateThreatening - @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { - - @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value override fun equals(other: Any?): Boolean { if (this === other) { return true } - return /* spotless:off */ other is HateThreatening && value == other.value /* spotless:on */ + return /* spotless:off */ other is Hate && value == other.value /* spotless:on */ } override fun hashCode() = value.hashCode() override fun toString() = value.toString() + } + + class HateThreatening + @JsonCreator + private constructor( + private val value: JsonField, + ) : Enum { + + @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value companion object { - @JvmField val TEXT = HateThreatening(JsonField.of("text")) + @JvmField val TEXT = of("text") @JvmStatic fun of(value: String) = HateThreatening(JsonField.of(value)) } @@ -1165,31 +1153,31 @@ private constructor( } fun asString(): String = _value().asStringOrThrow() - } - - class Illicit - @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { - - @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value override fun equals(other: Any?): Boolean { if (this === other) { return true } - return /* spotless:off */ other is Illicit && value == other.value /* spotless:on */ + return /* spotless:off */ other is HateThreatening && value == other.value /* spotless:on */ } override fun hashCode() = value.hashCode() override fun toString() = value.toString() + } + + class Illicit + @JsonCreator + private constructor( + private val value: JsonField, + ) : Enum { + + @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value companion object { - @JvmField val TEXT = Illicit(JsonField.of("text")) + @JvmField val TEXT = of("text") @JvmStatic fun of(value: String) = Illicit(JsonField.of(value)) } @@ -1216,31 +1204,31 @@ private constructor( } fun asString(): String = _value().asStringOrThrow() - } - - class IllicitViolent - @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { - - @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value override fun equals(other: Any?): Boolean { if (this === other) { return true } - return /* spotless:off */ other is IllicitViolent && value == other.value /* spotless:on */ + return /* spotless:off */ other is Illicit && value == other.value /* spotless:on */ } override fun hashCode() = value.hashCode() override fun toString() = value.toString() + } + + class IllicitViolent + @JsonCreator + private constructor( + private val value: JsonField, + ) : Enum { + + @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value companion object { - @JvmField val TEXT = IllicitViolent(JsonField.of("text")) + @JvmField val TEXT = of("text") @JvmStatic fun of(value: String) = IllicitViolent(JsonField.of(value)) } @@ -1267,33 +1255,33 @@ private constructor( } fun asString(): String = _value().asStringOrThrow() - } - - class SelfHarm - @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { - - @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value override fun equals(other: Any?): Boolean { if (this === other) { return true } - return /* spotless:off */ other is SelfHarm && value == other.value /* spotless:on */ + return /* spotless:off */ other is IllicitViolent && value == other.value /* spotless:on */ } override fun hashCode() = value.hashCode() override fun toString() = value.toString() + } + + class SelfHarm + @JsonCreator + private constructor( + private val value: JsonField, + ) : Enum { + + @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value companion object { - @JvmField val TEXT = SelfHarm(JsonField.of("text")) + @JvmField val TEXT = of("text") - @JvmField val IMAGE = SelfHarm(JsonField.of("image")) + @JvmField val IMAGE = of("image") @JvmStatic fun of(value: String) = SelfHarm(JsonField.of(value)) } @@ -1324,33 +1312,33 @@ private constructor( } fun asString(): String = _value().asStringOrThrow() - } - - class SelfHarmInstruction - @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { - - @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value override fun equals(other: Any?): Boolean { if (this === other) { return true } - return /* spotless:off */ other is SelfHarmInstruction && value == other.value /* spotless:on */ + return /* spotless:off */ other is SelfHarm && value == other.value /* spotless:on */ } override fun hashCode() = value.hashCode() override fun toString() = value.toString() + } + + class SelfHarmInstruction + @JsonCreator + private constructor( + private val value: JsonField, + ) : Enum { + + @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value companion object { - @JvmField val TEXT = SelfHarmInstruction(JsonField.of("text")) + @JvmField val TEXT = of("text") - @JvmField val IMAGE = SelfHarmInstruction(JsonField.of("image")) + @JvmField val IMAGE = of("image") @JvmStatic fun of(value: String) = SelfHarmInstruction(JsonField.of(value)) } @@ -1381,33 +1369,33 @@ private constructor( } fun asString(): String = _value().asStringOrThrow() - } - - class SelfHarmIntent - @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { - - @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value override fun equals(other: Any?): Boolean { if (this === other) { return true } - return /* spotless:off */ other is SelfHarmIntent && value == other.value /* spotless:on */ + return /* spotless:off */ other is SelfHarmInstruction && value == other.value /* spotless:on */ } override fun hashCode() = value.hashCode() override fun toString() = value.toString() + } + + class SelfHarmIntent + @JsonCreator + private constructor( + private val value: JsonField, + ) : Enum { + + @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value companion object { - @JvmField val TEXT = SelfHarmIntent(JsonField.of("text")) + @JvmField val TEXT = of("text") - @JvmField val IMAGE = SelfHarmIntent(JsonField.of("image")) + @JvmField val IMAGE = of("image") @JvmStatic fun of(value: String) = SelfHarmIntent(JsonField.of(value)) } @@ -1438,33 +1426,33 @@ private constructor( } fun asString(): String = _value().asStringOrThrow() - } - - class Sexual - @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { - - @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value override fun equals(other: Any?): Boolean { if (this === other) { return true } - return /* spotless:off */ other is Sexual && value == other.value /* spotless:on */ + return /* spotless:off */ other is SelfHarmIntent && value == other.value /* spotless:on */ } override fun hashCode() = value.hashCode() override fun toString() = value.toString() + } + + class Sexual + @JsonCreator + private constructor( + private val value: JsonField, + ) : Enum { + + @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value companion object { - @JvmField val TEXT = Sexual(JsonField.of("text")) + @JvmField val TEXT = of("text") - @JvmField val IMAGE = Sexual(JsonField.of("image")) + @JvmField val IMAGE = of("image") @JvmStatic fun of(value: String) = Sexual(JsonField.of(value)) } @@ -1495,31 +1483,31 @@ private constructor( } fun asString(): String = _value().asStringOrThrow() - } - - class SexualMinor - @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { - - @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value override fun equals(other: Any?): Boolean { if (this === other) { return true } - return /* spotless:off */ other is SexualMinor && value == other.value /* spotless:on */ + return /* spotless:off */ other is Sexual && value == other.value /* spotless:on */ } override fun hashCode() = value.hashCode() override fun toString() = value.toString() + } + + class SexualMinor + @JsonCreator + private constructor( + private val value: JsonField, + ) : Enum { + + @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value companion object { - @JvmField val TEXT = SexualMinor(JsonField.of("text")) + @JvmField val TEXT = of("text") @JvmStatic fun of(value: String) = SexualMinor(JsonField.of(value)) } @@ -1546,33 +1534,33 @@ private constructor( } fun asString(): String = _value().asStringOrThrow() - } - - class Violence - @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { - - @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value override fun equals(other: Any?): Boolean { if (this === other) { return true } - return /* spotless:off */ other is Violence && value == other.value /* spotless:on */ + return /* spotless:off */ other is SexualMinor && value == other.value /* spotless:on */ } override fun hashCode() = value.hashCode() override fun toString() = value.toString() + } + + class Violence + @JsonCreator + private constructor( + private val value: JsonField, + ) : Enum { + + @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value companion object { - @JvmField val TEXT = Violence(JsonField.of("text")) + @JvmField val TEXT = of("text") - @JvmField val IMAGE = Violence(JsonField.of("image")) + @JvmField val IMAGE = of("image") @JvmStatic fun of(value: String) = Violence(JsonField.of(value)) } @@ -1603,33 +1591,33 @@ private constructor( } fun asString(): String = _value().asStringOrThrow() - } - - class ViolenceGraphic - @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { - - @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value override fun equals(other: Any?): Boolean { if (this === other) { return true } - return /* spotless:off */ other is ViolenceGraphic && value == other.value /* spotless:on */ + return /* spotless:off */ other is Violence && value == other.value /* spotless:on */ } override fun hashCode() = value.hashCode() override fun toString() = value.toString() + } + + class ViolenceGraphic + @JsonCreator + private constructor( + private val value: JsonField, + ) : Enum { + + @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value companion object { - @JvmField val TEXT = ViolenceGraphic(JsonField.of("text")) + @JvmField val TEXT = of("text") - @JvmField val IMAGE = ViolenceGraphic(JsonField.of("image")) + @JvmField val IMAGE = of("image") @JvmStatic fun of(value: String) = ViolenceGraphic(JsonField.of(value)) } @@ -1660,6 +1648,18 @@ private constructor( } fun asString(): String = _value().asStringOrThrow() + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return /* spotless:off */ other is ViolenceGraphic && value == other.value /* spotless:on */ + } + + override fun hashCode() = value.hashCode() + + override fun toString() = value.toString() } override fun equals(other: Any?): Boolean { diff --git a/openai-java-core/src/main/kotlin/com/openai/models/ModerationImageUrlInput.kt b/openai-java-core/src/main/kotlin/com/openai/models/ModerationImageUrlInput.kt index b34b94119..a95e733d1 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/ModerationImageUrlInput.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/ModerationImageUrlInput.kt @@ -207,21 +207,9 @@ private constructor( @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is Type && value == other.value /* spotless:on */ - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - companion object { - @JvmField val IMAGE_URL = Type(JsonField.of("image_url")) + @JvmField val IMAGE_URL = of("image_url") @JvmStatic fun of(value: String) = Type(JsonField.of(value)) } @@ -248,6 +236,18 @@ private constructor( } fun asString(): String = _value().asStringOrThrow() + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return /* spotless:off */ other is Type && value == other.value /* spotless:on */ + } + + override fun hashCode() = value.hashCode() + + override fun toString() = value.toString() } override fun equals(other: Any?): Boolean { diff --git a/openai-java-core/src/main/kotlin/com/openai/models/ModerationModel.kt b/openai-java-core/src/main/kotlin/com/openai/models/ModerationModel.kt index c51663d27..1e8a2ef46 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/ModerationModel.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/ModerationModel.kt @@ -5,7 +5,6 @@ package com.openai.models import com.fasterxml.jackson.annotation.JsonCreator import com.openai.core.Enum import com.openai.core.JsonField -import com.openai.core.JsonValue import com.openai.errors.OpenAIInvalidDataException class ModerationModel @@ -16,31 +15,15 @@ private constructor( @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is ModerationModel && value == other.value /* spotless:on */ - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - companion object { - @JvmField - val OMNI_MODERATION_LATEST = ModerationModel(JsonField.of("omni-moderation-latest")) + @JvmField val OMNI_MODERATION_LATEST = of("omni-moderation-latest") - @JvmField - val OMNI_MODERATION_2024_09_26 = ModerationModel(JsonField.of("omni-moderation-2024-09-26")) + @JvmField val OMNI_MODERATION_2024_09_26 = of("omni-moderation-2024-09-26") - @JvmField - val TEXT_MODERATION_LATEST = ModerationModel(JsonField.of("text-moderation-latest")) + @JvmField val TEXT_MODERATION_LATEST = of("text-moderation-latest") - @JvmField - val TEXT_MODERATION_STABLE = ModerationModel(JsonField.of("text-moderation-stable")) + @JvmField val TEXT_MODERATION_STABLE = of("text-moderation-stable") @JvmStatic fun of(value: String) = ModerationModel(JsonField.of(value)) } @@ -79,4 +62,16 @@ private constructor( } fun asString(): String = _value().asStringOrThrow() + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return /* spotless:off */ other is ModerationModel && value == other.value /* spotless:on */ + } + + override fun hashCode() = value.hashCode() + + override fun toString() = value.toString() } diff --git a/openai-java-core/src/main/kotlin/com/openai/models/ModerationTextInput.kt b/openai-java-core/src/main/kotlin/com/openai/models/ModerationTextInput.kt index 5b9a58e5f..8a799c7ec 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/ModerationTextInput.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/ModerationTextInput.kt @@ -119,21 +119,9 @@ private constructor( @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is Type && value == other.value /* spotless:on */ - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - companion object { - @JvmField val TEXT = Type(JsonField.of("text")) + @JvmField val TEXT = of("text") @JvmStatic fun of(value: String) = Type(JsonField.of(value)) } @@ -160,6 +148,18 @@ private constructor( } fun asString(): String = _value().asStringOrThrow() + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return /* spotless:off */ other is Type && value == other.value /* spotless:on */ + } + + override fun hashCode() = value.hashCode() + + override fun toString() = value.toString() } override fun equals(other: Any?): Boolean { 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 9f1d46045..78446de54 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 @@ -96,21 +96,9 @@ private constructor( @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is Type && value == other.value /* spotless:on */ - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - companion object { - @JvmField val JSON_OBJECT = Type(JsonField.of("json_object")) + @JvmField val JSON_OBJECT = of("json_object") @JvmStatic fun of(value: String) = Type(JsonField.of(value)) } @@ -137,6 +125,18 @@ private constructor( } fun asString(): String = _value().asStringOrThrow() + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return /* spotless:off */ other is Type && value == other.value /* spotless:on */ + } + + override fun hashCode() = value.hashCode() + + override fun toString() = value.toString() } override fun equals(other: Any?): Boolean { 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 6853160f3..fa00b5a23 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 @@ -382,21 +382,9 @@ private constructor( @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is Type && value == other.value /* spotless:on */ - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - companion object { - @JvmField val JSON_SCHEMA = Type(JsonField.of("json_schema")) + @JvmField val JSON_SCHEMA = of("json_schema") @JvmStatic fun of(value: String) = Type(JsonField.of(value)) } @@ -423,6 +411,18 @@ private constructor( } fun asString(): String = _value().asStringOrThrow() + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return /* spotless:off */ other is Type && value == other.value /* spotless:on */ + } + + override fun hashCode() = value.hashCode() + + override fun toString() = value.toString() } override fun equals(other: Any?): Boolean { 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 532a02561..8b2107337 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 @@ -96,21 +96,9 @@ private constructor( @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is Type && value == other.value /* spotless:on */ - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - companion object { - @JvmField val TEXT = Type(JsonField.of("text")) + @JvmField val TEXT = of("text") @JvmStatic fun of(value: String) = Type(JsonField.of(value)) } @@ -137,6 +125,18 @@ private constructor( } fun asString(): String = _value().asStringOrThrow() + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return /* spotless:off */ other is Type && value == other.value /* spotless:on */ + } + + override fun hashCode() = value.hashCode() + + override fun toString() = value.toString() } override fun equals(other: Any?): Boolean { diff --git a/openai-java-core/src/main/kotlin/com/openai/models/Upload.kt b/openai-java-core/src/main/kotlin/com/openai/models/Upload.kt index dc0d0b877..449c083bf 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/Upload.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/Upload.kt @@ -267,21 +267,9 @@ private constructor( @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is Object && value == other.value /* spotless:on */ - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - companion object { - @JvmField val UPLOAD = Object(JsonField.of("upload")) + @JvmField val UPLOAD = of("upload") @JvmStatic fun of(value: String) = Object(JsonField.of(value)) } @@ -308,37 +296,37 @@ private constructor( } fun asString(): String = _value().asStringOrThrow() - } - - class Status - @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { - - @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value override fun equals(other: Any?): Boolean { if (this === other) { return true } - return /* spotless:off */ other is Status && value == other.value /* spotless:on */ + return /* spotless:off */ other is Object && value == other.value /* spotless:on */ } override fun hashCode() = value.hashCode() override fun toString() = value.toString() + } + + class Status + @JsonCreator + private constructor( + private val value: JsonField, + ) : Enum { + + @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value companion object { - @JvmField val PENDING = Status(JsonField.of("pending")) + @JvmField val PENDING = of("pending") - @JvmField val COMPLETED = Status(JsonField.of("completed")) + @JvmField val COMPLETED = of("completed") - @JvmField val CANCELLED = Status(JsonField.of("cancelled")) + @JvmField val CANCELLED = of("cancelled") - @JvmField val EXPIRED = Status(JsonField.of("expired")) + @JvmField val EXPIRED = of("expired") @JvmStatic fun of(value: String) = Status(JsonField.of(value)) } @@ -377,6 +365,18 @@ private constructor( } fun asString(): String = _value().asStringOrThrow() + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return /* spotless:off */ other is Status && value == other.value /* spotless:on */ + } + + override fun hashCode() = value.hashCode() + + override fun toString() = value.toString() } override fun equals(other: Any?): Boolean { diff --git a/openai-java-core/src/main/kotlin/com/openai/models/UploadPart.kt b/openai-java-core/src/main/kotlin/com/openai/models/UploadPart.kt index fd50e0c94..663379d0f 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/UploadPart.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/UploadPart.kt @@ -155,21 +155,9 @@ private constructor( @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is Object && value == other.value /* spotless:on */ - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - companion object { - @JvmField val UPLOAD_PART = Object(JsonField.of("upload.part")) + @JvmField val UPLOAD_PART = of("upload.part") @JvmStatic fun of(value: String) = Object(JsonField.of(value)) } @@ -196,6 +184,18 @@ private constructor( } fun asString(): String = _value().asStringOrThrow() + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return /* spotless:off */ other is Object && value == other.value /* spotless:on */ + } + + override fun hashCode() = value.hashCode() + + override fun toString() = value.toString() } override fun equals(other: Any?): Boolean {