Skip to content

GuardrailAutomatedReasoningLogicWarning dataclass

Identifies logical issues in the translated statements that exist independent of any policy rules, such as statements that are always true or always false.

Source code in src/aws_sdk_bedrock_runtime/models.py
2185
2186
2187
2188
2189
2190
2191
2192
2193
2194
2195
2196
2197
2198
2199
2200
2201
2202
2203
2204
2205
2206
2207
2208
2209
2210
2211
2212
2213
2214
2215
2216
2217
2218
2219
2220
2221
2222
2223
2224
2225
2226
2227
2228
2229
2230
2231
2232
2233
2234
2235
2236
2237
2238
2239
2240
2241
2242
2243
2244
2245
2246
2247
2248
2249
2250
2251
2252
2253
2254
2255
2256
2257
2258
2259
2260
2261
2262
2263
2264
2265
2266
2267
2268
2269
2270
2271
2272
2273
2274
2275
2276
@dataclass(kw_only=True)
class GuardrailAutomatedReasoningLogicWarning:
    """Identifies logical issues in the translated statements that exist
    independent of any policy rules, such as statements that are always true
    or always false.
    """

    type: str | None = None
    """The category of the detected logical issue, such as statements that are
    always true or always false.
    """

    premises: list[GuardrailAutomatedReasoningStatement] | None = None
    """The logical statements that serve as premises under which the claims are
    validated.
    """

    claims: list[GuardrailAutomatedReasoningStatement] | None = None
    """The logical statements that are validated while assuming the policy and
    premises.
    """

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

    def serialize_members(self, serializer: ShapeSerializer):
        if self.type is not None:
            serializer.write_string(
                _SCHEMA_GUARDRAIL_AUTOMATED_REASONING_LOGIC_WARNING.members["type"],
                self.type,
            )

        if self.premises is not None:
            _serialize_guardrail_automated_reasoning_statement_list(
                serializer,
                _SCHEMA_GUARDRAIL_AUTOMATED_REASONING_LOGIC_WARNING.members["premises"],
                self.premises,
            )

        if self.claims is not None:
            _serialize_guardrail_automated_reasoning_statement_list(
                serializer,
                _SCHEMA_GUARDRAIL_AUTOMATED_REASONING_LOGIC_WARNING.members["claims"],
                self.claims,
            )

    @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["type"] = de.read_string(
                        _SCHEMA_GUARDRAIL_AUTOMATED_REASONING_LOGIC_WARNING.members[
                            "type"
                        ]
                    )

                case 1:
                    kwargs["premises"] = (
                        _deserialize_guardrail_automated_reasoning_statement_list(
                            de,
                            _SCHEMA_GUARDRAIL_AUTOMATED_REASONING_LOGIC_WARNING.members[
                                "premises"
                            ],
                        )
                    )

                case 2:
                    kwargs["claims"] = (
                        _deserialize_guardrail_automated_reasoning_statement_list(
                            de,
                            _SCHEMA_GUARDRAIL_AUTOMATED_REASONING_LOGIC_WARNING.members[
                                "claims"
                            ],
                        )
                    )

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

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

Attributes

claims class-attribute instance-attribute

claims: list[GuardrailAutomatedReasoningStatement] | None = None

The logical statements that are validated while assuming the policy and premises.

premises class-attribute instance-attribute

premises: list[GuardrailAutomatedReasoningStatement] | None = None

The logical statements that serve as premises under which the claims are validated.

type class-attribute instance-attribute

type: str | None = None

The category of the detected logical issue, such as statements that are always true or always false.