jevrecipes

Recipe catalog / loss-cause-kind

Identify the cause of loss in a claim narrative

What cause of loss does narrative describe: weather, fire, water, theft, collision, wear and tear, vandalism, or something else?

A claims intake or routing system needs to sort a free-form loss description into a cause-of-loss category so it can pick the right adjuster queue, forms, or follow-up questions.

Explore this recipe interactively ยท Source and implementation guide

Use loss-cause-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 { lossCauseKind } from 'jev-recipes/loss-cause-kind';

const result = await lossCauseKind({
  "narrative": "We returned from a long weekend on Monday evening and found the back door forced open, with the frame splintered around the deadbolt. Two laptops, my wife's jewelry box, a camera bag, and the cash we kept in the desk drawer were gone. Drawers were pulled out in every bedroom. We called the police that night and have a report number; the neighbor's doorbell camera shows two people in the yard at around 3 am on Sunday.",
  "minConfidence": 0.8
});
console.log(result);

Input contract

FieldTypeNeeded
narrativestringRequired
minConfidencenumberOptional
Full input and result schemas
{
  "input": {
    "$schema": "https://json-schema.org/draft/2020-12/schema",
    "type": "object",
    "properties": {
      "narrative": {
        "type": "string"
      },
      "minConfidence": {
        "type": "number",
        "minimum": 0,
        "maximum": 1
      }
    },
    "required": [
      "narrative"
    ]
  },
  "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": [
          "weather",
          "fire",
          "water",
          "theft",
          "collision",
          "wear_and_tear",
          "vandalism",
          "other",
          "unclear"
        ]
      },
      "confidence": {
        "type": "number",
        "minimum": 0,
        "maximum": 1
      },
      "probabilities": {
        "type": "object",
        "propertyNames": {
          "type": "string",
          "enum": [
            "weather",
            "fire",
            "water",
            "theft",
            "collision",
            "wear_and_tear",
            "vandalism",
            "other",
            "unclear"
          ]
        },
        "additionalProperties": {
          "type": "number",
          "minimum": 0,
          "maximum": 1
        },
        "required": [
          "weather",
          "fire",
          "water",
          "theft",
          "collision",
          "wear_and_tear",
          "vandalism",
          "other",
          "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 loss-cause-kind.

{
  "model": "demo-fixture",
  "usage": {
    "input_tokens": 0,
    "output_tokens": 0
  },
  "status": "ready",
  "verdict": "theft",
  "confidence": 0.91,
  "probabilities": {
    "weather": 0.01,
    "fire": 0,
    "water": 0.01,
    "theft": 0.91,
    "collision": 0,
    "wear_and_tear": 0,
    "vandalism": 0.04,
    "other": 0.01,
    "unclear": 0.02
  }
}

Evaluation evidence

Fixture only

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

Related recipes