Add deterministic geography: precomputed nearest-office distances injected per turn
The 2026-07-05 Weston call (CA3e88ce) showed the model guessing geography: it
recommended Boca Raton for a Weston caller (real answer: Pembroke Pines, ~9 mi),
invented distances ('Weston to Hialeah is twenty miles'), and confirmed a
nonexistent Miami Lakes office when the caller insisted.
- practice.py: office lat/lon + ~70-place South Florida gazetteer + haversine;
geography_block() renders a full distance table (closest first) from the
caller's area to every office. 'Westin' aliased to Weston (STT spelling).
- callstate.py: extractor gains caller_area; CallStateGroomer appends the
GEOGRAPHY block to the system message — zero-lag via a synchronous gazetteer
scan of user turns until the extractor catches up.
- bot.py: DISTANCES prompt rule (answer only from GEOGRAPHY, never estimate),
only-these-8-offices guard, caller-area cities added to Whisper hotwords
('Weston' was heard as 'Western Florida').
Verified: staged replay of the failed exchanges on activeblue-avc:latest —
correct office, correct distances, Miami Lakes denied (5/5 + 3/3 runs).
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
16
bot.py
16
bot.py
@@ -103,7 +103,11 @@ WHISPER_COMPUTE = os.environ.get("WHISPER_COMPUTE", "float16")
|
||||
WHISPER_HOTWORDS = os.environ.get(
|
||||
"WHISPER_HOTWORDS",
|
||||
"Advanced Vision Care, eye exam, annual exam, appointment, optometry, contact lens, "
|
||||
"Hialeah, Kendall, Tamarac, Pembroke Pines, Lauderdale Lakes, Miami Gardens, Boca Raton",
|
||||
"Hialeah, Kendall, Tamarac, Pembroke Pines, Lauderdale Lakes, Miami Gardens, Boca Raton, "
|
||||
# Common caller-area cities (not offices) — the 2026-07-05 call heard "Weston" as
|
||||
# "Western Florida" repeatedly, which broke the nearest-office flow.
|
||||
"Weston, Davie, Miramar, Plantation, Sunrise, Hollywood, Coral Springs, Doral, "
|
||||
"Miami Lakes, Aventura, Coral Gables, Homestead, Cutler Bay",
|
||||
)
|
||||
|
||||
# Twilio sends 8 kHz mu-law on the wire, but faster-whisper assumes any numpy array is
|
||||
@@ -245,7 +249,15 @@ SYSTEM_PROMPT = (
|
||||
"that matches one of our offices (for example they say 'Kendall' and we have a Kendall "
|
||||
"office), simply confirm THAT office and move on — do NOT offer, compare, or mention any "
|
||||
"other office or city, and do NOT ask them to choose between offices. Only if their area "
|
||||
"matches no office should you name the single nearest one. List offices only if asked.\n"
|
||||
"matches no office should you name the single nearest one. List offices only if asked. "
|
||||
"The offices in PRACTICE FACTS are our ONLY offices — never agree we have an office "
|
||||
"somewhere else, even if the caller insists you mentioned one.\n"
|
||||
"- DISTANCES / CLOSEST OFFICE: when a GEOGRAPHY section appears below, answer distance and "
|
||||
"closest-office questions from it word for word — it already lists approximate driving "
|
||||
"miles from the caller's area to every office, closest first. If there is no GEOGRAPHY "
|
||||
"section yet, ask what city or area they're in. NEVER estimate, compute, or guess a "
|
||||
"distance or drive time yourself, and never claim an office is 'close to' or 'near' a "
|
||||
"place unless the GEOGRAPHY section says so.\n"
|
||||
"- INSURANCE — log only, never promise, never guess: ask open-endedly what insurance they "
|
||||
"have (for example, 'What insurance do you have?'). Do NOT read out or suggest plan names "
|
||||
"from the list — let the caller tell you. Capture ONLY what the caller actually says; NEVER "
|
||||
|
||||
Reference in New Issue
Block a user