All Downloads are FREE. Search and download functionalities are using the official Maven repository.

commonMain.com.xebia.functional.openai.generated.model.FineTuningJobHyperparametersNEpochs.kt Maven / Gradle / Ivy

There is a newer version: 0.0.5-alpha.118
Show newest version
/**
 *
 * 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 = FineTuningJobHyperparametersNEpochsSerializer::class)
sealed interface FineTuningJobHyperparametersNEpochs {

  @JvmInline
  @Serializable
  value class CaseInt(val value: kotlin.Int): FineTuningJobHyperparametersNEpochs
  @JvmInline
  @Serializable
  value class CaseString(val value: kotlin.String): FineTuningJobHyperparametersNEpochs

}

object FineTuningJobHyperparametersNEpochsSerializer : KSerializer {
    @OptIn(InternalSerializationApi::class, ExperimentalSerializationApi::class)
    override val descriptor: SerialDescriptor = buildSerialDescriptor("FineTuningJobHyperparametersNEpochs", PolymorphicKind.SEALED) { 
      element("1", kotlin.Int.serializer().descriptor)
      element("2", kotlin.String.serializer().descriptor)
    }

    override fun deserialize(decoder: Decoder): FineTuningJobHyperparametersNEpochs {
      val jsonSerde = Json { ignoreUnknownKeys = true }
      val json = decoder.decodeSerializableValue(JsonElement.serializer())
      return attemptDeserialize(json, 
        Pair(FineTuningJobHyperparametersNEpochs.CaseInt::class) {
          FineTuningJobHyperparametersNEpochs.CaseInt(jsonSerde.decodeFromJsonElement(kotlin.Int.serializer(), json))
      },
        Pair(FineTuningJobHyperparametersNEpochs.CaseString::class) {
          FineTuningJobHyperparametersNEpochs.CaseString(jsonSerde.decodeFromJsonElement(kotlin.String.serializer(), json))
      })
    }

    override fun serialize(encoder: Encoder, value: FineTuningJobHyperparametersNEpochs) =
      when(value) { 
        is FineTuningJobHyperparametersNEpochs.CaseInt ->
        encoder.encodeSerializableValue(kotlin.Int.serializer(), value.value)

        is FineTuningJobHyperparametersNEpochs.CaseString ->
        encoder.encodeSerializableValue(kotlin.String.serializer(), value.value)
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy