commonMain.com.xebia.functional.openai.generated.model.CreateEmbeddingRequestModel.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-jvm Show documentation
Show all versions of xef-openai-client-jvm 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 kotlinx.serialization.*
import kotlinx.serialization.builtins.*
import kotlinx.serialization.encoding.*
import kotlin.jvm.JvmStatic
import com.xebia.functional.openai.generated.model.CreateEmbeddingRequestModel.Supported.text_embedding_ada_002
import com.xebia.functional.openai.generated.model.CreateEmbeddingRequestModel.Supported.text_embedding_3_small
import com.xebia.functional.openai.generated.model.CreateEmbeddingRequestModel.Supported.text_embedding_3_large
/**
* ID of the model to use. You can use the [List models](/docs/api-reference/models/list) API to see all of your available models, or see our [Model overview](/docs/models/overview) for descriptions of them.
*/
// We define a serializer for the parent sum type, and then use it to serialize the child types
@Suppress("SERIALIZER_TYPE_INCOMPATIBLE")
@Serializable(with = CreateEmbeddingRequestModelSerializer::class)
sealed interface CreateEmbeddingRequestModel {
val value: kotlin.String
@Serializable(with = CreateEmbeddingRequestModelSerializer::class)
enum class Supported(override val value: kotlin.String) : CreateEmbeddingRequestModel {
@SerialName(value = "text-embedding-ada-002") text_embedding_ada_002("text-embedding-ada-002"),@SerialName(value = "text-embedding-3-small") text_embedding_3_small("text-embedding-3-small"),@SerialName(value = "text-embedding-3-large") text_embedding_3_large("text-embedding-3-large");
override fun toString(): kotlin.String = value
}
@Serializable(with = CreateEmbeddingRequestModelSerializer::class)
data class Custom(override val value: kotlin.String) : CreateEmbeddingRequestModel
companion object {
@JvmStatic
fun valueOf(value: kotlin.String): CreateEmbeddingRequestModel =
values().firstOrNull { it.value == value } ?: Custom(value)
inline val text_embedding_ada_002: CreateEmbeddingRequestModel
get() = Supported.text_embedding_ada_002
inline val text_embedding_3_small: CreateEmbeddingRequestModel
get() = Supported.text_embedding_3_small
inline val text_embedding_3_large: CreateEmbeddingRequestModel
get() = Supported.text_embedding_3_large
@JvmStatic fun values(): List = Supported.entries
}
}
object CreateEmbeddingRequestModelSerializer : KSerializer {
private val valueSerializer = kotlin.String.serializer()
override val descriptor = valueSerializer.descriptor
override fun deserialize(decoder: Decoder): CreateEmbeddingRequestModel {
val value = decoder.decodeSerializableValue(valueSerializer)
return CreateEmbeddingRequestModel.valueOf(value)
}
override fun serialize(encoder: Encoder, value: CreateEmbeddingRequestModel) {
encoder.encodeSerializableValue(valueSerializer, value.value)
}
}