Recipe catalog / dispute-kind
Classify a billing dispute
dispute-kind is a Jev recipe from the jev-recipes TypeScript package. What kind of billing dispute does message raise? Use it when you need to sort incoming billing complaints into a fixed set of dispute types so each can be routed to the right handler or template.
Last updated .
Explore this recipe interactively · Source and implementation guide · Markdown version
How do I use dispute-kind in TypeScript?
Install with npm install jev-recipes. Requires Node.js 22.9 or newer and ES modules. Set TYPESAFE_API_KEY in your server environment for live calls, which send input to TypeSafe and use API quota. See the installation guide.
import { disputeKind } from 'jev-recipes/dispute-kind';
const result = await disputeKind({
"message": "I cancelled my Pro plan on August 28th and got the confirmation email, but my card was charged $49 again on September 1st. Please reverse it and confirm the account is actually closed this time.",
"minConfidence": 0.8
});
console.log(result);
What input does dispute-kind take?
| Field | Type | Needed |
|---|---|---|
| message | string | Required |
| minConfidence | number | Optional |
Full input and result schemas
{
"input": {
"$schema": "https://json-schema.org/draft/2020-12/schema",
"type": "object",
"properties": {
"message": {
"type": "string"
},
"minConfidence": {
"type": "number",
"minimum": 0,
"maximum": 1
}
},
"required": [
"message"
]
},
"result": {
"$schema": "https://json-schema.org/draft/2020-12/schema",
"type": "object",
"properties": {
"model": {
"type": "string"
},
"usage": {
"type": "object",
"properties": {
"input_tokens": {
"type": "integer",
"minimum": 0,
"maximum": 9007199254740991
},
"output_tokens": {
"type": "integer",
"minimum": 0,
"maximum": 9007199254740991
}
},
"required": [
"input_tokens",
"output_tokens"
],
"additionalProperties": false
},
"status": {
"type": "string",
"enum": [
"ready",
"review"
]
},
"verdict": {
"type": "string",
"enum": [
"duplicate_charge",
"wrong_amount",
"unrecognized_charge",
"refund_not_received",
"cancellation_not_honored",
"other",
"unclear"
]
},
"confidence": {
"type": "number",
"minimum": 0,
"maximum": 1
},
"probabilities": {
"type": "object",
"propertyNames": {
"type": "string",
"enum": [
"duplicate_charge",
"wrong_amount",
"unrecognized_charge",
"refund_not_received",
"cancellation_not_honored",
"other",
"unclear"
]
},
"additionalProperties": {
"type": "number",
"minimum": 0,
"maximum": 1
},
"required": [
"duplicate_charge",
"wrong_amount",
"unrecognized_charge",
"refund_not_received",
"cancellation_not_honored",
"other",
"unclear"
]
}
},
"required": [
"model",
"usage",
"status",
"verdict",
"confidence",
"probabilities"
],
"additionalProperties": false
}
}What does a dispute-kind result look like?
This hand-authored response demonstrates the contract. It is not a model accuracy measurement. Run it without an API key: npx jev-recipes demo dispute-kind.
{
"model": "demo-fixture",
"usage": {
"input_tokens": 0,
"output_tokens": 0
},
"status": "ready",
"verdict": "cancellation_not_honored",
"confidence": 0.88,
"probabilities": {
"duplicate_charge": 0.03,
"wrong_amount": 0.02,
"unrecognized_charge": 0.02,
"refund_not_received": 0.02,
"cancellation_not_honored": 0.88,
"other": 0.01,
"unclear": 0.02
}
}
Input
See shared options and behavior for client configuration, validation, and errors. Types are inferred from this folder's Zod 4 schemas.
Result
verdict is one of duplicate_charge, wrong_amount, unrecognized_charge, refund_not_received, cancellation_not_honored, other, unclear. unclear means the supplied facts do not establish a decision and always requires review.
A result is ready when confidence meets minConfidence and the verdict is not unclear. Inspect the verdict as well as the status: a ready result can name an outcome your application treats as negative. probabilities covers every verdict.
Reuse and calls
Uses the shared choice helper for the Jev call and response parsing. This folder owns its question, verdict criteria, and review policy. A live invocation makes one logical Jev request.
Limits
The label describes the customer's claim as worded, not what your billing system shows. A customer who says they cancelled may not have, and a charge they do not recognize may be legitimate, so every type still needs verification against records in code. Messages that mix several disputes are classified by the one pressed hardest, and other covers genuine billing complaints outside the named types rather than non-billing messages, which should land on unclear.
Example input
demo.json contains editable input and a hand-authored response. After installing jev-recipes, npx jev-recipes demo dispute-kind shows an offline illustration, not an accuracy measurement. Use npx jev-recipes describe dispute-kind to inspect the input and result schemas.
How accurate is dispute-kind?
No verified live accuracy measurement is available. Evaluate representative cases before using this decision in your workflow.
Use the evaluation guide to measure this decision on your own labeled cases.
What are the limits of dispute-kind?
- Classifies what the customer claims, not whether the claim is valid. Verify charges, refunds, and cancellations against your billing records in code.
- A message that raises several disputes is classified by the one it presses most; split multi-issue messages in code when each matters.
- Amounts and dates in the message are treated as part of the customer's claim, not checked.
Which recipes are related to dispute-kind?
- issue-impact: Use issue-impact to grade how badly a reported problem affects the customer, rather than what kind of billing dispute it is.
- route: Use route when the destinations are caller-defined queues rather than this fixed set of billing dispute types.