机器翻译·译自英文(docs.typesafe.ai)·本页 314 段已全部译完
在以下地址获取完整的文档索引:https://docs.typesafe.ai/llms.txt
使用此文件可以在进一步探索之前发现所有可用页面。
提供状态,并使用对象或字典提出是/否、Choice 和 Score 问题。
状态
state 是你想要询问相关问题的文本或 JSON 对象。它不能为 None,但对象内部的值可以为 None。
问题对象
使用 Noul、Choice 和 Score 定义具有命名参数的问题。
typesafe_sdk.NoulCriteria 类
基类:TypedDict
肯定和否定结果的可选描述。
详见 noul 原语。
true
instance-attribute
作为文本、JSON 对象或数组的肯定结果描述;None 表示未描述。
false
instance-attribute
false: JSONContent | None
对否定答案结果的描述,可以是文本、JSON 对象或数组;None 表示未描述。
typesafe_sdk.Noul
pydantic-model
基类:_Question, wire.NoulQuestion
一个“是/否”问题,可以为任一结果提供可选的描述。
详见 noul 原语。
Note
显示 JSON 架构:
{
"$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": "是和否结果的可选描述。\n\n详见 [noul primitive](https://docs.typesafe.ai/primitives/noul)。",
"properties": {
"true": {
"anyOf": [
{
"$ref": "#/$defs/JSONContent"
},
{
"type": "null"
}
]
},
"false": {
"anyOf": [
{
"$ref": "#/$defs/JSONContent"
},
{
"type": "null"
}
]
}
},
"title": "NoulCriteria",
"type": "object"
}
},
"additionalProperties": false,
"description": "一个带有结果可选描述的是/否问题。\n\n详见 [noul primitive](https://docs.typesafe.ai/primitives/noul)。",
"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"
}
字段:
instructions
pydantic-field
instructions: JSONContent | None = None
要提出的问题,表达为文本、JSON 对象或数组;可选。
criteria
pydantic-field
criteria: NoulCriteria | None = None
肯定和否定结果的可选描述。
typesafe_sdk.Choice 类
pydantic-model
基类:_Question、wire.ChoiceQuestion
在命名选项之间进行选择的问题。
详见 choice 原语。
Note
显示 JSON 架构:
{
"$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": "从命名选项中选择的问题。\n\n详见[选择原语](https://docs.typesafe.ai/primitives/choice)。",
"properties": {
"type": {
"const": "choice",
"default": "choice",
"title": "类型",
"type": "string"
},
"instructions": {
"anyOf": [
{
"$ref": "#/$defs/JSONContent"
},
{
"type": "null"
}
],
"default": null
},
"criteria": {
"additionalProperties": {
"anyOf": [
{
"$ref": "#/$defs/JSONContent"
},
{
"type": "null"
}
]
},
"title": "标准",
"type": "object"
}
},
"required": [
"criteria"
],
"title": "选择性",
"type": "object"
}
字段:
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 原语。
Note
显示 JSON 架构:
{
"$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": "一个使用有序量规分配分数的问题。\n\n详见 [评分原语](https://docs.typesafe.ai/primitives/score)。",
"properties": {
"type": {
"const": "score",
"default": "score",
"title": "类型",
"type": "string"
},
"instructions": {
"anyOf": [
{
"$ref": "#/$defs/JSONContent"
},
{
"type": "null"
}
],
"default": null
},
"criteria": {
"items": {
"$ref": "#/$defs/JSONContent"
},
"title": "标准",
"type": "array"
}
},
"required": [
"criteria"
],
"title": "Score",
"type": "object"
}
字段:
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
Questions: TypeAlias = Mapping[str, Question]
以用于标识各答案的名称为键的问题输入。
问题字典
问题字典包含一个 type 键:"noul"、"choice" 或 "score"。你可以在同一个请求中混合使用字典和问题对象。
typesafe_sdk.NoulModel
基类:TypedDict
带有 type="noul" 的是/否问题字典。
详见 noul 原语。
type
instance-attribute
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
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
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 键标识的问题字典。