Skip to content

feat(intent recognition): Added a shopping agent, llm, parser, e2e tests as well as unit tests - #33

Open
Biter01 wants to merge 6 commits into
mainfrom
feature/17/intent-recognition
Open

Biter01 wants to merge 6 commits into
mainfrom
feature/17/intent-recognition

Conversation

@Biter01

@Biter01 Biter01 commented Nov 27, 2026 •

Copy link
Copy Markdown
Collaborator

Related issue

Refs #17,#12

Summary

Adds intent recognition for the shop chat: a small in-browser LLM (Qwen 2.5 0.5B via WebLLM)
turns a chat message into a structured ShopRequest, and a shopping agent executes it.
Built an rudimentary UI(not finished) to test the llm and the agent!

How it works

  1. Parse (src/agent/message-parser/)
    • llm-parser.ts asks the model for a ShopRequest JSON, validated with shopRequestSchema (Zod).
    • llm-corrections.ts fixes the model output. That means what models get wrong: prices, quantity and gender, invented products ("number", "jacket")
  2. Act (src/agent/shopping-agent.ts)
    • Picks the action from (ShopRequest)intent: search, add_to_cart, remove_from_cart or off_topic.
    • Uses the helpers in src/agent/agent-util/ (product search, option matching, replies) to do a action.
  3. Reply: returns a ShopResponse, e.g. "Added 1 × T-Shirt to your cart", plus the shown
    options and the recognised request from the JSON from the parsing step (visible in the chat under "Recognised request").

Tests

  • Unit tests (pnpm test): parser corrections, agent behaviour and React client components.
  • Browser end to end (pnpm test:prompts, see doc/testing.md): replays a full chat
    conversation in Chrome with the real model

Known issues

  • The last e2e case ("I want a labtop …") is red on purpose: the model does not fix the typo
    "labtop" → "laptop". This should be handled by the semantic search in the backend.

Biter01 and others added 5 commits November 25, 2026 17:11
… rudimentary UI to test the LLM, refs #17 | time: 2h30m
…me with the real model. There is one known error included that should be solved through the semantic search in the backend (last test case). And executed pnpm format , refs #17 | time: 1h30m
@vercel

vercel Bot commented Nov 27, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
agentic-e-commerce Ready Ready Preview Nov 27, 2026 1:55pm UTC

@Biter01 Biter01 changed the title feat(intent recognition): Added a shopping agent, llm, parser, e2e tests as well as unit tests feat(intent recognition): Added a shopping agent, llm, parser, e2e tests as well as unit tests, refs #17 Nov 27, 2026
@Biter01 Biter01 changed the title feat(intent recognition): Added a shopping agent, llm, parser, e2e tests as well as unit tests, refs #17 feat(intent recognition): Added a shopping agent, llm, parser, e2e tests as well as unit tests Nov 27, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant