Short answer: make the LLM's output a proposal, then admit it through a versioned closed-set contract that accepts one JSON object, rejects every label outside the active taxonomy, and commits one canonical result for each product revision. A Node.js worker can own the model call, but a deterministic boundary must own publication.
The least complex dependable design has four records: normalized product text, a taxonomy snapshot, the untrusted model response, and an accepted classification. This separation matters because syntactically valid JSON can still contain an obsolete category, a duplicate label, or a perfectly spelled label from the wrong taxonomy version. Those failures are more dangerous than a parse error: they look finished.
How can a Node.js LLM keep ecommerce product labels exact?
Define “exact” before choosing a prompt. For multi-label text classification, exactness has three independent dimensions: the response is exactly one JSON object; its labels member is an array of strings with no undeclared sibling fields; and every string belongs to the taxonomy version attached to the request. The third condition is the one a JSON parser can't prove by itself.
Use stable machine identifiers such as department.kitchen, material.stainless_steel, and use.outdoor; keep display names and translations outside the model contract. The request should identify the product revision, taxonomy version, and policy version, while the response should remain deliberately small:






