VocalEats

VocalEats — Restaurant Voice Ordering Agent

Voice agents that take restaurant orders over a real phone line and write them straight into the Square POS — WebRTC transport, ASR, intent and entity extraction, payment capture and human handoff.

Role
Voice AI / NLP Engineer · Database Administrator
Period
Oct 2023–Feb 2024

01 Problem What was actually hard

Restaurant chains wanted hands-free ordering, but the agent has to live inside infrastructure that already exists: Square POS, card processing, SIP trunks to the counter phone. That imposes constraints a demo never sees. Transcription has to land fast enough that the caller does not repeat themselves, a misheard modifier produces a wrong order the kitchen actually cooks, payment data falls under PCI-DSS, and the agent must know when it is out of its depth and pass the call to a person.

02 Data Sourcing and preparation

Collected and anonymised 3,000 restaurant call recordings, annotated for intent (menu query, order, modification, payment, transfer) and for entities — dish names, quantities, dietary restrictions. Menu data was pulled per chain from the Square POS API (names, prices, allergens, availability) and encoded into few-shot examples, so the extractor is grounded in that restaurant's actual menu rather than a generic food vocabulary. The evaluation set deliberately over-weights the hard cases: accented speech, kitchen noise, interruptions, mid-sentence corrections.

03 Models Evaluated, kept, cut

7 evaluated 5 kept 2 cut

Kept 5

  • Whisper large-v3

    Handles accented speech and background noise without fine-tuning

  • Mistral 7B (intent)

    Classifies each utterance: order, inquiry, modify, pay, transfer

  • Mistral 7B (entity extraction)

    Pulls items, quantities and modifiers out of natural speech, few-shot on the live menu

  • LiveKit (WebRTC)

    Real-time audio transport with SIP trunk integration for handoff

  • Square Payments API

    PCI-DSS compliant capture; only the payment token is ever stored

Cut 2

  • Twilio SIP

    Higher latency and cost than the LiveKit path

  • Fine-tuned in-house ASR

    Measured against Whisper large-v3 out of the box it earned nothing

04 Architecture How it fits together

The caller arrives over LiveKit WebRTC. Whisper transcribes, Mistral classifies the intent, and on an ordering intent a second few-shot pass extracts items, quantities and modifiers. Those go into an explicit order state machine — validate the item exists, check availability against the POS API, confirm dietary restrictions — which is what keeps the agent from agreeing to something the kitchen cannot make. Payment goes to Square; low confidence or an ambiguous request routes over the SIP trunk to staff. Order and call records live in PostgreSQL with field-level encryption; card data never lands in the database.

Architecture flow: Caller then Whisper then Intent + entities then Order state machine then Payment or handoff then Spoken confirmation 01 Caller LiveKit WebRTC / SIP 02 Whisper transcription 03 Intent + entities Mistral 7B, few-shot on the live menu Square POS API 04 Order state machine validate · availability · dietary check 05 Payment or handoff Square token, or SIP transfer to staff 06 Spoken confirmation

05 Production Deployment and operation

Deployed on AWS with LiveKit media servers and separate inference workers for ASR and NLU. Monitoring tracks transcription accuracy, order error rate and handoff latency. Escalation to a human is instrumented as a normal outcome, not an error — for allergy confirmation it is the intended path.

06 Deep dive The long version, in full

Problem

The restaurant industry faced a transformation: customers expected effortless ordering, but traditional phone systems required staff to manually take orders, read them back, and enter into POS. Voice AI promised automation—but integrating with existing restaurant infrastructure (Square POS, payment processing, legacy phone systems) introduced real-world constraints:

  • Latency: ASR must complete within 500ms or customers perceive delay
  • Accuracy: Misheard menu items or modifications lead to wrong orders (costly)
  • Compliance: Payment information requires PCI-DSS handling; customer conversations may contain health data (allergies)
  • Fallback: When AI is uncertain, seamlessly transfer to a human agent

Data Preparation

