Skip to content

GuardrailAutomatedReasoningTranslationOption dataclass

Represents one possible logical interpretation of ambiguous input content.

Source code in src/aws_sdk_bedrock_runtime/models.py
2950
2951
2952
2953
2954
2955
2956
2957
2958
2959
2960
2961
2962
2963
2964
2965
2966
2967
2968
2969
2970
2971
2972
2973
2974
2975
2976
2977
2978
2979
2980
2981
2982
2983
2984
2985
2986
2987
2988
2989
2990
2991
2992
2993
2994
2995
2996
2997
2998
2999
3000
3001
3002
@dataclass(kw_only=True)
class GuardrailAutomatedReasoningTranslationOption:
    """Represents one possible logical interpretation of ambiguous input
    content.
    """

    translations: list[GuardrailAutomatedReasoningTranslation] | None = None
    """Example translations that provide this possible interpretation of the
    input.
    """

    def serialize(self, serializer: ShapeSerializer):
        serializer.write_struct(
            _SCHEMA_GUARDRAIL_AUTOMATED_REASONING_TRANSLATION_OPTION, self
        )

    def serialize_members(self, serializer: ShapeSerializer):
        if self.translations is not None:
            _serialize_guardrail_automated_reasoning_translation_list(
                serializer,
                _SCHEMA_GUARDRAIL_AUTOMATED_REASONING_TRANSLATION_OPTION.members[
                    "translations"
                ],
                self.translations,
            )

    @classmethod
    def deserialize(cls, deserializer: ShapeDeserializer) -> Self:
        return cls(**cls.deserialize_kwargs(deserializer))

    @classmethod
    def deserialize_kwargs(cls, deserializer: ShapeDeserializer) -> dict[str, Any]:
        kwargs: dict[str, Any] = {}

        def _consumer(schema: Schema, de: ShapeDeserializer) -> None:
            match schema.expect_member_index():
                case 0:
                    kwargs["translations"] = (
                        _deserialize_guardrail_automated_reasoning_translation_list(
                            de,
                            _SCHEMA_GUARDRAIL_AUTOMATED_REASONING_TRANSLATION_OPTION.members[
                                "translations"
                            ],
                        )
                    )

                case _:
                    logger.debug("Unexpected member schema: %s", schema)

        deserializer.read_struct(
            _SCHEMA_GUARDRAIL_AUTOMATED_REASONING_TRANSLATION_OPTION, consumer=_consumer
        )
        return kwargs

Attributes

translations class-attribute instance-attribute

translations: list[GuardrailAutomatedReasoningTranslation] | None = None

Example translations that provide this possible interpretation of the input.