ドキュメント

質問

質問

状態を渡し、オブジェクトまたは辞書で yes/no・choice・score の質問をします。

状態

state は、質問したい対象のテキストまたは JSON オブジェクトです。None にはできませんが、オブジェクト内の値は None でかまいません。

質問オブジェクト

Noul、Choice、Score を使って、名前付き引数で質問を定義します。

typesafe_sdk.NoulCriteria

基底:TypedDict

「はい」と「いいえ」の結果の任意の説明。

詳しくは noul プリミティブ を参照してください。

true

instance-attribute

true: JSONContent | None

「はい」の結果の説明。テキスト、JSON オブジェクト、または配列で記述します。None なら説明なしのままです。

false

instance-attribute

false: JSONContent | None

「いいえ」の結果の説明。テキスト、JSON オブジェクト、または配列で記述します。None なら説明なしのままです。

typesafe_sdk.Noul

pydantic-model

基底:_Question, wire.NoulQuestion

はい/いいえの質問。どちらの結果についても任意の説明を付けられます。

詳しくは noul プリミティブ を参照してください。

フィールド:

instructions

pydantic-field

instructions: JSONContent | None = None

尋ねる質問。テキスト、JSON オブジェクト、または配列で記述します。任意です。

criteria

pydantic-field

criteria: NoulCriteria | None = None

「はい」と「いいえ」の結果の任意の説明。

typesafe_sdk.Choice

pydantic-model

基底:_Question, wire.ChoiceQuestion

名前を付けた選択肢の中から 1 つを選ぶ質問。

詳しくは choice プリミティブ を参照してください。

フィールド:

criteria

pydantic-field

criteria: Mapping[str, JSONContent | None]

ラベルからテキスト・オブジェクト・配列の説明へのマッピング。説明のないラベルには None。

instructions

pydantic-field

instructions: JSONContent | None = None

尋ねる質問。テキスト、JSON オブジェクト、または配列で記述します。任意です。

typesafe_sdk.Score

pydantic-model

基底:_Question, wire.ScoreQuestion

順序付きのルーブリックを使ってスコアを割り当てる質問。

詳しくは score プリミティブ を参照してください。

フィールド:

criteria

pydantic-field

criteria: Sequence[JSONContent]

テキスト・オブジェクト・配列の説明の、空でない順序付きリスト。0 から順にスコアごとに 1 つ。

instructions

pydantic-field

instructions: JSONContent | None = None

尋ねる質問。テキスト、JSON オブジェクト、または配列で記述します。任意です。

typesafe_sdk.Question

module-attribute

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

質問オブジェクトまたは質問辞書。

typesafe_sdk.Questions

module-attribute

Questions: TypeAlias = Mapping[str, Question]

質問の入力。答えを識別する名前をキーにします。

質問辞書

質問辞書には type キーが含まれます:"noul"、"choice"、"score" のいずれかです。同じリクエストで辞書と質問オブジェクトを混ぜられます。

typesafe_sdk.NoulModel

基底:TypedDict

type="noul" のはい/いいえの質問辞書。

詳しくは noul プリミティブ を参照してください。

type

instance-attribute

type: Literal['noul']

instructions

instance-attribute

instructions: NotRequired[JSONContent | None]

尋ねる質問。テキスト、JSON オブジェクト、または配列で記述します。任意です。

criteria

instance-attribute

criteria: NotRequired[NoulCriteria | None]

「はい」と「いいえ」の結果の任意の説明。

typesafe_sdk.ChoiceModel

基底:TypedDict

type="choice" の choice 質問辞書。

詳しくは choice プリミティブ を参照してください。

type

instance-attribute

type: Literal['choice']

instructions

instance-attribute

instructions: NotRequired[JSONContent | None]

尋ねる質問。テキスト、JSON オブジェクト、または配列で記述します。任意です。

criteria

instance-attribute

criteria: Mapping[str, JSONContent | None]

ラベルからテキスト・オブジェクト・配列の説明へのマッピング。説明のないラベルには None。

typesafe_sdk.ScoreModel

基底:TypedDict

type="score" の score 質問辞書。

詳しくは score プリミティブ を参照してください。

type

instance-attribute

type: Literal['score']

instructions

instance-attribute

instructions: NotRequired[JSONContent | None]

尋ねる質問。テキスト、JSON オブジェクト、または配列で記述します。任意です。

criteria

instance-attribute

criteria: Sequence[JSONContent]

テキスト・オブジェクト・配列の説明の、空でない順序付きリスト。0 から順にスコアごとに 1 つ。

typesafe_sdk.QuestionModel

module-attribute

QuestionModel: TypeAlias = (
    NoulModel | ChoiceModel | ScoreModel
)

type キーで識別される質問辞書。