Built-in AI task APIs · part 2

WhatsApp message → validated order

Gemini Nano reads a free-form chat message and answers with JSON constrained by a JSON Schema (responseConstraint). Then a small validator checks what the schema can't: that the order makes sense and comes from the message. Everything runs on your device. Companion demo for the blog post — see README.md.

Message and controls

Prompt API: checking…

Load a sample message

Edit it freely, in English or Spanish.

Raw model output

Exactly what prompt() returned, per attempt.

Nothing yet.

Validated order

Nothing yet.