文字
評估決策
使用原生決策模型評估命名機率、選擇和評分問題。
將 state 和命名的 questions 發送至決策模型。請使用 GET /v1/models?category=decision 查詢當前可用性,並使用 GET /v1/models/{model} 查詢其發布的合約。
state 以及每個問題的 instructions 均接受字串、JSON 物件或 JSON 陣列。此端點會返回同步的 JSON。
| 問題類型 | 準則 | 結果 |
|---|---|---|
noul | 包含 true 和 false 指引的可選物件 | noul,一個 0 到 1 之間的機率 |
choice | 1–255 個選項名稱映射至指引或 null 的物件 | choice,可選包含 probabilities 和 confidence |
score | 2–10 個描述的有序陣列 | 從 0 到最後一個索引的 score;可以是小數,並可選包含 legend、probabilities 和 confidence |
回應會在 answers 下保留您的問題名稱。usage.input_tokens 和 usage.output_tokens 會在可用時報告觀察到的使用量。定價依據模型的當前費率;免費輸出並不代表輸出 token 為零。
聊天訊息、工具、串流和 Batch 不屬於此端點合約的一部分。
curl https://api.tokenlab.sh/v1/systemone \
-H "Authorization: Bearer $TOKENLAB_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "jev-1.13",
"state": "I was charged twice. Please refund the duplicate payment.",
"questions": {
"refund_requested": {"type": "noul", "instructions": "Is a refund requested?"},
"department": {
"type": "choice", "instructions": "Which team should handle this?",
"criteria": {"billing": "Charges and refunds", "technical": "Software bugs"}
},
"urgency": {
"type": "score", "instructions": "Rate urgency",
"criteria": ["Routine enquiry", "Money affected", "Safety emergency"]
}
}
}'此 HTTP 請求亦可與標準的 fetch 或 requests 客戶端搭配使用。決策回應為結構化資料,而非生成的文字解釋。
curl -X POST "https://example.com/v1/systemone" \ -H "Content-Type: application/json" \ -d '{ "model": "string", "state": "string", "questions": { "property1": { "type": "noul", "instructions": "string" }, "property2": { "type": "noul", "instructions": "string" } } }'{ "id": "string", "model": "string", "answers": { "property1": { "type": "noul", "noul": 0 }, "property2": { "type": "noul", "noul": 0 } }, "usage": { "input_tokens": 0, "output_tokens": 0 }}授權
BearerAuth AuthorizationBearer <token>
API Key 驗證。請在 Dashboard > API > API Keys 建立或管理 API 金鑰。
位置: header
請求標頭
X-TokenLab-Delivery-Policy?string
單次請求傳遞策略。會覆寫 API key 與 Workspace 的預設值。系統會自動優先嘗試 TokenLab Verified,並可能在輸出、請求接受或建立持久性資源前切換至 Official 模式一次。
可選值
- "auto"
- "verified"
- "official"
請求主體
application/json
回應
application/json
application/json
application/json
application/json