Node.js Semantic Search for Product Support — Stable Chat Contracts for Messy Catalogs
Описание и применение
Внутренний чат‑бот использует эмбеддинги для семантического поиска по неструктурированным описаниям товаров, применяет фильтрацию по арендаторам до вызова модели чата и ведёт учёт затрат по каждому этапу, обеспечивая единый ключ и счёт.
Задача
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.
Результат
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.
Рабочий процесс
- 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
Доказательства
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.
- Дата записи: 2026-10-25T22:26:25.919Z