commonMain.com.xebia.functional.openai.generated.model.FineTuningJobIntegrationsInner.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 Show documentation
Show all versions of xef-openai-client 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.generated.model.CreateFineTuningJobRequestIntegrationsInnerWandb
import com.xebia.functional.openai.generated.model.FineTuningIntegration
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 = FineTuningJobIntegrationsInnerSerializer::class)
sealed interface FineTuningJobIntegrationsInner {
@JvmInline
@Serializable
value class CaseFineTuningIntegration(val value: FineTuningIntegration): FineTuningJobIntegrationsInner
}
object FineTuningJobIntegrationsInnerSerializer : KSerializer {
@OptIn(InternalSerializationApi::class, ExperimentalSerializationApi::class)
override val descriptor: SerialDescriptor = buildSerialDescriptor("FineTuningJobIntegrationsInner", PolymorphicKind.SEALED) {
element("1", FineTuningIntegration.serializer().descriptor)
}
override fun deserialize(decoder: Decoder): FineTuningJobIntegrationsInner {
val jsonSerde = Json { ignoreUnknownKeys = true }
val json = decoder.decodeSerializableValue(JsonElement.serializer())
return attemptDeserialize(json,
Pair(FineTuningJobIntegrationsInner.CaseFineTuningIntegration::class) {
FineTuningJobIntegrationsInner.CaseFineTuningIntegration(jsonSerde.decodeFromJsonElement(FineTuningIntegration.serializer(), json))
})
}
override fun serialize(encoder: Encoder, value: FineTuningJobIntegrationsInner) =
when(value) {
is FineTuningJobIntegrationsInner.CaseFineTuningIntegration ->
encoder.encodeSerializableValue(FineTuningIntegration.serializer(), value.value)
}
}