问题
提供状态,并通过对象或字典提出 yes/no、choice 和 score 问题。
状态
state 是你想提问所针对的文本或 JSON 对象。它不能为 None,但对象内部的值可以为 None。
问题对象
使用 Noul、Choice 和 Score 以具名参数定义问题。
typesafe_sdk.NoulCriteria
基类:TypedDict
对 yes 与 no 两种结果的可选描述。
详情请参阅 noul 原语。
true
instance-attribute
true
:
JSONContent
|
None
以文本、JSON 对象或数组描述 yes 结果;为 None 则不作描述。
false
instance-attribute
false
:
JSONContent
|
None
以文本、JSON 对象或数组描述 no 结果;为 None 则不作描述。
typesafe_sdk.Noul
pydantic-model
基类:_Question、wire.NoulQuestion
一种 yes/no 问题,可为任一结果提供可选描述。
详情请参阅 noul 原语。
显示 JSON schema:
Details▾
{
"$defs": {
"JSONContent": {
"anyOf": [
{
"type": "string"
},
{
"additionalProperties": {
"anyOf": [
{
"$ref": "#/$defs/JSONValue"
},
{
"type": "null"
}
]
},
"type": "object"
},
{
"items": {
"anyOf": [
{
"$ref": "#/$defs/JSONValue"
},
{
"type": "null"
}
]
},
"type": "array"
}
]
},
"JSONValue": {
"anyOf": [
{
"type": "string"
},
{
"type": "integer"
},
{
"type": "number"
},
{
"type": "boolean"
},
{
"items": {
"anyOf": [
{
"$ref": "#/$defs/JSONValue"
},
{
"type": "null"
}
]
},
"type": "array"
},
{
"additionalProperties": {
"anyOf": [
{
"$ref": "#/$defs/JSONValue"
},
{
"type": "null"
}
]
},
"type": "object"
}
]
},
"NoulCriteria": {
"additionalProperties": false,
"description": "Optional descriptions of the yes and no outcomes.\n\nSee the [noul primitive](https://docs.typesafe.ai/primitives/noul) for details.",
"properties": {
"true": {
"anyOf": [
{
"$ref": "#/$defs/JSONContent"
},
{
"type": "null"
}
]
},
"false": {
"anyOf": [
{
"$ref": "#/$defs/JSONContent"
},
{
"type": "null"
}
]
}
},
"title": "NoulCriteria",
"type": "object"
}
},
"additionalProperties": false,
"description": "A yes/no question with optional descriptions for either outcome.\n\nSee the [noul primitive](https://docs.typesafe.ai/primitives/noul) for details.",
"properties": {
"type": {
"const": "noul",
"default": "noul",
"title": "Type",
"type": "string"
},
"instructions": {
"anyOf": [
{
"$ref": "#/$defs/JSONContent"
},
{
"type": "null"
}
],
"default": null
},
"criteria": {
"anyOf": [
{
"$ref": "#/$defs/NoulCriteria"
},
{
"type": "null"
}
],
"default": null
}
},
"title": "Noul",
"type": "object"
}字段:
type(Literal['noul'])instructions(JSONContent | None)criteria(NoulCriteria | None)
instructions
pydantic-field
instructions
:
JSONContent
|
None
=
None
要提出的问题,以文本、JSON 对象或数组表达;可选。
criteria
pydantic-field
criteria
:
NoulCriteria
|
None
=
None
对 yes 与 no 两种结果的可选描述。
typesafe_sdk.Choice
pydantic-model
基类:_Question、wire.ChoiceQuestion
在具名备选项之间进行选择的问题。
详情请参阅 choice 原语。
显示 JSON schema:
Details▾
{
"$defs": {
"JSONContent": {
"anyOf": [
{
"type": "string"
},
{
"additionalProperties": {
"anyOf": [
{
"$ref": "#/$defs/JSONValue"
},
{
"type": "null"
}
]
},
"type": "object"
},
{
"items": {
"anyOf": [
{
"$ref": "#/$defs/JSONValue"
},
{
"type": "null"
}
]
},
"type": "array"
}
]
},
"JSONValue": {
"anyOf": [
{
"type": "string"
},
{
"type": "integer"
},
{
"type": "number"
},
{
"type": "boolean"
},
{
"items": {
"anyOf": [
{
"$ref": "#/$defs/JSONValue"
},
{
"type": "null"
}
]
},
"type": "array"
},
{
"additionalProperties": {
"anyOf": [
{
"$ref": "#/$defs/JSONValue"
},
{
"type": "null"
}
]
},
"type": "object"
}
]
}
},
"additionalProperties": false,
"description": "A question that selects between named alternatives.\n\nSee the [choice primitive](https://docs.typesafe.ai/primitives/choice) for details.",
"properties": {
"type": {
"const": "choice",
"default": "choice",
"title": "Type",
"type": "string"
},
"instructions": {
"anyOf": [
{
"$ref": "#/$defs/JSONContent"
},
{
"type": "null"
}
],
"default": null
},
"criteria": {
"additionalProperties": {
"anyOf": [
{
"$ref": "#/$defs/JSONContent"
},
{
"type": "null"
}
]
},
"title": "Criteria",
"type": "object"
}
},
"required": [
"criteria"
],
"title": "Choice",
"type": "object"
}字段:
type(Literal['choice'])criteria(Mapping[str, JSONContent | None])instructions(JSONContent | None)
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
使用有序评分标准(rubric)赋予分数的问题。
详情请参阅 score 原语。
显示 JSON schema:
Details▾
{
"$defs": {
"JSONContent": {
"anyOf": [
{
"type": "string"
},
{
"additionalProperties": {
"anyOf": [
{
"$ref": "#/$defs/JSONValue"
},
{
"type": "null"
}
]
},
"type": "object"
},
{
"items": {
"anyOf": [
{
"$ref": "#/$defs/JSONValue"
},
{
"type": "null"
}
]
},
"type": "array"
}
]
},
"JSONValue": {
"anyOf": [
{
"type": "string"
},
{
"type": "integer"
},
{
"type": "number"
},
{
"type": "boolean"
},
{
"items": {
"anyOf": [
{
"$ref": "#/$defs/JSONValue"
},
{
"type": "null"
}
]
},
"type": "array"
},
{
"additionalProperties": {
"anyOf": [
{
"$ref": "#/$defs/JSONValue"
},
{
"type": "null"
}
]
},
"type": "object"
}
]
}
},
"additionalProperties": false,
"description": "A question that assigns a score using an ordered rubric.\n\nSee the [score primitive](https://docs.typesafe.ai/primitives/score) for details.",
"properties": {
"type": {
"const": "score",
"default": "score",
"title": "Type",
"type": "string"
},
"instructions": {
"anyOf": [
{
"$ref": "#/$defs/JSONContent"
},
{
"type": "null"
}
],
"default": null
},
"criteria": {
"items": {
"$ref": "#/$defs/JSONContent"
},
"title": "Criteria",
"type": "array"
}
},
"required": [
"criteria"
],
"title": "Score",
"type": "object"
}字段:
type(Literal['score'])instructions(JSONContent | None)
criteria
pydantic-field
criteria
:
Sequence
[
JSONContent
]
文本、对象或数组描述的非空有序列表,从零开始的每个分值对应一项。
instructions
pydantic-field
instructions
:
JSONContent
|
None
=
None
要提出的问题,以文本、JSON 对象或数组表达;可选。
typesafe_sdk.Question
module-attribute
Question: TypeAlias = (
Noul | Choice | Score | QuestionModel
)
问题对象或问题字典。
typesafe_sdk.Questions
module-attribute
以用于标识其答案的名称为键的问题输入。
问题字典
问题字典包含一个 type 键:"noul"、"choice" 或 "score"。你可以在同一请求中混用字典与问题对象。
typesafe_sdk.NoulModel
基类:TypedDict
带有 type="noul" 的 yes/no 问题字典。
详情请参阅 noul 原语。
type
instance-attribute
type
:
Literal
[
'noul'
]
instructions
instance-attribute
instructions
:
NotRequired
[
JSONContent
|
None
]
要提出的问题,以文本、JSON 对象或数组表达;可选。
criteria
instance-attribute
criteria
:
NotRequired
[
NoulCriteria
|
None
]
对 yes 与 no 两种结果的可选描述。
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
]
文本、对象或数组描述的非空有序列表,从零开始的每个分值对应一项。
typesafe_sdk.QuestionModel
module-attribute
QuestionModel: TypeAlias = (
NoulModel | ChoiceModel | ScoreModel
)
通过其 type 键标识的问题字典。