RU

A store assistant on a local 9B model: a case study breakdown

Published: 2026-09-30 · Author: AI Release · @ai_releaseorg
A store assistant on a local 9B model: a case study breakdown

⚡ The gist in 5 seconds

🔍 What was found

The case study on Habr describes a dialogue: a customer writes "a gift for my brother, he's 30, loves board games, under $70." The assistant asks when the birthday is and learns there are 5 working days left until Friday. Per store rules, such an order gets a 20% discount, so three gifts worth $83.99 fit into the $70 budget, coming to $67.19 after the discount. The dialogue is handled by the qwen3.5 9B model, running in LM Studio in 4-bit format (about 6 GB) on a MacBook M3 Max. Instead of LM Studio, you can plug in any OpenAI-compatible API — the address, model, and key are set in.env. The architecture is a monorepo: apps/backend on NestJS 11, Prisma 7, and PostgreSQL; apps/harness — the assistant itself with no database of its own; apps/frontend on React 19, Vite, and HeroUI; packages/contracts — zod schemas; bench — benchmarks. The catalog has 64 products, 3 are out of stock, and 8 require buying batteries or wrapping paper separately. Each message triggers 8 steps, of which the model handles only 3: parsing the message, selecting products, and writing the reply. Medians across 6 conversations: parsing ~3.3 s, selection ~4.3 s, reply ~2 s, while the SQL filter takes ~22 ms and price calculation ~9 ms. An answer to a question arrives in 3–7 seconds; product suggestions take 9–15 seconds. Across six customers, the assistant never exceeded the budget and never quoted an incorrect amount.

💡 Why it matters

The case demonstrates a working pattern for separating responsibilities: the model handles only dialogue and selection, while verifiable operations are done by code. The assistant talks to the store via two requests — product search with filters for age, price, and delivery time, and order total calculation — so it can be connected to a real online store via API. Customer-facing questions live in a config file, so adapting to another store only requires changing that file, not the code. The model's reply is validated before sending: the code finds all dollar amounts, cross-checks them against backend data, and if a made-up figure appears, replaces the reply with a template.

🧩 Context

The first version of the assistant made mistakes with dates: if you wrote "by Monday" on a Saturday, the model would set the following week's Monday. So now the model doesn't compute the date — it only extracts the word "Monday" from the message, while the code calculates the date and the number of working days. For product selection, the model picks up to 5 top items from a list already filtered by an SQL query, following a JSON schema, and the code fits them into the budget, skipping anything that doesn't fit. A separate fitsRequest flag helps respond correctly when no suitable product exists: the model honestly marks it as unsuitable. First, the assistant offers one gift and two backup options, and when sever

🔗 Read on habr.com

🤖 AI summary
  • Date: 2026-09-30
  • Source: habr.com
  • Tags: AI, e-commerce, Open
  • Key facts:
    • Author nmrcs built a gift store assistant on a local qwen3.5 9B model: it clarifies the customer's request and suggests products, while the total, discount, and cart are computed by code.
    • The source code is open in the nmrcs/cart-agent repository on npm workspaces, alongside a mock store you can download and run locally.
    • Streaming the response text is nearly pointless: the model spends 2 seconds writing the answer out of a 9–15 second total wait, so the UI shows processing stages instead.
    • The case study on Habr describes a dialogue: a customer writes "a gift for my brother, he's 30, loves board games, under $70." The assistant asks when the birthday is and learns there are 5 working days left until Friday.
    • Per store rules, such an order gets a 20% discount, so three gifts worth $83.99 fit into the $70 budget, coming to $67.19 after the discount.
    • The dialogue is handled by the qwen3.5 9B model, running in LM Studio in 4-bit format (about 6 GB) on a MacBook M3 Max.
    • Instead of LM Studio, you can plug in any OpenAI-compatible API — the address, model, and key are set in.env.
    • The architecture is a monorepo: apps/backend on NestJS 11, Prisma 7, and PostgreSQL; apps/harness — the assistant itself with no database of its own; apps/frontend on React 19, Vite, and HeroUI; packages/contracts — zod schemas; bench — benchmarks.
AIe-commerceOpen
📖
Read the guide on this topic
Read →
← PreviousMicrosoft releases WSL 3.0 with support for running Linux containers in...Next →Gemma 4 on a server: running it via Ollama or llama.cpp

Source: habr.com · post in Telegram