Skip to content

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Repository files navigation

RetailIQ

Retail and supply chain intelligence that runs on your own machine. You upload CSVs or PDFs, ask questions in plain English, and get answers back — no external APIs, no data leaving your machine.

Built to work with real inventory files, sales exports, and supplier docs without pushing anything to a cloud service. Everything runs locally through Ollama.

What it does

Inventory Q&A — drop in a product catalog or inventory CSV and ask things like "which items are below reorder level" or "what's our stock situation for electronics." Uses ChromaDB + LangChain RAG under the hood.

Demand forecasting — trains a small LSTM on your sales history and predicts next-period demand per product. MLflow tracks each training run so you can compare results over time. Works best with 12+ months of data per product.

Supply chain risk — a ReAct agent that searches through uploaded supplier contracts and inventory data. Good for questions like "which suppliers have the longest lead times" or "any contracts expiring soon."

Customer sentiment — same RAG pipeline but against review data. Useful for "what are customers complaining about for product X" type queries.

Data monitoring — Evidently AI for quality checks and drift detection. Upload a CSV, get back a report on missing values and distribution shifts.

Requirements

  • Python 3.11
  • Ollama installed
  • Docker (optional)

Getting started

# first time only
bash setup.sh

# start everything
bash start.sh

Pulls llama3, creates the venv, installs deps, and starts Ollama + MLflow + FastAPI + Streamlit. Open http://localhost:8501.

The sample data in data/sample/ loads automatically on backend startup so all five tabs have something to show right away.

Docker

docker compose build
docker compose up -d

Same ports, same behavior. Ollama runs in its own container and pulls llama3 on first boot (~4.7 GB, takes a few minutes). Subsequent starts use the cached volume.

Running services manually

# terminal 1
ollama serve

# terminal 2
source .venv/bin/activate
mlflow server --host 0.0.0.0 --port 5001 --backend-store-uri ./mlruns

# terminal 3
source .venv/bin/activate
PYTHONPATH=$(pwd) uvicorn backend.api.main:app --host 0.0.0.0 --port 8000 --reload --reload-dir backend --reload-dir frontend

# terminal 4
source .venv/bin/activate
PYTHONPATH=$(pwd) streamlit run frontend/app.py --server.port 8501

Streamlit at :8501, FastAPI docs at :8000/docs, MLflow at :5001, Ollama at :11434.

Environment variables

Copy .env.example to .env — defaults work for local setup out of the box.

Variable Default
OLLAMA_BASE_URL http://localhost:11434
OLLAMA_MODEL llama3
CHROMA_PERSIST_DIR ./data/chroma_db
MLFLOW_TRACKING_URI http://localhost:5001
EMBEDDING_MODEL sentence-transformers/all-MiniLM-L6-v2

If you change OLLAMA_MODEL, run ollama pull <model> first.

Sample data

Loaded automatically on startup:

  • inventory.csv — 15 products with stock levels, reorder points, supplier IDs
  • sales_history.csv — monthly units sold per product across 2023
  • supplier_info.csv — 5 suppliers with lead times, reliability scores, risk levels
  • customer_reviews.csv — 16 reviews across 5 products with ratings
  • retail_qa.json — QA pairs for LoRA fine-tuning

To re-seed manually: PYTHONPATH=$(pwd) python scripts/seed_data.py

Fine-tuning

source .venv/bin/activate
PYTHONPATH=$(pwd) python backend/finetuning/lora_finetune.py data/sample/retail_qa.json

Saves the fine-tuned model to data/peft_model/. Uses DistilBERT + LoRA by default.

License

MIT

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages