请求参数 Content-Type · String · Header · 必选 请求类型:application/json。 Authorization · String · Header · 必选 API-Key,格式:Bearer $DASHSCOPE_API_KEY。 model · String · Body · 必选 模型名,取值 decision-model-preview。 state · String / Object / Array · Body · 必选 待决策的业务状态:工单文本、对话或结构化对象(对象会被序列化后送模型)。 questions · Object · Body · 必选 问题表。key 为调用方自定义的问题 id;value 为问题对象,字段如下。 questions 属性 type · String · 必选 问题类型,取值:
choice:多选一
noul:是否判断
score:有序量表
instructions · String · 可选 问题描述或评判标准。 criteria · Object / Array · 视类型
choice:选项名 → 选项描述 的映射(1–255 项,建议给全量选项并补 other 兜底)。
noul:可选 {"true":…, "false":…} 描述。
score:从低到高的等级描述数组(2–10 级,建议 3–7 级且每级可清晰区分)。
接口限制与建议
- 问题数接口不设上限(建议 ≤ 16,延迟随问题数近线性增长)。
choice 选项 ≤ 255。
score 等级 2–255(建议 3–7 级)。
- 上下文上限 65536 token,超长
state 会被拒绝或截断。
| 请求示例 Python 示例使用 TypeSafe SDK(typesafe-sdk)调用,base_url 指向百炼网关,SDK 会自动拼接 /v1/systemone 并解析返回体。安装:pip install typesafe-sdk。 工单分流示例一次请求同时完成「派单团队 choice」「是否升级 noul」「严重度 score」三项决策。以下以新加坡地域为例。 curl -sS -X POST https://{WorkspaceId}.ap-southeast-1.maas.aliyuncs.com/compatible-mode/v1/systemone \
-H "Authorization: Bearer $DASHSCOPE_API_KEY" \
-H 'Content-Type: application/json' \
-d '{
"model": "decision-model-preview",
"state": {"ticket_id": "T-1001", "content": "订单支付后超过 24 小时仍未到账,用户无法继续使用核心服务,要求立即处理。"},
"questions": {
"department": {"type": "choice", "instructions": "应该由哪个团队处理?",
"criteria": {"billing": "支付、退款和账单问题", "technical": "产品故障和集成问题"}},
"escalate": {"type": "noul", "instructions": "是否需要立即通知值班人员?"},
"severity": {"type": "score", "instructions": "这个问题有多严重?",
"criteria": ["轻微问题,不影响功能", "部分功能受影响,但存在替代方案",
"核心功能不可用,没有替代方案", "造成严重业务或安全影响"]}
}
}'
import os
from typesafe_sdk import TypeSafeClient
client = TypeSafeClient(
api_key=os.environ["DASHSCOPE_API_KEY"],
base_url="https://{WorkspaceId}.ap-southeast-1.maas.aliyuncs.com/compatible-mode",
)
result = client.system_one(
model="decision-model-preview",
state={"ticket_id": "T-1001", "content": "订单支付后超过 24 小时仍未到账,用户无法继续使用核心服务。"},
questions={
"department": {"type": "choice", "instructions": "应该由哪个团队处理?",
"criteria": {"billing": "支付、退款和账单问题", "technical": "产品故障和集成问题"}},
"escalate": {"type": "noul", "instructions": "是否需要立即通知值班人员?"},
"severity": {"type": "score", "instructions": "这个问题有多严重?",
"criteria": ["轻微问题,不影响功能", "部分功能受影响,但存在替代方案",
"核心功能不可用,没有替代方案", "造成严重业务或安全影响"]},
},
)
print(result.answers["department"]) # choice, confidence, probabilities
print(result.answers["escalate"]) # noul P(yes)
print(result.answers["severity"]) # score, legend, probabilities
是非判断示例对一个 noul 问题返回 P(yes) 概率,0=否 1=是。以下以新加坡地域为例。 |