← Examples

Invoice image to JSON

A vision-language model reads a document image straight into your schema. The shape is guaranteed; the values are the model's reading, so check them.

SmolVLM-500M-Instruct, about 1 GB on first use

Schema

The code

vlm.chat([{ role: "user", content: [{ type: "image", image: file }, { type: "text", text: prompt }] }],
  { format: { type: "json", schema } });

Full source: site/src/examples/invoice.ts