commonMain.com.xebia.functional.openai.generated.model.CreateThreadAndRunRequestToolsInner.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.AssistantToolsCode
import com.xebia.functional.openai.generated.model.AssistantToolsFileSearch
import com.xebia.functional.openai.generated.model.AssistantToolsFileSearchFileSearch
import com.xebia.functional.openai.generated.model.AssistantToolsFunction
import com.xebia.functional.openai.generated.model.FunctionObject
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 = CreateThreadAndRunRequestToolsInnerSerializer::class)
sealed interface CreateThreadAndRunRequestToolsInner {
@JvmInline
@Serializable
value class CaseAssistantToolsCode(val value: AssistantToolsCode): CreateThreadAndRunRequestToolsInner
@JvmInline
@Serializable
value class CaseAssistantToolsFileSearch(val value: AssistantToolsFileSearch): CreateThreadAndRunRequestToolsInner
@JvmInline
@Serializable
value class CaseAssistantToolsFunction(val value: AssistantToolsFunction): CreateThreadAndRunRequestToolsInner
}
object CreateThreadAndRunRequestToolsInnerSerializer : KSerializer {
@OptIn(InternalSerializationApi::class, ExperimentalSerializationApi::class)
override val descriptor: SerialDescriptor = buildSerialDescriptor("CreateThreadAndRunRequestToolsInner", PolymorphicKind.SEALED) {
element("1", AssistantToolsCode.serializer().descriptor)
element("2", AssistantToolsFileSearch.serializer().descriptor)
element("3", AssistantToolsFunction.serializer().descriptor)
}
override fun deserialize(decoder: Decoder): CreateThreadAndRunRequestToolsInner {
val jsonSerde = Json { ignoreUnknownKeys = true }
val json = decoder.decodeSerializableValue(JsonElement.serializer())
return attemptDeserialize(json,
Pair(CreateThreadAndRunRequestToolsInner.CaseAssistantToolsCode::class) {
CreateThreadAndRunRequestToolsInner.CaseAssistantToolsCode(jsonSerde.decodeFromJsonElement(AssistantToolsCode.serializer(), json))
},
Pair(CreateThreadAndRunRequestToolsInner.CaseAssistantToolsFileSearch::class) {
CreateThreadAndRunRequestToolsInner.CaseAssistantToolsFileSearch(jsonSerde.decodeFromJsonElement(AssistantToolsFileSearch.serializer(), json))
},
Pair(CreateThreadAndRunRequestToolsInner.CaseAssistantToolsFunction::class) {
CreateThreadAndRunRequestToolsInner.CaseAssistantToolsFunction(jsonSerde.decodeFromJsonElement(AssistantToolsFunction.serializer(), json))
})
}
override fun serialize(encoder: Encoder, value: CreateThreadAndRunRequestToolsInner) =
when(value) {
is CreateThreadAndRunRequestToolsInner.CaseAssistantToolsCode ->
encoder.encodeSerializableValue(AssistantToolsCode.serializer(), value.value)
is CreateThreadAndRunRequestToolsInner.CaseAssistantToolsFileSearch ->
encoder.encodeSerializableValue(AssistantToolsFileSearch.serializer(), value.value)
is CreateThreadAndRunRequestToolsInner.CaseAssistantToolsFunction ->
encoder.encodeSerializableValue(AssistantToolsFunction.serializer(), value.value)
}
}