commonMain.com.xebia.functional.openai.generated.model.RunStepDetailsToolCallsObjectToolCallsInner.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.RunStepDetailsToolCallsCodeObject
import com.xebia.functional.openai.generated.model.RunStepDetailsToolCallsCodeObjectCodeInterpreter
import com.xebia.functional.openai.generated.model.RunStepDetailsToolCallsFileSearchObject
import com.xebia.functional.openai.generated.model.RunStepDetailsToolCallsFunctionObject
import com.xebia.functional.openai.generated.model.RunStepDetailsToolCallsFunctionObjectFunction
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 = RunStepDetailsToolCallsObjectToolCallsInnerSerializer::class)
sealed interface RunStepDetailsToolCallsObjectToolCallsInner {
@JvmInline
@Serializable
value class CaseRunStepDetailsToolCallsCodeObject(val value: RunStepDetailsToolCallsCodeObject): RunStepDetailsToolCallsObjectToolCallsInner
@JvmInline
@Serializable
value class CaseRunStepDetailsToolCallsFileSearchObject(val value: RunStepDetailsToolCallsFileSearchObject): RunStepDetailsToolCallsObjectToolCallsInner
@JvmInline
@Serializable
value class CaseRunStepDetailsToolCallsFunctionObject(val value: RunStepDetailsToolCallsFunctionObject): RunStepDetailsToolCallsObjectToolCallsInner
}
object RunStepDetailsToolCallsObjectToolCallsInnerSerializer : KSerializer {
@OptIn(InternalSerializationApi::class, ExperimentalSerializationApi::class)
override val descriptor: SerialDescriptor = buildSerialDescriptor("RunStepDetailsToolCallsObjectToolCallsInner", PolymorphicKind.SEALED) {
element("1", RunStepDetailsToolCallsCodeObject.serializer().descriptor)
element("2", RunStepDetailsToolCallsFileSearchObject.serializer().descriptor)
element("3", RunStepDetailsToolCallsFunctionObject.serializer().descriptor)
}
override fun deserialize(decoder: Decoder): RunStepDetailsToolCallsObjectToolCallsInner {
val jsonSerde = Json { ignoreUnknownKeys = true }
val json = decoder.decodeSerializableValue(JsonElement.serializer())
return attemptDeserialize(json,
Pair(RunStepDetailsToolCallsObjectToolCallsInner.CaseRunStepDetailsToolCallsCodeObject::class) {
RunStepDetailsToolCallsObjectToolCallsInner.CaseRunStepDetailsToolCallsCodeObject(jsonSerde.decodeFromJsonElement(RunStepDetailsToolCallsCodeObject.serializer(), json))
},
Pair(RunStepDetailsToolCallsObjectToolCallsInner.CaseRunStepDetailsToolCallsFileSearchObject::class) {
RunStepDetailsToolCallsObjectToolCallsInner.CaseRunStepDetailsToolCallsFileSearchObject(jsonSerde.decodeFromJsonElement(RunStepDetailsToolCallsFileSearchObject.serializer(), json))
},
Pair(RunStepDetailsToolCallsObjectToolCallsInner.CaseRunStepDetailsToolCallsFunctionObject::class) {
RunStepDetailsToolCallsObjectToolCallsInner.CaseRunStepDetailsToolCallsFunctionObject(jsonSerde.decodeFromJsonElement(RunStepDetailsToolCallsFunctionObject.serializer(), json))
})
}
override fun serialize(encoder: Encoder, value: RunStepDetailsToolCallsObjectToolCallsInner) =
when(value) {
is RunStepDetailsToolCallsObjectToolCallsInner.CaseRunStepDetailsToolCallsCodeObject ->
encoder.encodeSerializableValue(RunStepDetailsToolCallsCodeObject.serializer(), value.value)
is RunStepDetailsToolCallsObjectToolCallsInner.CaseRunStepDetailsToolCallsFileSearchObject ->
encoder.encodeSerializableValue(RunStepDetailsToolCallsFileSearchObject.serializer(), value.value)
is RunStepDetailsToolCallsObjectToolCallsInner.CaseRunStepDetailsToolCallsFunctionObject ->
encoder.encodeSerializableValue(RunStepDetailsToolCallsFunctionObject.serializer(), value.value)
}
}