Skip to main content

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.
The 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.
Append --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>
ParameterTypeRequiredDescription
--model <model>stringnoDecision model ID (default: decision-model-preview)
--state <text>stringnoBusiness state to decide on, sent as a string
--state-file <path>stringnoRead state from a file; .json is parsed as an object or array, other files as text; - reads stdin
--questions <json>stringnoQuestion table JSON keyed by question ID
--questions-file <path>stringnoRead the question table from a JSON file; supports {...} or {"questions":{...}}
--request-file <path>stringnoFull request JSON {state, questions}; label and target are stripped automatically
--workspace-id <id>stringnoWorkspace ID for the endpoint host (or set BAILIAN_WORKSPACE_ID)
--region <cn-beijing|ap-southeast-1>stringnoEndpoint region: cn-beijing (default) or ap-southeast-1
--api-key <key>stringnoAPI key
--base-url <url>stringnoAPI 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; --region only participates in endpoint construction when no base URL is available.
  • --state is always sent as a string. Use --state-file or --request-file to pass an object or array.
  • --request-file strips label and target, 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_tokens is the number of input tokens for the request.
  • latency_ms is the end-to-end latency in milliseconds.
  • The decision API does not support sampling parameters such as temperature or max_tokens.