← Back to Docs
Recipe

Recipe: Receipt OCR + categorization

Extract line items from grocery receipts, classify each item into categories, and store structured data for spending analysis.

Overview

This recipe chains two Meridian steps: OCR extraction from an uploaded receipt image, followed by LLM categorization of each line item into user-defined buckets like Produce, Dairy, or Snacks.

Steps

  1. ocr.receipt — Upload a JPEG/PNG receipt. Returns raw text and a confidence score.
  2. llm.classify — Pass extracted text with a prompt template that maps items to categories.
  3. store.json — Persist the categorized result to your data sink.

Prompt template

You are a grocery categorizer.
Given this receipt text:
{{ocr_output}}

Return JSON: [{"item": "...", "category": "..."}]
Categories: Produce, Dairy, Meat, Bakery, Snacks, Household, Other

Expected output

[
  {"item": "Bananas", "category": "Produce"},
  {"item": "Whole Milk", "category": "Dairy"},
  {"item": "Sourdough Loaf", "category": "Bakery"}
]

Need help tuning the classifier? Read the prompt engineering guide.