Recipe catalog / shipment-issue-kind
Classify a reported shipping problem
What shipping problem does message report?
You need to route delivery complaints to the right workflow, such as a carrier trace, a replacement, or an address correction, from the words the customer used.
Explore this recipe interactively ยท Source and implementation guide
Use shipment-issue-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 { shipmentIssueKind } from 'jev-recipes/shipment-issue-kind';
const result = await shipmentIssueKind({
"message": "Tracking says my order was delivered yesterday at 2:14 PM but there is nothing on my porch, in the mailbox, or with my neighbors. I have checked everywhere. Order #A81-2290.",
"context": "Customer message submitted through the order help form for a small parcel shipment.",
"minConfidence": 0.8
});
console.log(result);
Input contract
| Field | Type | Needed |
|---|---|---|
| message | string | Required |
| context | string | Optional |
| minConfidence | number | Optional |
Full input and result schemas
{
"input": {
"$schema": "https://json-schema.org/draft/2020-12/schema",
"type": "object",
"properties": {
"message": {
"type": "string"
},
"context": {
"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": [
"delayed",
"damaged",
"lost",
"wrong_item",
"address",
"none",
"unclear"
]
},
"confidence": {
"type": "number",
"minimum": 0,
"maximum": 1
},
"probabilities": {
"type": "object",
"propertyNames": {
"type": "string",
"enum": [
"delayed",
"damaged",
"lost",
"wrong_item",
"address",
"none",
"unclear"
]
},
"additionalProperties": {
"type": "number",
"minimum": 0,
"maximum": 1
},
"required": [
"delayed",
"damaged",
"lost",
"wrong_item",
"address",
"none",
"unclear"
]
}
},
"required": [
"model",
"usage",
"status",
"verdict",
"confidence",
"probabilities"
],
"additionalProperties": false
}
}Saved example result
This hand-authored response demonstrates the contract. It is not a model accuracy measurement. Run it without an API key: npx jev-recipes demo shipment-issue-kind.
{
"model": "demo-fixture",
"usage": {
"input_tokens": 0,
"output_tokens": 0
},
"status": "ready",
"verdict": "lost",
"confidence": 0.9,
"probabilities": {
"delayed": 0.04,
"damaged": 0.01,
"lost": 0.9,
"wrong_item": 0.01,
"address": 0.02,
"none": 0.01,
"unclear": 0.01
}
}
Evaluation evidence
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.
Limitations
- Classifies what the customer reports, not what the carrier record shows. Verify against tracking data before issuing a refund or replacement.
- A message that reports several problems is graded by the main one; the remedy the customer asks for is not part of the decision.
Related recipes
- failure-kind: Use failure-kind to classify why a technical operation failed rather than what went wrong with a physical delivery.
- issue-impact: Use issue-impact to grade how badly the reported problem affects the customer rather than what kind of problem it is.