> ## Documentation Index
> Fetch the complete documentation index at: https://docs.sqwish.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Route customer support

> Choose a team, spot a stated deadline and score impact.

Use this when a ticket arrives, before assigning it to a queue. The recipe asks three decisions about the same message: `team`, `urgent` and `impact`.

[Open this recipe in the playground](https://console.sqwish.ai/#playground?recipe=support-triage), or set `D1_API_KEY` as in the [quickstart](/quickstart) and run the same request:

```bash theme={null}
curl --fail-with-body --silent --show-error https://console.sqwish.ai/v1/decide \
  -H "Authorization: Bearer $D1_API_KEY" \
  -H "Content-Type: application/json" \
  --data-binary @- <<'JSON'
{
  "model": "sqwish-d1-core",
  "context": "Hi, you charged my card twice for order 4471, 84.50 GBP each time. Please refund the second payment. I need the money back before my rent goes out tomorrow.",
  "decisions": [
    {
      "id": "team",
      "kind": "single",
      "question": "Which team should handle this ticket?",
      "outcomes": {
        "billing": "Invoices, payments and payment methods, refunds and the refund policy, and cancellation fees.",
        "orders": "Placing, changing, cancelling or tracking an order, delivery options and times, and shipping addresses.",
        "account": "Signing up, signing in, passwords, changing or deleting an account, and newsletter subscriptions.",
        "feedback": "A complaint, a review or a claim about the company or its service.",
        "contact": "The customer asks how to reach customer service or wants to talk to a person."
      },
      "abstain": {
        "min_probability": 0.6
      }
    },
    {
      "id": "urgent",
      "kind": "binary",
      "question": "Does the ticket state a deadline within one day?",
      "outcomes": {
        "yes": "An explicit deadline is today or within the next 24 hours.",
        "no": "The deadline is later, missing or unclear."
      }
    },
    {
      "id": "impact",
      "kind": "ordinal",
      "question": "How badly is the customer affected?",
      "outcomes": [
        "0",
        "1",
        "2"
      ],
      "rubric": [
        "A minor annoyance. Nothing is blocked.",
        "Something is harder or delayed, but they can manage.",
        "They are blocked or losing money, and can't fix it themselves."
      ]
    }
  ]
}
JSON
```

## Use the result

```javascript theme={null}
const { team, urgent, impact } = result.decisions;
const queue = team.abstained ? "manual_review" : team.action;
console.log({ queue, deadlineScore: urgent.p_yes, impact: impact.expected_level });
```

Keep routing separate from urgency and impact. A billing request can be low impact; a vague deadline is not proof of urgency. The ordinal impact score uses positions 0–2, so review its distribution when the expected value falls between two levels.

The team policy defers ambiguous tickets. Measure both incorrect routing and the fraction sent for review, including tickets that need more than one team. Add your real queue boundaries to the descriptions and collect reviewed outcomes before automating assignment.

## What was evaluated

Only `team` was measured in the evaluation below. The `urgent` and `impact` decisions are examples to validate on your own tickets; do not apply the team accuracy to them. Public support categories also differ from your own queues.

<Note>
  Historical evaluation on **2026-09-28**, using **sqwish-d1-core**. These measurements describe that checkpoint and dataset, not current production performance or an accuracy guarantee.
</Note>

* Dataset: [Bitext customer support](https://huggingface.co/datasets/bitext/Bitext-customer-support-llm-chatbot-training-dataset) (CDLA-Sharing-1.0).
* Split: train (the only split), the 20% of rows whose hash falls below 0.2.
* Sample: 1,000 rows, 1,000 measured decisions.
* Measured decision IDs: `team`.
* Wording: hand-written.
* Checkpoint SHA-256: `dd420ca652cfaa10279eabb54d15afd50fe9d24d357498c4dbc512b1c3d73bb2`.

| Metric | Value | Recorded interval |
| - | -: | - |
| accuracy | 0.986 | 0.978 to 0.993 |
| log loss | 0.1111 | 0.0988 to 0.1243 |
| brier | 0.0292 | 0.0224 to 0.0371 |
| ece | 0.0757 | 0.0728 to 0.083 |

The majority-class baseline has accuracy **0.31**; the class-prior baseline has log loss **1.4547**.

Only the decision IDs listed above were measured. Dataset labels, class balance and wording affect these results. The intervals do not measure distribution shift. Re-evaluate with your own cases, including ambiguous and out-of-scope inputs.

## Improve it for your application

Keep the decision IDs and outcome order stable while evaluating changes. [Review a dataset](/guides/datasets), [tune the wording](/guides/prompt-tuning), and compare the result against your current policy before changing production. Check [fallback](/guides/models-and-fallback) so you know which model actually answered.
