Year 2025 · KLIKIT · Architect · Shipped
Partner menu-mapping copilot
A retrieval-and-rerank pipeline that compresses partner menu mapping from a multi-week manual process into a confidence-gated self-service workflow, with explicit guardrails on safety-critical fields.
Context
Onboarding a new partner system — point-of-sale, inventory, or enterprise resource planning — required, on average, several weeks of effort per partner. The dominant cost was menu mapping: an internal engineer hand-matching the partner's items, modifiers, and modifier groups against the platform's canonical catalogue. The work was made slow and error-prone by multilingual titles, deeply nested modifier groups, and the wide variance of incoming formats — comma-separated files, JSON, screenshots, and in some cases photographs of printed menus. The throughput required by the business could not be sustained by linear human effort.
Design
- A dedicated mapping service with input adapters for ingesting partner menus in any reasonable shape and normalising them into a canonical tree.
- A hybrid retrieval pipeline: lexical (trigram + token) matching, embedding-based cosine similarity, price-band filtering, and hierarchical context — modifiers gated by their parent item's mapping.
- A large-language-model reranker over the top candidates, with prompt caching for the canonical menu and a per-partner few-shot pool assembled from prior corrections. The model sharpens on a given partner over time without fine-tuning.
- A confidence gate: high-confidence mappings auto-apply; everything below threshold is queued for manual review.
- A hard safety boundary: allergen and dietary mismatches always drop to manual review, regardless of textual confidence. The line between "a week of effort saved" and "a wrong order in front of an allergic customer" is non-negotiable, and the architecture enforces that asymmetry.
- A per-partner monthly token budget enforced at the credential layer. AI is treated as a metered, billable platform service rather than as a free utility.
Outcome
The mapping bottleneck collapses from weeks to hours for the typical partner. Equally important, the partner can self-serve from the first day of onboarding rather than waiting on a queue of internal engineers. The same retrieval primitive is now reused as a first-class endpoint by other AI surfaces on the platform (see the agent-facing API design).
Stack
Go · Echo · Asynq · GORM · MySQL · LLM gateway (model-agnostic) · embedding API.