From 05739a455b824f6f3d78f154c1ecaf3b5ae68917 Mon Sep 17 00:00:00 2001 From: Matthew Jackson Date: Fri, 6 Mar 2026 16:25:32 -0800 Subject: [PATCH] Fix AI hallucinating street addresses and other facts MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Add street/address pattern to answerFor() — returns profile address or empty string - Update AI prompt: return "UNKNOWN" instead of guessing facts - Handle UNKNOWN response by treating it as no answer (triggers Telegram ask) Co-Authored-By: Claude Opus 4.6 --- lib/form_filler.mjs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/lib/form_filler.mjs b/lib/form_filler.mjs index ea4b5c0..05ee69c 100644 --- a/lib/form_filler.mjs +++ b/lib/form_filler.mjs @@ -153,6 +153,7 @@ export class FormFiller { } if (l.includes('email')) return p.email || null; if (l.includes('phone') || l.includes('mobile')) return p.phone || null; + if (l.includes('street') || (l.includes('address') && !l.includes('email'))) return p.location?.address || ''; if (l.includes('city') && !l.includes('remote')) return p.location?.city || null; if (l.includes('zip') || l.includes('postal')) return p.location?.zip || null; if (l.includes('country code') || l.includes('phone country')) return 'United States (+1)'; @@ -242,7 +243,7 @@ Rules: - For yes/no or multiple choice, return ONLY the exact option text - For short-answer fields, be brief and direct (1 line) - Use first person -- Never make up facts +- NEVER guess or fabricate factual information (addresses, numbers, dates, credentials, etc.) — if you don't know, return exactly: UNKNOWN - Just the answer text — no preamble, no explanation, no quotes`; const userPrompt = `Candidate: ${this.profile.name?.first} ${this.profile.name?.last} @@ -275,6 +276,10 @@ Answer:`; if (!res.ok) return null; const data = await res.json(); const answer = data.content?.[0]?.text?.trim() || null; + if (answer === 'UNKNOWN') { + console.log(` [AI] "${label}" -> UNKNOWN (skipping)`); + return null; + } if (answer) console.log(` [AI] "${label}" -> "${answer}"`); return answer; } catch {