jevrecipes

Recipe catalog / grounding-level

Grade draft grounding

grounding-level is a Jev recipe from the jev-recipes TypeScript package. How much of the substantive content in draft is backed by evidence, on a five-level rubric? Use it when you need one graded measure of how well a generated answer sticks to its retrieved sources before sending or ranking it.

Last updated .

Explore this recipe interactively · Source and implementation guide · Markdown version

How do I use grounding-level 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 { groundingLevel } from 'jev-recipes/grounding-level';

const result = await groundingLevel({
  "draft": "Your Starter plan includes 5 GB of storage and unlimited collaborators. Files larger than 2 GB must be uploaded through the desktop app, and deleted files can be restored for 30 days.",
  "evidence": "Starter plan: 5 GB storage, up to 10 collaborators. Uploads larger than 2 GB require the desktop application. Deleted files can be restored for 30 days.",
  "minConfidence": 0.8
});
console.log(result);

What input does grounding-level take?

FieldTypeNeeded
draftstringRequired
evidencestringRequired
minConfidencenumberOptional
Full input and result schemas
{
  "input": {
    "$schema": "https://json-schema.org/draft/2020-12/schema",
    "type": "object",
    "properties": {
      "draft": {
        "type": "string"
      },
      "evidence": {
        "type": "string"
      },
      "minConfidence": {
        "type": "number",
        "minimum": 0,
        "maximum": 1
      }
    },
    "required": [
      "draft",
      "evidence"
    ]
  },
  "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"
        ]
      },
      "score": {
        "type": "number",
        "minimum": 0
      },
      "level": {
        "type": "integer",
        "minimum": 0,
        "maximum": 9007199254740991
      },
      "confidence": {
        "type": "number",
        "minimum": 0,
        "maximum": 1
      },
      "probabilities": {
        "type": "object",
        "propertyNames": {
          "type": "string"
        },
        "additionalProperties": {
          "type": "number",
          "minimum": 0,
          "maximum": 1
        }
      },
      "grounding": {
        "type": "string",
        "enum": [
          "none",
          "weak",
          "partial",
          "mostly",
          "full"
        ]
      }
    },
    "required": [
      "model",
      "usage",
      "status",
      "score",
      "level",
      "confidence",
      "probabilities",
      "grounding"
    ],
    "additionalProperties": false
  }
}

What does a grounding-level 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 grounding-level.

{
  "model": "demo-fixture",
  "usage": {
    "input_tokens": 0,
    "output_tokens": 0
  },
  "status": "ready",
  "score": 2.91,
  "level": 3,
  "confidence": 0.85,
  "probabilities": {
    "0": 0,
    "1": 0.02,
    "2": 0.09,
    "3": 0.85,
    "4": 0.04
  },
  "grounding": "mostly"
}

Input

See shared options and behavior for client configuration, validation, and errors. Types are inferred from this folder's Zod 4 schemas.

Result

grounding is one of none, weak, partial, mostly, or full, taken from the most likely rubric level. level is that level's index from 0 to 4. score is Jev's expected value across the rubric and can fall between levels; use it to rank candidate drafts or set a send threshold.

A result is ready when confidence meets minConfidence. Otherwise it is review and still carries the graded values for inspection. probabilities is keyed by level index.

Reuse and calls

Uses the shared score helper. This folder owns the grounding question, the rubric wording, and the review policy. A live invocation makes one logical Jev request.

Limits

The grade is a single measure for the whole draft. It does not identify which statements are unsupported; use verify per claim when you need to locate or fix them. Support is judged against the supplied evidence only, so a statement that is true in the world but absent from the evidence still counts as unsupported. The recipe does not check that the draft answers the question or that the evidence itself is accurate.

Example input

demo.json contains editable input and a hand-authored response. After installing jev-recipes, npx jev-recipes demo grounding-level shows an offline illustration, not an accuracy measurement. Use npx jev-recipes describe grounding-level to inspect the input and result schemas.

How accurate is grounding-level?

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.

What are the limits of grounding-level?