All Downloads are FREE. Search and download functionalities are using the official Maven repository.

commonMain.aws.sdk.kotlin.services.bedrockagent.serde.PromptConfigurationDocumentDeserializer.kt Maven / Gradle / Ivy

There is a newer version: 1.3.77
Show newest version
// Code generated by smithy-kotlin-codegen. DO NOT EDIT!

package aws.sdk.kotlin.services.bedrockagent.serde

import aws.sdk.kotlin.services.bedrockagent.model.CreationMode
import aws.sdk.kotlin.services.bedrockagent.model.PromptConfiguration
import aws.sdk.kotlin.services.bedrockagent.model.PromptState
import aws.sdk.kotlin.services.bedrockagent.model.PromptType
import aws.smithy.kotlin.runtime.serde.Deserializer
import aws.smithy.kotlin.runtime.serde.SdkFieldDescriptor
import aws.smithy.kotlin.runtime.serde.SdkObjectDescriptor
import aws.smithy.kotlin.runtime.serde.SerialKind
import aws.smithy.kotlin.runtime.serde.asSdkSerializable
import aws.smithy.kotlin.runtime.serde.deserializeList
import aws.smithy.kotlin.runtime.serde.deserializeMap
import aws.smithy.kotlin.runtime.serde.deserializeStruct
import aws.smithy.kotlin.runtime.serde.field
import aws.smithy.kotlin.runtime.serde.json.JsonDeserializer
import aws.smithy.kotlin.runtime.serde.json.JsonSerialName
import aws.smithy.kotlin.runtime.serde.serializeList
import aws.smithy.kotlin.runtime.serde.serializeMap
import aws.smithy.kotlin.runtime.serde.serializeStruct

internal fun deserializePromptConfigurationDocument(deserializer: Deserializer): PromptConfiguration {
    val builder = PromptConfiguration.Builder()
    val BASEPROMPTTEMPLATE_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("basePromptTemplate"))
    val INFERENCECONFIGURATION_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Struct, JsonSerialName("inferenceConfiguration"))
    val PARSERMODE_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Enum, JsonSerialName("parserMode"))
    val PROMPTCREATIONMODE_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Enum, JsonSerialName("promptCreationMode"))
    val PROMPTSTATE_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Enum, JsonSerialName("promptState"))
    val PROMPTTYPE_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Enum, JsonSerialName("promptType"))
    val OBJ_DESCRIPTOR = SdkObjectDescriptor.build {
        field(BASEPROMPTTEMPLATE_DESCRIPTOR)
        field(INFERENCECONFIGURATION_DESCRIPTOR)
        field(PARSERMODE_DESCRIPTOR)
        field(PROMPTCREATIONMODE_DESCRIPTOR)
        field(PROMPTSTATE_DESCRIPTOR)
        field(PROMPTTYPE_DESCRIPTOR)
    }

    deserializer.deserializeStruct(OBJ_DESCRIPTOR) {
        loop@while (true) {
            when (findNextFieldIndex()) {
                BASEPROMPTTEMPLATE_DESCRIPTOR.index -> builder.basePromptTemplate = deserializeString()
                INFERENCECONFIGURATION_DESCRIPTOR.index -> builder.inferenceConfiguration = deserializeInferenceConfigurationDocument(deserializer)
                PARSERMODE_DESCRIPTOR.index -> builder.parserMode = deserializeString().let { CreationMode.fromValue(it) }
                PROMPTCREATIONMODE_DESCRIPTOR.index -> builder.promptCreationMode = deserializeString().let { CreationMode.fromValue(it) }
                PROMPTSTATE_DESCRIPTOR.index -> builder.promptState = deserializeString().let { PromptState.fromValue(it) }
                PROMPTTYPE_DESCRIPTOR.index -> builder.promptType = deserializeString().let { PromptType.fromValue(it) }
                null -> break@loop
                else -> skipValue()
            }
        }
    }
    builder.correctErrors()
    return builder.build()
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy