commonMain.com.xebia.functional.openai.generated.model.CreateFineTuningJobRequestHyperparametersLearningRateMultiplier.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of xef-openai-client-jvm Show documentation
Show all versions of xef-openai-client-jvm Show documentation
Building applications with LLMs through composability in Kotlin
/**
*
* Please note:
* This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* Do not edit this file manually.
*
*/
@file:Suppress(
"ArrayInDataClass",
"EnumEntryName",
"RemoveRedundantQualifierName",
"UnusedImport"
)
package com.xebia.functional.openai.generated.model
import com.xebia.functional.openai.attemptDeserialize
import kotlin.jvm.JvmInline
import kotlinx.serialization.*
import kotlinx.serialization.builtins.*
import kotlinx.serialization.descriptors.*
import kotlinx.serialization.encoding.*
import kotlinx.serialization.json.*
@Serializable(with = CreateFineTuningJobRequestHyperparametersLearningRateMultiplierSerializer::class)
sealed interface CreateFineTuningJobRequestHyperparametersLearningRateMultiplier {
@JvmInline
@Serializable
value class CaseDouble(val value: kotlin.Double): CreateFineTuningJobRequestHyperparametersLearningRateMultiplier
@JvmInline
@Serializable
value class CaseString(val value: kotlin.String): CreateFineTuningJobRequestHyperparametersLearningRateMultiplier
}
object CreateFineTuningJobRequestHyperparametersLearningRateMultiplierSerializer : KSerializer {
@OptIn(InternalSerializationApi::class, ExperimentalSerializationApi::class)
override val descriptor: SerialDescriptor = buildSerialDescriptor("CreateFineTuningJobRequestHyperparametersLearningRateMultiplier", PolymorphicKind.SEALED) {
element("1", kotlin.Double.serializer().descriptor)
element("2", kotlin.String.serializer().descriptor)
}
override fun deserialize(decoder: Decoder): CreateFineTuningJobRequestHyperparametersLearningRateMultiplier {
val jsonSerde = Json { ignoreUnknownKeys = true }
val json = decoder.decodeSerializableValue(JsonElement.serializer())
return attemptDeserialize(json,
Pair(CreateFineTuningJobRequestHyperparametersLearningRateMultiplier.CaseDouble::class) {
CreateFineTuningJobRequestHyperparametersLearningRateMultiplier.CaseDouble(jsonSerde.decodeFromJsonElement(kotlin.Double.serializer(), json))
},
Pair(CreateFineTuningJobRequestHyperparametersLearningRateMultiplier.CaseString::class) {
CreateFineTuningJobRequestHyperparametersLearningRateMultiplier.CaseString(jsonSerde.decodeFromJsonElement(kotlin.String.serializer(), json))
})
}
override fun serialize(encoder: Encoder, value: CreateFineTuningJobRequestHyperparametersLearningRateMultiplier) =
when(value) {
is CreateFineTuningJobRequestHyperparametersLearningRateMultiplier.CaseDouble ->
encoder.encodeSerializableValue(kotlin.Double.serializer(), value.value)
is CreateFineTuningJobRequestHyperparametersLearningRateMultiplier.CaseString ->
encoder.encodeSerializableValue(kotlin.String.serializer(), value.value)
}
}