Decision model
Bailian CLI command reference for typed decision-model inference with probability outputs.
bl decision calls the decision model to classify a business state and return a choice, noul, or score result with probabilities. Use it for ticket classification, intent detection, risk scoring, and other scenarios that need stable structured output.
NoteThe decision model uses a workspace-specific endpoint and requires --workspace-id, which can also come from BAILIAN_WORKSPACE_ID or the workspace_id config field. It supports the cn-beijing (default) and ap-southeast-1 regions; the API key must match the target region.
ImportantAppend --help to any command for full parameter details, e.g. bl decision --help. Command details on this page are verified against bl 2.5.1.
Quick start
bl decision --workspace-id ws_xxx \
--state "Is this customer asking for a refund?" \
--questions '{"refund":{"type":"noul","instructions":"Is the customer asking for a refund?"}}' \
--output json
Response:
{
"model": "decision-model-preview",
"request_id": "12345678-abcd-1234-abcd-123456789012",
"answers": {
"refund": {
"type": "noul",
"noul": 1
}
},
"usage": {
"input_tokens": 23
},
"latency_ms": 40
}
Command
bl decision
Run the decision model. Requires API Key authentication.
Usage
bl decision (--state <text> | --state-file <path>) (--questions <json> | --questions-file <path>) | --request-file <path>
| Parameter | Type | Required | Description |
|---|---|---|---|
--model <model> | string | no | Decision model ID (default: decision-model-preview) |
--state <text> | string | no | Business state to decide on, sent as a string |
--state-file <path> | string | no | Read state from a file; .json is parsed as an object or array, other files as text; - reads stdin |
--questions <json> | string | no | Question table JSON keyed by question ID |
--questions-file <path> | string | no | Read the question table from a JSON file; supports {...} or {"questions":{...}} |
--request-file <path> | string | no | Full request JSON {state, questions}; label and target are stripped automatically |
--workspace-id <id> | string | no | Workspace ID for the endpoint host (or set BAILIAN_WORKSPACE_ID) |
--region <cn-beijing|ap-southeast-1> | string | no | Endpoint region: cn-beijing (default) or ap-southeast-1 |
--api-key <key> | string | no | API key |
--base-url <url> | string | no | API base URL |
Example: Decide whether a ticket is asking for a refund
bl decision --workspace-id ws_xxx --state "The customer is asking for a refund." --questions '{"refund":{"type":"noul","instructions":"Is the customer asking for a refund?"}}'
- A configured base URL takes precedence over
--region;--regiononly participates in endpoint construction when no base URL is available. --stateis always sent as a string. Use--state-fileor--request-fileto pass an object or array.--request-filestripslabelandtarget, so training samples can be reused without editing them first.- Keep each request to 16 questions or fewer; latency grows as the number of questions increases.
Question types
choice
Pick one option. Use it for intent classification and ticket-type decisions.
{
"intent": {
"type": "choice",
"instructions": "Choose the user intent",
"criteria": {
"refund": "Refund",
"cancel": "Cancel subscription",
"other": "Other"
}
}
}
Returns choice, confidence, and probabilities.
noul
Decide whether a condition holds and return a 0-1 value. criteria is optional and can describe the true and false cases.
{
"refund": {
"type": "noul",
"instructions": "Is the customer asking for a refund?",
"criteria": {
"true": "A refund was explicitly requested",
"false": "No refund was requested"
}
}
}
Returns a noul score; text output shows it as P(yes).
score
Score against ordered levels. criteria must be an array ordered from low to high.
{
"urgency": {
"type": "score",
"instructions": "Rate the urgency",
"criteria": ["low", "medium", "high"]
}
}
Returns score, legend, probabilities, and confidence. Three to seven levels are recommended.
Output
The default output is the full JSON response. With --output text, each question produces one summary line:
refund noul P(yes)=0.98
emotion choice=angry confidence=0.26 calm=0.03 angry=0.51 other=0.46
input_tokens=49 latency_ms=49
request_id: 12345678-abcd-1234-abcd-123456789012
usage.input_tokensis the number of input tokens for the request.latency_msis the end-to-end latency in milliseconds.- The decision API does not support sampling parameters such as
temperatureormax_tokens.