Prompt-dispatch composer — a single LLM-powered composer with trigger-kind routing. The same engine handles both merchant-facing (Vera→merchant) and customer-facing (merchant→customer) messages by varying the 4 context inputs.
HTTP API (FastAPI) → Composer (LLM) ← CategoryContext + MerchantContext + TriggerContext + CustomerContext?
→ Post-LLM Validator (URL strip, CTA check, empty-body guard)
→ Auto-reply Detector (regex + repeat counter)
→ Intent Transition Handler (commitment phrase detection)
- Trigger-kind dispatch: Different prompt framing per trigger kind (research_digest → peer-knowledge, recall_due → slot-offer, perf_dip → concern+solution, etc.)
- Category voice injection: Voice rules (tone, vocab, taboos) are serialized into the prompt directly from CategoryContext, ensuring category-fit on every message.
- Multi-layer auto-reply detection: Regex patterns + repeat tracking. One auto-reply → flag it; two → wait 24h; three → exit.
- Intent transition: Commit phrases ("let's do it", "go ahead") trigger immediate switch from qualifying to action mode — no extra qualifying questions.
- Post-LLM validation: Strips URLs, normalizes CTA, ensures non-empty body, provides safe fallback messages on LLM failure.
- Model-agnostic: Supports OpenAI, Anthropic, Gemini, DeepSeek, Groq via env vars. Temperature=0 for deterministic output.
- No retrieval/RAG: Full digest items are included in the prompt. Works for the scale of this challenge (10-20 digest items per category). Would need retrieval at production scale.
- In-memory storage: Fine for 60-min test window. Not production-ready.
- Single-pass LLM: No iterative refinement. Keeps latency <10s per composition.
- No peer-merchant social proof: The dataset doesn't provide cross-merchant comparison data (what other merchants are doing). This is a known gap that limits social-proof levers.
- Cross-merchant behavioral data (what peers actually did, not just benchmarks)
- Real-time Google Trends data for location-specific queries
- Historical A/B test results on message variants
- Merchant's WhatsApp reply cadence/patterns
- Actual booking/scheduling system integration for real slot availability
pip install fastapi uvicorn
export LLM_PROVIDER=openai
export LLM_API_KEY=sk-...
uvicorn bot:app --host 0.0.0.0 --port 8080