Triage card disputes
Build a card dispute classifier for a bank's dispute team, from an empty workspace to a tested, guarded, production-ready intent. Every step shows the Dashboard, the REST API, and the JavaScript and Python SDKs.
A cardholder says a charge is wrong. A person on the dispute team has to decide which kind of dispute it is and how urgent it is, using the bank's own policy. In this tutorial you build the part of that job a model can do reliably: read the cardholder's account and the transaction, and return a category, an urgency, a confidence and a rationale that cites the policy.
You will build it the way you would for a real product, in six steps:
- Create a domain that holds the work.
- Give it the dispute policy as knowledge.
- Create an intent with a typed input and a typed output.
- Run it and read what comes back.
- Protect it with a guardrail template and watch it refuse an attack.
- Evaluate it against eight test cases, so you know it works before you rely on it.
Each step has four tabs. They do the same thing; pick the one you work in. Every request and response in the API tabs was captured from a real run of these exact steps.
What you need
- A LiyaEngine workspace.
- An API key with full access. Runtime keys can call things but cannot create them, so they cannot follow this tutorial. Create one under Administration → API Keys, and see Authentication for how keys and scopes work.
- About a dollar of model usage. The first five steps cost a few cents. The evaluation in step 6 costs more, because a second model reads and scores every answer.
Set up
There is nothing to set up. Sign in and open the sidebar. This tutorial uses the Build, Knowledge, Guardrails, Evaluations and Playground areas.
The SDK snippets in later steps reuse client. They need SDK version 0.23 or later (@liyaengine/sdk 0.23, liyaengine 0.23), which added guardrail templates and named conversations. The code was run against those releases.
The steps
1. Create the domain and add the policy
A domain for the dispute desk, and the bank's dispute policy as knowledge the model retrieves from.
2. Create and run the intent
A typed intent that classifies a dispute, and how to read what comes back.
3. Protect it with a guardrail template
Start from a financial services template, then watch it refuse injected instructions.
4. Evaluate it before you rely on it
Eight test cases, a pass rule, a gate, and how to read and act on the judge.