Skip to content

About

magicpin AI Challenge submission — an LLM-powered merchant engagement assistant featuring trigger-based message composition, context-aware prompting, intent transition handling, auto-reply detection, and multi-provider AI support.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

1 Commit

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Vera Bot — magicpin AI Challenge Submission

Approach

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.

Architecture

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)

Key Design Decisions

  1. Trigger-kind dispatch: Different prompt framing per trigger kind (research_digest → peer-knowledge, recall_due → slot-offer, perf_dip → concern+solution, etc.)
  2. Category voice injection: Voice rules (tone, vocab, taboos) are serialized into the prompt directly from CategoryContext, ensuring category-fit on every message.
  3. Multi-layer auto-reply detection: Regex patterns + repeat tracking. One auto-reply → flag it; two → wait 24h; three → exit.
  4. Intent transition: Commit phrases ("let's do it", "go ahead") trigger immediate switch from qualifying to action mode — no extra qualifying questions.
  5. Post-LLM validation: Strips URLs, normalizes CTA, ensures non-empty body, provides safe fallback messages on LLM failure.
  6. Model-agnostic: Supports OpenAI, Anthropic, Gemini, DeepSeek, Groq via env vars. Temperature=0 for deterministic output.

Tradeoffs

  • 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.

Additional Context That Would Help

  • 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

Setup

pip install fastapi uvicorn
export LLM_PROVIDER=openai
export LLM_API_KEY=sk-...
uvicorn bot:app --host 0.0.0.0 --port 8080

About

magicpin AI Challenge submission — an LLM-powered merchant engagement assistant featuring trigger-based message composition, context-aware prompting, intent transition handling, auto-reply detection, and multi-provider AI support.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages