commonMain.com.xebia.functional.openai.generated.model.RunStepDeltaStepDetailsToolCallsObjectToolCallsInner.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.RunStepDeltaStepDetailsToolCallsCodeObject
import com.xebia.functional.openai.generated.model.RunStepDeltaStepDetailsToolCallsCodeObjectCodeInterpreter
import com.xebia.functional.openai.generated.model.RunStepDeltaStepDetailsToolCallsFileSearchObject
import com.xebia.functional.openai.generated.model.RunStepDeltaStepDetailsToolCallsFunctionObject
import com.xebia.functional.openai.generated.model.RunStepDeltaStepDetailsToolCallsFunctionObjectFunction
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 = RunStepDeltaStepDetailsToolCallsObjectToolCallsInnerSerializer::class)
sealed interface RunStepDeltaStepDetailsToolCallsObjectToolCallsInner {
@JvmInline
@Serializable
value class CaseRunStepDeltaStepDetailsToolCallsCodeObject(val value: RunStepDeltaStepDetailsToolCallsCodeObject): RunStepDeltaStepDetailsToolCallsObjectToolCallsInner
@JvmInline
@Serializable
value class CaseRunStepDeltaStepDetailsToolCallsFileSearchObject(val value: RunStepDeltaStepDetailsToolCallsFileSearchObject): RunStepDeltaStepDetailsToolCallsObjectToolCallsInner
@JvmInline
@Serializable
value class CaseRunStepDeltaStepDetailsToolCallsFunctionObject(val value: RunStepDeltaStepDetailsToolCallsFunctionObject): RunStepDeltaStepDetailsToolCallsObjectToolCallsInner
}
object RunStepDeltaStepDetailsToolCallsObjectToolCallsInnerSerializer : KSerializer {
@OptIn(InternalSerializationApi::class, ExperimentalSerializationApi::class)
override val descriptor: SerialDescriptor = buildSerialDescriptor("RunStepDeltaStepDetailsToolCallsObjectToolCallsInner", PolymorphicKind.SEALED) {
element("1", RunStepDeltaStepDetailsToolCallsCodeObject.serializer().descriptor)
element("2", RunStepDeltaStepDetailsToolCallsFileSearchObject.serializer().descriptor)
element("3", RunStepDeltaStepDetailsToolCallsFunctionObject.serializer().descriptor)
}
override fun deserialize(decoder: Decoder): RunStepDeltaStepDetailsToolCallsObjectToolCallsInner {
val jsonSerde = Json { ignoreUnknownKeys = true }
val json = decoder.decodeSerializableValue(JsonElement.serializer())
return attemptDeserialize(json,
Pair(RunStepDeltaStepDetailsToolCallsObjectToolCallsInner.CaseRunStepDeltaStepDetailsToolCallsCodeObject::class) {
RunStepDeltaStepDetailsToolCallsObjectToolCallsInner.CaseRunStepDeltaStepDetailsToolCallsCodeObject(jsonSerde.decodeFromJsonElement(RunStepDeltaStepDetailsToolCallsCodeObject.serializer(), json))
},
Pair(RunStepDeltaStepDetailsToolCallsObjectToolCallsInner.CaseRunStepDeltaStepDetailsToolCallsFileSearchObject::class) {
RunStepDeltaStepDetailsToolCallsObjectToolCallsInner.CaseRunStepDeltaStepDetailsToolCallsFileSearchObject(jsonSerde.decodeFromJsonElement(RunStepDeltaStepDetailsToolCallsFileSearchObject.serializer(), json))
},
Pair(RunStepDeltaStepDetailsToolCallsObjectToolCallsInner.CaseRunStepDeltaStepDetailsToolCallsFunctionObject::class) {
RunStepDeltaStepDetailsToolCallsObjectToolCallsInner.CaseRunStepDeltaStepDetailsToolCallsFunctionObject(jsonSerde.decodeFromJsonElement(RunStepDeltaStepDetailsToolCallsFunctionObject.serializer(), json))
})
}
override fun serialize(encoder: Encoder, value: RunStepDeltaStepDetailsToolCallsObjectToolCallsInner) =
when(value) {
is RunStepDeltaStepDetailsToolCallsObjectToolCallsInner.CaseRunStepDeltaStepDetailsToolCallsCodeObject ->
encoder.encodeSerializableValue(RunStepDeltaStepDetailsToolCallsCodeObject.serializer(), value.value)
is RunStepDeltaStepDetailsToolCallsObjectToolCallsInner.CaseRunStepDeltaStepDetailsToolCallsFileSearchObject ->
encoder.encodeSerializableValue(RunStepDeltaStepDetailsToolCallsFileSearchObject.serializer(), value.value)
is RunStepDeltaStepDetailsToolCallsObjectToolCallsInner.CaseRunStepDeltaStepDetailsToolCallsFunctionObject ->
encoder.encodeSerializableValue(RunStepDeltaStepDetailsToolCallsFunctionObject.serializer(), value.value)
}
}