The model proposes, code decides
The model only fills a typed facts object. Everything with consequences (trip state, ETA, alerts) is plain code reading those facts after the output guard has checked them against what the driver actually said.
A WhatsApp agent for truck drivers that turns Tamil, Hindi, or English voice notes into trip updates, where the model proposes facts and plain code decides what happens.
Truck drivers report delays and problems by voice, in Tamil, Hindi, or English, often on a bad connection. Dispatchers and customers need structured updates fast, and a model that mishears a number or invents a place can send the wrong alert.
01
The webhook verifies the signature, returns immediately, and processes the message in the background. A message ID it has already seen is ignored.
02
Greetings, button taps, location pins, and commands are handled entirely in code. Only free text, voice, and photos go further.
03
Control characters are stripped, text is capped, and injection phrases are caught by rules. A flagged message never reaches a model and can never change a trip.
04
A TypeSafe Jev decision model extracts typed facts in one call and is accepted only above a learned confidence bar. Below it, the message goes to Gemini, then NVIDIA NIM, then plain rules.
05
Three failures open a provider's breaker, the cool-down doubles up to ten minutes, and a half-open probe brings it back. Background health checks run every two minutes.
06
Facts are clamped to the schema, delay numbers must come from the driver's own words, places the driver never mentioned are dropped, and safety words force a human. The model has no tools.
07
Trip status, ETA, and flags are updated in plain code, and only fixed templates go to customers and dispatchers. Urgent or unsafe reports go straight to a person.
08
Drivers' correct and wrong taps become few-shot examples and move the confidence bar: up when accuracy drops below 85%, down when it passes 95%, always between 0.60 and 0.98.
The model only fills a typed facts object. Everything with consequences (trip state, ETA, alerts) is plain code reading those facts after the output guard has checked them against what the driver actually said.
A 25-second safety net replies to the driver even if every model is slow or down, and the message is replayed later once a provider recovers.
Python · FastAPI · SQLite · WhatsApp Cloud API · TypeSafe Jev · Gemini · Groq Whisper · NVIDIA NIM · OpenRouteService · Docker