状态
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 原语。
显示 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
对“是”与“否”两种结果的可选描述。
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
使用有序评分标准打分的问题。
详情参见 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'])criteria(Sequence[JSONContent])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" 的是/否问题字典。
详情参见 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 原语。
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 原语。
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 键标识的问题字典。