We partnered with restaurant chains to collect 3,000 anonymized call recordings (HIPAA-compliant storage). Each call was annotated with:

  • Intent: menu inquiry, place order, modify order, payment, transfer
  • Entities: menu items, quantities, dietary restrictions (vegetarian, gluten-free, nut-free, etc.)
  • Context: customer ID (if returning), order state

We extracted menu data from Square POS APIs: dish names, prices, allergen info, availability schedules. This data was encoded into few-shot examples for the NLU model: “Customer: ‘I’d like a large pepperoni, extra cheese, no onions.’ -> Items: [Pizza, size: large, toppings: pepperoni+cheese, exclusions: onions]”

The evaluation set included edge cases: accented speech, background noise, interruptions, unclear audio. Ground truth: human-validated orders.

Models Evaluated

Model Result Note
Whisper (large-v3) Kept Robust multilingual ASR; 95%+ word accuracy; handles noise/accents
Mistral 7B (Intent) Kept Fast intent classification; few-shot capable
Mistral 7B (NER) Kept Named-entity recognition for menu items; 94% F1-score
LiveKit (WebRTC) Kept Real-time streaming; <100ms latency; SIP integration
Square Payments Kept PCI-DSS compliant; direct POS sync
Twilio SIP Cut Higher latency; LiveKit delivered better p2p performance
Fine-tuned ASR Cut Whisper large-v3 required no fine-tuning (high baseline)

Architecture

The voice-ordering pipeline:

[Customer speaks] -> LiveKit WebRTC stream
  v
Whisper ASR (transcribe)
  v
Intent Classifier (Mistral): order / inquiry / modify / transfer?
  v
If "order": NER (extract items, quantities, mods)
  v
Order State Machine
  ├─ Validate items exist in menu
  ├─ Check availability (query POS API)
  ├─ Confirm dietary restrictions
  v
Payment or Transfer
  ├─ If payment: -> Square API (encrypted)
  ├─ If transfer: -> SIP trunk to human staff
  v
TTS Response -> [Customer hears confirmation]

A finite-state machine manages conversation flow: each user input transitions the order state (empty -> items -> mods -> payment -> confirmed). If the NLU confidence is low, the system escalates to a human.

Database storage is encrypted at the field level (credit card data never stored; only payment token from Square).

Production & Scale

Deployed across 3 restaurant chains (150+ locations). Average call duration: 2m 15s. Order success rate: 89% (rest escalated to human staff).

Key metrics:

  • ASR accuracy: 3.2% WER (word error rate)
  • Order accuracy: 96% (correct items, mods, quantities)
  • Successful orders: 89% (11% require human escalation, mostly edge cases or ambiguous requests)

Reliability: 99.7% uptime; <100ms median ASR latency. Payment processing: zero PCI-DSS violations.

A/B test: Comparing Whisper + Mistral vs a custom fine-tuned ASR model showed no significant improvement from fine-tuning—Whisper large-v3’s pre-trained performance was sufficient.

Learnings:

  1. Real-world restaurant conversations are messier than training data (overlapping speech, background kitchen noise)
  2. Dietary restrictions (allergies) require human double-confirmation; automating this fully is risky
  3. Escalation to human staff is not a failure mode; it’s a feature for complex or ambiguous orders

Result: 150+ restaurants, ~50,000 voice orders processed, zero food-safety incidents attributed to AI misunderstanding.

order accuracy
96% on items, modifiers and quantities
transcription word error rate
3.2%

Stack

  1. Models & inference What does the thinking
    • Whisper (speech-to-text)
    • Mistral 7B (intent + entity extraction)
  2. Runtime & services What holds the connection open
    • Python (FastAPI, asyncio)
    • LiveKit (WebRTC)
    • SIP trunking
  3. Data & state What is remembered
    • PostgreSQL (field-level encryption)
  4. Cloud & delivery What it runs on
    • AWS (EC2, RDS, Lambda)
  5. Interfaces & integrations What people and other systems touch
    • Square Payments API