文件導航

問題

提供狀態,並用物件或字典提出是非、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

一道從具名備選項中選出一個的問題。

詳見 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 的問題。

詳見 score 原語。

欄位:

criteria

pydantic-field

criteria: Sequence[JSONContent]

非空的有序列表,每一項是文本、物件或陣列描述,從零開始每個 score 對應一項。

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]

非空的有序列表,每一項是文本、物件或陣列描述,從零開始每個 score 對應一項。

typesafe_sdk.QuestionModel

module-attribute

QuestionModel: TypeAlias = (
    NoulModel | ChoiceModel | ScoreModel
)

由其 type 鍵標識的問題字典。