Docs

Questions

Questions

Provide state and ask yes/no, choice, and score questions using objects or dictionaries.

State

state is the text or JSON object you want to ask questions about. It cannot be None, but values inside an object may be None.

Question objects

Use Noul, Choice, and Score to define questions with named arguments.

typesafe_sdk.NoulCriteria

Bases: TypedDict

Optional descriptions of the yes and no outcomes.

See the noul primitive for details.

true

instance-attribute

true: JSONContent | None

Description of the yes outcome as text, a JSON object, or an array; None leaves it undescribed.

false

instance-attribute

false: JSONContent | None

Description of the no outcome as text, a JSON object, or an array; None leaves it undescribed.

typesafe_sdk.Noul

pydantic-model

Bases: _Question, wire.NoulQuestion

A yes/no question with optional descriptions for either outcome.

See the noul primitive for details.

Fields:

instructions

pydantic-field

instructions: JSONContent | None = None

The question to ask, expressed as text, a JSON object, or an array; optional.

criteria

pydantic-field

criteria: NoulCriteria | None = None

Optional descriptions of the yes and no outcomes.

typesafe_sdk.Choice

pydantic-model

Bases: _Question, wire.ChoiceQuestion

A question that selects between named alternatives.

See the choice primitive for details.

Fields:

criteria

pydantic-field

criteria: Mapping[str, JSONContent | None]

Labels mapped to text, object, or array descriptions, or None for undescribed labels.

instructions

pydantic-field

instructions: JSONContent | None = None

The question to ask, expressed as text, a JSON object, or an array; optional.

typesafe_sdk.Score

pydantic-model

Bases: _Question, wire.ScoreQuestion

A question that assigns a score using an ordered rubric.

See the score primitive for details.

Fields:

criteria

pydantic-field

criteria: Sequence[JSONContent]

A nonempty, ordered list of text, object, or array descriptions, one per score from zero.

instructions

pydantic-field

instructions: JSONContent | None = None

The question to ask, expressed as text, a JSON object, or an array; optional.

typesafe_sdk.Question

module-attribute

Question: TypeAlias = (
    Noul | Choice | Score | QuestionModel
)

A question object or question dictionary.

typesafe_sdk.Questions

module-attribute

Questions: TypeAlias = Mapping[str, Question]

Question inputs keyed by the names used to identify their answers.

Question dictionaries

Question dictionaries include a type key: "noul", "choice", or "score". You can mix dictionaries and question objects in the same request.

typesafe_sdk.NoulModel

Bases: TypedDict

A yes/no question dictionary with type="noul".

See the noul primitive for details.

type

instance-attribute

type: Literal['noul']

instructions

instance-attribute

instructions: NotRequired[JSONContent | None]

The question to ask, expressed as text, a JSON object, or an array; optional.

criteria

instance-attribute

criteria: NotRequired[NoulCriteria | None]

Optional descriptions of the yes and no outcomes.

typesafe_sdk.ChoiceModel

Bases: TypedDict

A choice question dictionary with type="choice".

See the choice primitive for details.

type

instance-attribute

type: Literal['choice']

instructions

instance-attribute

instructions: NotRequired[JSONContent | None]

The question to ask, expressed as text, a JSON object, or an array; optional.

criteria

instance-attribute

criteria: Mapping[str, JSONContent | None]

Labels mapped to text, object, or array descriptions, or None for undescribed labels.

typesafe_sdk.ScoreModel

Bases: TypedDict

A score question dictionary with type="score".

See the score primitive for details.

type

instance-attribute

type: Literal['score']

instructions

instance-attribute

instructions: NotRequired[JSONContent | None]

The question to ask, expressed as text, a JSON object, or an array; optional.

criteria

instance-attribute

criteria: Sequence[JSONContent]

A nonempty, ordered list of text, object, or array descriptions, one per score from zero.

typesafe_sdk.QuestionModel

module-attribute

QuestionModel: TypeAlias = (
    NoulModel | ChoiceModel | ScoreModel
)

A question dictionary identified by its type key.