{"id":51502930,"url":"https://github.com/a-xp/decathlon-chat-bot","last_synced_at":"2026-07-07T21:30:25.067Z","repository":{"id":358324519,"uuid":"1240937980","full_name":"a-xp/decathlon-chat-bot","owner":"a-xp","description":"Decathlon catalog chat consultant — agentic tool-use loop over a local LLM with vector search (FastAPI, Chroma, bge-m3)","archived":false,"fork":false,"pushed_at":"2026-06-19T20:09:43.000Z","size":155,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"master","last_synced_at":"2026-06-19T22:07:22.403Z","etag":null,"topics":["agent","chromadb","fastapi","llm","python","rag","vector-search"],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/a-xp.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2026-05-16T18:59:06.000Z","updated_at":"2026-06-19T20:09:48.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/a-xp/decathlon-chat-bot","commit_stats":null,"previous_names":["a-xp/decathon-chat-bot","a-xp/decathlon-chat-bot"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/a-xp/decathlon-chat-bot","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/a-xp%2Fdecathlon-chat-bot","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/a-xp%2Fdecathlon-chat-bot/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/a-xp%2Fdecathlon-chat-bot/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/a-xp%2Fdecathlon-chat-bot/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/a-xp","download_url":"https://codeload.github.com/a-xp/decathlon-chat-bot/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/a-xp%2Fdecathlon-chat-bot/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":35243953,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-07-07T02:00:07.222Z","response_time":90,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["agent","chromadb","fastapi","llm","python","rag","vector-search"],"created_at":"2026-07-07T21:30:24.378Z","updated_at":"2026-07-07T21:30:25.057Z","avatar_url":"https://github.com/a-xp.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Decathlon Product Expert\n\nA chat consultant for the Decathlon (KZ) catalog. Ask it about sports gear in\nplain language and it answers like a knowledgeable in-store advisor —\ngrounded in real catalog products via retrieval.\n\n## How it works\n\nEach chat turn runs an agentic tool-use loop before the assistant replies:\n\n1. **Category discovery** — the model calls `find_categories` to look up valid\n   category paths when it wants to narrow the search to a section.\n2. **Search** — the query is embedded (bge-m3) and matched against the product\n   catalog in a local Chroma store, optionally filtered by gender, category,\n   brand, size, and color.\n3. **Facet exploration** — the model calls `get_facets` to see what colors,\n   brands, sizes, and price ranges actually exist for a product type — used when\n   the user asks \"what options are available?\" or when a search returns nothing.\n4. **Product detail** — the model can call `get_product` for full specs\n   (composition, sizes, benefits) before a detailed comparison.\n5. **Answer** — the assistant recommends from retrieved products; the UI renders\n   cited ones as cards.\n\nEverything (chat, embeddings) talks to a single **OpenAI-compatible endpoint** — LM Studio by default, but any compatible server works.\n\n\u003e For architecture decisions and non-obvious design choices, see\n\u003e [`CLAUDE.md`](CLAUDE.md).\n\n## Project layout\n\n```\ndecathlon/\n  app/\n    main.py         # FastAPI app: chat API (/api/chat) + static UI\n    agent.py        # tool-use loop: tool schemas, executors, run_agent()\n    search.py       # vector search over the products collection\n    productdb.py    # request-time SQLite reader for get_product\n    catalog.py      # category display paths + id\u003c-\u003edisplay maps\n    static/\n      index.html    # chat UI\n  core/\n    embeddings.py   # bge-m3 embeddings via the OpenAI endpoint\n    vectordb.py     # Chroma client + collection helpers\n    documents.py    # shared helpers for indexed document format\n  indexing/\n    index.py        # build vector store from products.db\n    query.py        # CLI to debug retrieval without the LLM\n  scrapers/\n    categories.py   # scrape category tree -\u003e products.db\n    products.py     # scrape product catalog -\u003e products.db\nproducts.db         # scraped catalog (git-ignored, built by scrapers)\nchroma_data/        # vector store (git-ignored, built by index-vectors)\n```\n\n## Setup\n\nYou need an OpenAI-compatible endpoint serving a **tool-capable chat model**\n(e.g. `google/gemma-4-31b`) and an **embedding model** (`bge-m3`). LM Studio\nworks out of the box.\n\n```sh\ncp .env.example .env   # adjust OPENAI_BASE_URL / model names if needed\nuv sync                # install dependencies\n```\n\nBuild the catalog and vector store (scrapes the catalog, then embeds it):\n\n```sh\nmise run reindex\n```\n\nThis is the one command for a fresh catalog — it runs the category and product\nscrapers and rebuilds the vector index in order. The individual steps\n`fetch-categories`, `fetch-products`, and `index-vectors` still exist if you\nneed to run just one.\n\n## Run\n\n```sh\nmise run ui\n```\n\nOpen http://localhost:8000/.\n\n## Configuration\n\nSettings are read from the environment; a local `.env` is loaded automatically\n(real env vars take precedence). See [`.env.example`](.env.example) for the\nfull list. Most-used:\n\n| Var                  | Default                     | Purpose                               |\n|----------------------|-----------------------------|---------------------------------------|\n| `OPENAI_BASE_URL`    | `http://localhost:1234/v1`  | OpenAI-compatible endpoint            |\n| `OPENAI_MODEL`       | `google/gemma-4-31b`        | Chat + tool-use model                 |\n| `OPENAI_EMBED_MODEL` | `bge-m3`                    | Embedding model                       |\n| `OPENAI_API_KEY`     | `lm-studio`                 | API key (any string for LM Studio)    |\n| `OPENAI_TIMEOUT`     | `120`                       | Request timeout in seconds            |\n| `CHROMA_PATH`        | `./chroma_data`             | Vector store location                 |\n| `PRODUCT_SEARCH_N`   | `10`                        | Products retrieved per search call    |\n| `MAX_TOOL_ROUNDS`    | `6`                         | Max tool-call rounds per turn         |\n| `CHAT_LANGUAGE`      | `auto`                      | Force reply language, or match user   |\n| `PORT`               | `8000`                      | HTTP port for the chat UI             |\n\n## Debugging retrieval\n\nQuery the vector store directly, without the LLM:\n\n```sh\nmise run query-vectors \"носки детские\"\nmise run query-vectors \"палатка\" --collection categories -n 5\nmise run query-vectors \"обувь\" --ancestor 583\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fa-xp%2Fdecathlon-chat-bot","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fa-xp%2Fdecathlon-chat-bot","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fa-xp%2Fdecathlon-chat-bot/lists"}