Skip to content

RatingScaleItemValue

rboto-bedrock==0.4.0 · Service index · Types

Public import: from rboto_bedrock.types import RatingScaleItemValue.

Used in: input. Type alias. Union variants and nested values are linked below.

RatingScaleItemValue: TypeAlias = RatingScaleItemValuestringValue | RatingScaleItemValuefloatValue

Selecting a variant

Each variant has exactly one declared key. Checking that key narrows the type without a cast or a custom type guard. Handle other variants according to your application, including unknown for output unions.

from rboto_bedrock.types import RatingScaleItemValue


def handle(value: RatingScaleItemValue) -> None:
    if 'float_value' in value:
        # value is RatingScaleItemValuefloatValue; this field has type float.
        print(value['float_value'])

Union typing and checker requirements.

RatingScaleItemValuefloatValue, RatingScaleItemValuestringValue