Recipe catalog / budget-narrative-fit
Check a budget narrative against its line items
budget-narrative-fit is a Jev recipe from the jev-recipes TypeScript package. Does narrative explain each line item in lineItems and nothing that lineItems does not list? Use it when you review grant budgets before submission and want to catch a narrative that skips a line item or justifies an expense the budget table does not contain.
Last updated .
Explore this recipe interactively · Source and implementation guide · Markdown version
How do I use budget-narrative-fit 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 { budgetNarrativeFit } from 'jev-recipes/budget-narrative-fit';
const result = await budgetNarrativeFit({
"lineItems": "Program coordinator salary (0.5 FTE): $30,000\nBooks and materials: $9,000\nTutor training and background checks: $4,000\nSnacks and family reading nights: $5,000\nTotal: $48,000",
"narrative": "Personnel. A half-time program coordinator ($30,000) will recruit and schedule tutors, coordinate with the three partner schools, and track attendance. Books and materials ($9,000) cover levelled readers for 90 students, reading logs, and consumables for the school year. Tutor training and background checks ($4,000) fund a two-day orientation and state background screening for 12 volunteers. Travel ($2,400) reimburses the coordinator's mileage between the three school sites at the standard rate.",
"minConfidence": 0.8
});
console.log(result);
What input does budget-narrative-fit take?
| Field | Type | Needed |
|---|---|---|
| lineItems | string | Required |
| narrative | string | Required |
| minConfidence | number | Optional |
Full input and result schemas
{
"input": {
"$schema": "https://json-schema.org/draft/2020-12/schema",
"type": "object",
"properties": {
"lineItems": {
"type": "string"
},
"narrative": {
"type": "string"
},
"minConfidence": {
"type": "number",
"minimum": 0,
"maximum": 1
}
},
"required": [
"lineItems",
"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"
]
},
"probability": {
"type": "number",
"minimum": 0,
"maximum": 1
},
"confidence": {
"type": "number",
"minimum": 0,
"maximum": 1
},
"verdict": {
"type": "string",
"enum": [
"aligned",
"misaligned"
]
}
},
"required": [
"model",
"usage",
"status",
"probability",
"confidence",
"verdict"
],
"additionalProperties": false
}
}What does a budget-narrative-fit 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 budget-narrative-fit.
{
"model": "demo-fixture",
"usage": {
"input_tokens": 0,
"output_tokens": 0
},
"status": "ready",
"probability": 0.06,
"confidence": 0.94,
"verdict": "misaligned"
}
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 aligned when Jev's yes probability is at least 0.5 and misaligned otherwise. probability is that yes probability. confidence is the probability of the chosen side, so a 0.1 yes probability yields misaligned with 0.9 confidence.
A result is ready when confidence meets minConfidence. Otherwise it is review. Treat a review result as unknown and fall back to your safe default.
Reuse and calls
Uses the shared gate helper, a single yes/no question. This folder owns the question wording, the outcome descriptions, and the review policy. A live invocation makes one logical Jev request.
Limits
The verdict is about coverage in both directions and nothing else: it does not check that narrative figures match the table, that line items sum to the total, or that any cost is reasonable or allowable under a funder's rules. Matching is by purpose rather than wording, so a narrative that renames an item still counts as covering it, while a narrative that only repeats the table without explaining anything still counts as aligned. A misaligned verdict does not say whether the table or the narrative is the one to fix; reconciling amounts and deciding which side to correct belong in application code.
Example input
demo.json contains editable input and a hand-authored response. After installing jev-recipes, npx jev-recipes demo budget-narrative-fit shows an offline illustration, not an accuracy measurement. Use npx jev-recipes describe budget-narrative-fit to inspect the input and result schemas.
How accurate is budget-narrative-fit?
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 budget-narrative-fit?
- Judges coverage in both directions, not arithmetic. Whether narrative amounts match the table or sum to the total is checked in application code.
- Does not judge whether costs are reasonable, allowable, or within a funder's rules.
- A misaligned verdict says the two texts do not cover the same items; it does not say which side is wrong.
Which recipes are related to budget-narrative-fit?
- summary-coverage: Use summary-coverage to check that a summary preserves each supplied source point in one direction, rather than two-way alignment between a table and its narrative.
- commit-message-fit: Use commit-message-fit for the analogous check that a commit message describes the change it accompanies.