Node.js Semantic Search for Product Support — Stable Chat Contracts for Messy Catalogs
Description and use
An in‑app chatbot uses embeddings for semantic search over messy product descriptions, applies tenant filtering before the chat model call, and tracks usage per stage, providing a single credential and bill.
Problem
In‑app customer‑support chatbots need to retrieve relevant catalog items from messy product descriptions while keeping per‑tenant cost visibility and a stable API contract across provider changes.
Outcome
The chatbot now handles paraphrased queries with semantic search, enforces tenant boundaries before prompting the model, and tracks cost per tenant across ingestion, query, retrieval, and generation. A single credential and bill simplify operations while allowing provider flexibility.
Workflow
- Normalize each catalog description and attach tenant ID
- Create and store an embedding for each description
- Embed incoming support question
- Retrieve top candidate records within tenant boundary
- Send selected records and question to chat model for answer
Evidence
Embeddings give the description and the incoming question comparable semantic representations.
Similarity is not authorization. The tenant filter must run before the result reaches the prompt.
Use one ledger row per stage. An import event needs an import ID. A live question needs a request ID.
The single-key, one-bill model covers 295 routes across 20 modules.
- Record date: 2026-10-25T22:26:25.919Z