A question to ask the user.
Question()| Name | Type |
|---|---|
| question | Annotated[str, AfterValidator(_validate_question_text), Field(description='The question text to display.', min_length=1)] |
| type | Annotated[QuestionType, Field(description='Question type. \'text\' for free-form input, \'multiple_choice\' for picking exactly one predefined option, \'multi_select\' for picking one or more predefined options. Both choice types always append an \'Other\' free-form option automatically; multi-select can accept multiple custom Other values (filling one reveals another). A \'multi_select\' answer comes back as a JSON array of the selected values (including any custom Other text), e.g. ["a", "b"]; if nothing is selected on an optional question the answer is [].')] |
| choices | NotRequired[Annotated[list[Annotated[Choice, AfterValidator(_validate_choice)]], Field(description="Options for 'multiple_choice' and 'multi_select' questions. Every choice needs a non-empty 'value'. An 'Other' free-form option is always appended automatically for both types; multi-select may collect multiple custom Other values. A 'multi_select' answer is a JSON array of the selected values, so values (including custom Other text) may contain commas, quotes, and newlines.")]] |
| required | NotRequired[Annotated[bool, Field(description='Whether the user must answer. Defaults to true if omitted.', strict=True)]] |