Recipe catalog / budget-narrative-fit
Check a budget narrative against its line items
Does narrative explain each line item in lineItems and nothing that lineItems does not list?
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.
Explore this recipe interactively ยท Source and implementation guide
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);
Input contract
| 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
}
}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 budget-narrative-fit.
{
"model": "demo-fixture",
"usage": {
"input_tokens": 0,
"output_tokens": 0
},
"status": "ready",
"probability": 0.06,
"confidence": 0.94,
"verdict": "misaligned"
}
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
- 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.
Related recipes
- 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.