Skip to content

Commit

Permalink
fix(client)!: remove duplicated classes
Browse files Browse the repository at this point in the history
  • Loading branch information
stainless-bot committed Nov 26, 2024
1 parent 3aabe8f commit 8a8f11f
Show file tree
Hide file tree
Showing 14 changed files with 59 additions and 505 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ import java.util.Optional
class ChatCompletionCreateParams
constructor(
private val messages: List<ChatCompletionMessageParam>,
private val model: Model,
private val model: ChatModel,
private val audio: ChatCompletionAudioParam?,
private val frequencyPenalty: Double?,
private val functionCall: FunctionCall?,
Expand Down Expand Up @@ -66,7 +66,7 @@ constructor(

fun messages(): List<ChatCompletionMessageParam> = messages

fun model(): Model = model
fun model(): ChatModel = model

fun audio(): Optional<ChatCompletionAudioParam> = Optional.ofNullable(audio)

Expand Down Expand Up @@ -170,7 +170,7 @@ constructor(
class ChatCompletionCreateBody
internal constructor(
private val messages: List<ChatCompletionMessageParam>?,
private val model: Model?,
private val model: ChatModel?,
private val audio: ChatCompletionAudioParam?,
private val frequencyPenalty: Double?,
private val functionCall: FunctionCall?,
Expand Down Expand Up @@ -215,7 +215,7 @@ constructor(
* [model endpoint compatibility](https://platform.openai.com/docs/models#model-endpoint-compatibility)
* table for details on which models work with the Chat API.
*/
@JsonProperty("model") fun model(): Model? = model
@JsonProperty("model") fun model(): ChatModel? = model

/**
* Parameters for audio output. Required when audio output is requested with `modalities:
Expand Down Expand Up @@ -463,7 +463,7 @@ constructor(
class Builder {

private var messages: List<ChatCompletionMessageParam>? = null
private var model: Model? = null
private var model: ChatModel? = null
private var audio: ChatCompletionAudioParam? = null
private var frequencyPenalty: Double? = null
private var functionCall: FunctionCall? = null
Expand Down Expand Up @@ -543,7 +543,7 @@ constructor(
* [model endpoint compatibility](https://platform.openai.com/docs/models#model-endpoint-compatibility)
* table for details on which models work with the Chat API.
*/
@JsonProperty("model") fun model(model: Model) = apply { this.model = model }
@JsonProperty("model") fun model(model: ChatModel) = apply { this.model = model }

/**
* Parameters for audio output. Required when audio output is requested with
Expand Down Expand Up @@ -898,7 +898,7 @@ constructor(
class Builder {

private var messages: MutableList<ChatCompletionMessageParam> = mutableListOf()
private var model: Model? = null
private var model: ChatModel? = null
private var audio: ChatCompletionAudioParam? = null
private var frequencyPenalty: Double? = null
private var functionCall: FunctionCall? = null
Expand Down Expand Up @@ -993,14 +993,14 @@ constructor(
* [model endpoint compatibility](https://platform.openai.com/docs/models#model-endpoint-compatibility)
* table for details on which models work with the Chat API.
*/
fun model(model: Model) = apply { this.model = model }
fun model(model: ChatModel) = apply { this.model = model }

/**
* ID of the model to use. See the
* [model endpoint compatibility](https://platform.openai.com/docs/models#model-endpoint-compatibility)
* table for details on which models work with the Chat API.
*/
fun model(value: String) = apply { this.model = Model.of(value) }
fun model(value: String) = apply { this.model = ChatModel.of(value) }

/**
* Parameters for audio output. Required when audio output is requested with `modalities:
Expand Down Expand Up @@ -1585,259 +1585,6 @@ constructor(
)
}

class Model
@JsonCreator
private constructor(
private val value: JsonField<String>,
) : Enum {

@com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField<String> = 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 O1_PREVIEW = Model(JsonField.of("o1-preview"))

@JvmField val O1_PREVIEW_2024_09_12 = Model(JsonField.of("o1-preview-2024-09-12"))

@JvmField val O1_MINI = Model(JsonField.of("o1-mini"))

@JvmField val O1_MINI_2024_09_12 = Model(JsonField.of("o1-mini-2024-09-12"))

@JvmField val GPT_4O = Model(JsonField.of("gpt-4o"))

@JvmField val GPT_4O_2024_11_20 = Model(JsonField.of("gpt-4o-2024-11-20"))

@JvmField val GPT_4O_2024_08_06 = Model(JsonField.of("gpt-4o-2024-08-06"))

@JvmField val GPT_4O_2024_05_13 = Model(JsonField.of("gpt-4o-2024-05-13"))

@JvmField val GPT_4O_REALTIME_PREVIEW = Model(JsonField.of("gpt-4o-realtime-preview"))

@JvmField
val GPT_4O_REALTIME_PREVIEW_2024_10_01 =
Model(JsonField.of("gpt-4o-realtime-preview-2024-10-01"))

@JvmField val GPT_4O_AUDIO_PREVIEW = Model(JsonField.of("gpt-4o-audio-preview"))

@JvmField
val GPT_4O_AUDIO_PREVIEW_2024_10_01 =
Model(JsonField.of("gpt-4o-audio-preview-2024-10-01"))

@JvmField val CHATGPT_4O_LATEST = Model(JsonField.of("chatgpt-4o-latest"))

@JvmField val GPT_4O_MINI = Model(JsonField.of("gpt-4o-mini"))

@JvmField val GPT_4O_MINI_2024_07_18 = Model(JsonField.of("gpt-4o-mini-2024-07-18"))

@JvmField val GPT_4_TURBO = Model(JsonField.of("gpt-4-turbo"))

@JvmField val GPT_4_TURBO_2024_04_09 = Model(JsonField.of("gpt-4-turbo-2024-04-09"))

@JvmField val GPT_4_0125_PREVIEW = Model(JsonField.of("gpt-4-0125-preview"))

@JvmField val GPT_4_TURBO_PREVIEW = Model(JsonField.of("gpt-4-turbo-preview"))

@JvmField val GPT_4_1106_PREVIEW = Model(JsonField.of("gpt-4-1106-preview"))

@JvmField val GPT_4_VISION_PREVIEW = Model(JsonField.of("gpt-4-vision-preview"))

@JvmField val GPT_4 = Model(JsonField.of("gpt-4"))

@JvmField val GPT_4_0314 = Model(JsonField.of("gpt-4-0314"))

@JvmField val GPT_4_0613 = Model(JsonField.of("gpt-4-0613"))

@JvmField val GPT_4_32K = Model(JsonField.of("gpt-4-32k"))

@JvmField val GPT_4_32K_0314 = Model(JsonField.of("gpt-4-32k-0314"))

@JvmField val GPT_4_32K_0613 = Model(JsonField.of("gpt-4-32k-0613"))

@JvmField val GPT_3_5_TURBO = Model(JsonField.of("gpt-3.5-turbo"))

@JvmField val GPT_3_5_TURBO_16K = Model(JsonField.of("gpt-3.5-turbo-16k"))

@JvmField val GPT_3_5_TURBO_0301 = Model(JsonField.of("gpt-3.5-turbo-0301"))

@JvmField val GPT_3_5_TURBO_0613 = Model(JsonField.of("gpt-3.5-turbo-0613"))

@JvmField val GPT_3_5_TURBO_1106 = Model(JsonField.of("gpt-3.5-turbo-1106"))

@JvmField val GPT_3_5_TURBO_0125 = Model(JsonField.of("gpt-3.5-turbo-0125"))

@JvmField val GPT_3_5_TURBO_16K_0613 = Model(JsonField.of("gpt-3.5-turbo-16k-0613"))

@JvmStatic fun of(value: String) = Model(JsonField.of(value))
}

enum class Known {
O1_PREVIEW,
O1_PREVIEW_2024_09_12,
O1_MINI,
O1_MINI_2024_09_12,
GPT_4O,
GPT_4O_2024_11_20,
GPT_4O_2024_08_06,
GPT_4O_2024_05_13,
GPT_4O_REALTIME_PREVIEW,
GPT_4O_REALTIME_PREVIEW_2024_10_01,
GPT_4O_AUDIO_PREVIEW,
GPT_4O_AUDIO_PREVIEW_2024_10_01,
CHATGPT_4O_LATEST,
GPT_4O_MINI,
GPT_4O_MINI_2024_07_18,
GPT_4_TURBO,
GPT_4_TURBO_2024_04_09,
GPT_4_0125_PREVIEW,
GPT_4_TURBO_PREVIEW,
GPT_4_1106_PREVIEW,
GPT_4_VISION_PREVIEW,
GPT_4,
GPT_4_0314,
GPT_4_0613,
GPT_4_32K,
GPT_4_32K_0314,
GPT_4_32K_0613,
GPT_3_5_TURBO,
GPT_3_5_TURBO_16K,
GPT_3_5_TURBO_0301,
GPT_3_5_TURBO_0613,
GPT_3_5_TURBO_1106,
GPT_3_5_TURBO_0125,
GPT_3_5_TURBO_16K_0613,
}

enum class Value {
O1_PREVIEW,
O1_PREVIEW_2024_09_12,
O1_MINI,
O1_MINI_2024_09_12,
GPT_4O,
GPT_4O_2024_11_20,
GPT_4O_2024_08_06,
GPT_4O_2024_05_13,
GPT_4O_REALTIME_PREVIEW,
GPT_4O_REALTIME_PREVIEW_2024_10_01,
GPT_4O_AUDIO_PREVIEW,
GPT_4O_AUDIO_PREVIEW_2024_10_01,
CHATGPT_4O_LATEST,
GPT_4O_MINI,
GPT_4O_MINI_2024_07_18,
GPT_4_TURBO,
GPT_4_TURBO_2024_04_09,
GPT_4_0125_PREVIEW,
GPT_4_TURBO_PREVIEW,
GPT_4_1106_PREVIEW,
GPT_4_VISION_PREVIEW,
GPT_4,
GPT_4_0314,
GPT_4_0613,
GPT_4_32K,
GPT_4_32K_0314,
GPT_4_32K_0613,
GPT_3_5_TURBO,
GPT_3_5_TURBO_16K,
GPT_3_5_TURBO_0301,
GPT_3_5_TURBO_0613,
GPT_3_5_TURBO_1106,
GPT_3_5_TURBO_0125,
GPT_3_5_TURBO_16K_0613,
_UNKNOWN,
}

fun value(): Value =
when (this) {
O1_PREVIEW -> Value.O1_PREVIEW
O1_PREVIEW_2024_09_12 -> Value.O1_PREVIEW_2024_09_12
O1_MINI -> Value.O1_MINI
O1_MINI_2024_09_12 -> Value.O1_MINI_2024_09_12
GPT_4O -> Value.GPT_4O
GPT_4O_2024_11_20 -> Value.GPT_4O_2024_11_20
GPT_4O_2024_08_06 -> Value.GPT_4O_2024_08_06
GPT_4O_2024_05_13 -> Value.GPT_4O_2024_05_13
GPT_4O_REALTIME_PREVIEW -> Value.GPT_4O_REALTIME_PREVIEW
GPT_4O_REALTIME_PREVIEW_2024_10_01 -> Value.GPT_4O_REALTIME_PREVIEW_2024_10_01
GPT_4O_AUDIO_PREVIEW -> Value.GPT_4O_AUDIO_PREVIEW
GPT_4O_AUDIO_PREVIEW_2024_10_01 -> Value.GPT_4O_AUDIO_PREVIEW_2024_10_01
CHATGPT_4O_LATEST -> Value.CHATGPT_4O_LATEST
GPT_4O_MINI -> Value.GPT_4O_MINI
GPT_4O_MINI_2024_07_18 -> Value.GPT_4O_MINI_2024_07_18
GPT_4_TURBO -> Value.GPT_4_TURBO
GPT_4_TURBO_2024_04_09 -> Value.GPT_4_TURBO_2024_04_09
GPT_4_0125_PREVIEW -> Value.GPT_4_0125_PREVIEW
GPT_4_TURBO_PREVIEW -> Value.GPT_4_TURBO_PREVIEW
GPT_4_1106_PREVIEW -> Value.GPT_4_1106_PREVIEW
GPT_4_VISION_PREVIEW -> Value.GPT_4_VISION_PREVIEW
GPT_4 -> Value.GPT_4
GPT_4_0314 -> Value.GPT_4_0314
GPT_4_0613 -> Value.GPT_4_0613
GPT_4_32K -> Value.GPT_4_32K
GPT_4_32K_0314 -> Value.GPT_4_32K_0314
GPT_4_32K_0613 -> Value.GPT_4_32K_0613
GPT_3_5_TURBO -> Value.GPT_3_5_TURBO
GPT_3_5_TURBO_16K -> Value.GPT_3_5_TURBO_16K
GPT_3_5_TURBO_0301 -> Value.GPT_3_5_TURBO_0301
GPT_3_5_TURBO_0613 -> Value.GPT_3_5_TURBO_0613
GPT_3_5_TURBO_1106 -> Value.GPT_3_5_TURBO_1106
GPT_3_5_TURBO_0125 -> Value.GPT_3_5_TURBO_0125
GPT_3_5_TURBO_16K_0613 -> Value.GPT_3_5_TURBO_16K_0613
else -> Value._UNKNOWN
}

fun known(): Known =
when (this) {
O1_PREVIEW -> Known.O1_PREVIEW
O1_PREVIEW_2024_09_12 -> Known.O1_PREVIEW_2024_09_12
O1_MINI -> Known.O1_MINI
O1_MINI_2024_09_12 -> Known.O1_MINI_2024_09_12
GPT_4O -> Known.GPT_4O
GPT_4O_2024_11_20 -> Known.GPT_4O_2024_11_20
GPT_4O_2024_08_06 -> Known.GPT_4O_2024_08_06
GPT_4O_2024_05_13 -> Known.GPT_4O_2024_05_13
GPT_4O_REALTIME_PREVIEW -> Known.GPT_4O_REALTIME_PREVIEW
GPT_4O_REALTIME_PREVIEW_2024_10_01 -> Known.GPT_4O_REALTIME_PREVIEW_2024_10_01
GPT_4O_AUDIO_PREVIEW -> Known.GPT_4O_AUDIO_PREVIEW
GPT_4O_AUDIO_PREVIEW_2024_10_01 -> Known.GPT_4O_AUDIO_PREVIEW_2024_10_01
CHATGPT_4O_LATEST -> Known.CHATGPT_4O_LATEST
GPT_4O_MINI -> Known.GPT_4O_MINI
GPT_4O_MINI_2024_07_18 -> Known.GPT_4O_MINI_2024_07_18
GPT_4_TURBO -> Known.GPT_4_TURBO
GPT_4_TURBO_2024_04_09 -> Known.GPT_4_TURBO_2024_04_09
GPT_4_0125_PREVIEW -> Known.GPT_4_0125_PREVIEW
GPT_4_TURBO_PREVIEW -> Known.GPT_4_TURBO_PREVIEW
GPT_4_1106_PREVIEW -> Known.GPT_4_1106_PREVIEW
GPT_4_VISION_PREVIEW -> Known.GPT_4_VISION_PREVIEW
GPT_4 -> Known.GPT_4
GPT_4_0314 -> Known.GPT_4_0314
GPT_4_0613 -> Known.GPT_4_0613
GPT_4_32K -> Known.GPT_4_32K
GPT_4_32K_0314 -> Known.GPT_4_32K_0314
GPT_4_32K_0613 -> Known.GPT_4_32K_0613
GPT_3_5_TURBO -> Known.GPT_3_5_TURBO
GPT_3_5_TURBO_16K -> Known.GPT_3_5_TURBO_16K
GPT_3_5_TURBO_0301 -> Known.GPT_3_5_TURBO_0301
GPT_3_5_TURBO_0613 -> Known.GPT_3_5_TURBO_0613
GPT_3_5_TURBO_1106 -> Known.GPT_3_5_TURBO_1106
GPT_3_5_TURBO_0125 -> Known.GPT_3_5_TURBO_0125
GPT_3_5_TURBO_16K_0613 -> Known.GPT_3_5_TURBO_16K_0613
else -> throw OpenAIInvalidDataException("Unknown Model: $value")
}

fun asString(): String = _value().asStringOrThrow()
}

@JsonDeserialize(using = FunctionCall.Deserializer::class)
@JsonSerialize(using = FunctionCall.Serializer::class)
class FunctionCall
Expand Down
Loading

0 comments on commit 8a8f11f

Please sign in to comment.