An AI-powered document assistant for e-commerce sellers. Upload supplier contracts, product specs, return/shipping policies, and platform TOS documents, then ask plain-English questions and get cited answers pulled from your own documents.
Built as a Retrieval-Augmented Generation (RAG) app for solo and small Shopify, Amazon, and Etsy sellers — an affordable, self-serve alternative to enterprise procurement suites.
Repo: https://github.com/Muhammad-Anas59/SellerDocs_AI
| Login | ![]() |
| Home | ![]() |
| Knowledge Bases | ![]() |
| Upload | ![]() |
| Chat | ![]() |
| Evaluation | ![]() |
- Multiple knowledge bases per user — organize documents by topic (e.g. "Supplier Contracts", "Etsy Policies") so searches stay scoped and relevant
- Conversational memory — ask follow-up questions within a knowledge base without repeating context
- Cross-document reasoning — ask questions that span multiple documents in the same knowledge base; the assistant flags disagreements between sources instead of silently picking one
- Document-change tracking — replace an outdated document with a new version; old content is removed from search, not just superseded
- Evaluation module — define test questions with expected sources/keywords, run them against the live pipeline, and track retrieval accuracy over time
- Rate-limit aware — respects Gemini's free-tier token-per-minute limits automatically, with retry-with-backoff on transient errors
- Security hardened — CSRF protection, rate-limited auth endpoints, secure session cookies, and enforced password strength
| Layer | Technology |
|---|---|
| Backend | Flask (Python) |
| Frontend | Jinja2 templates + Tailwind CSS (CDN, no build step) |
| LLM | Google Gemini API (gemini-3.5-flash) |
| Embeddings | Google Gemini API (gemini-embedding-001) |
| Vector store | FAISS (per-knowledge-base index files) |
| Database | SQLite via Flask-SQLAlchemy |
| Auth | Flask-Login |
| Security | Flask-WTF (CSRF), Flask-Limiter (rate limiting) |
| Text extraction | pypdf (PDF), python-docx (Word), plain read (TXT) |
| Chunking | langchain-text-splitters (RecursiveCharacterTextSplitter) |
| Containerization | Docker |
| Deployment | Render |
A document you upload is extracted to plain text, split into overlapping chunks, and each chunk is converted into a vector embedding via the Gemini API. Those vectors are stored in a FAISS index scoped to the knowledge base you uploaded into.
When you ask a question, it's embedded the same way and used to search that knowledge base's index. The closest-matching chunks — spread across multiple source documents where relevant — are handed to Gemini along with your question and recent conversation history, and it generates an answer that cites which document each claim came from.
config.py Loads .env, sets SECRET_KEY, GEMINI_API_KEY, database URI
models.py SQLAlchemy models: User, KnowledgeBase, Document, Message, EvalCase, EvalResult
utils.py Core RAG logic: text extraction, chunking, embedding, FAISS indexing, search, answer generation
app.py Flask routes: auth, knowledge bases, upload, chat, evaluate
templates/ Jinja2 templates (base layout + one per page)
faiss_indexes/ Per-knowledge-base FAISS index and metadata files (created at runtime)
uploads/ Uploaded document files (created at runtime)
Project Images/ Screenshots used in this README
Dockerfile Container build definition
docker-compose.yml Local multi-container orchestration
Requirements: Python 3.11+, a Google Gemini API key (aistudio.google.com)
Clone the repo, then from the project root:
git clone https://github.com/Muhammad-Anas59/SellerDocs_AI.git
cd SellerDocs_AI
python -m venv .venv
.venv\Scripts\activate # Windows
# source .venv/bin/activate # macOS/Linux
pip install -r requirements.txt
Create a .env file in the project root:
SECRET_KEY=your-random-secret-key
GEMINI_API_KEY=your-gemini-api-key
Run the app:
python app.py
Visit http://127.0.0.1:5000. The database and FAISS index folders are created automatically on first run.
With the same .env file created as above:
docker compose up --build
Visit http://localhost:5000.
- Gemini's free tier enforces a tokens-per-minute limit on embeddings; large document uploads may pause briefly to stay under it. See utils.py's rate limiter for details.
- FAISS's IndexFlatL2 doesn't support deleting individual vectors — replacing a document rebuilds that knowledge base's entire index rather than patching it in place. Fine at small-to-medium scale, worth revisiting if a knowledge base grows very large.
- SQLite and FAISS index files are stored on local disk — on ephemeral hosting (e.g. free-tier Render), data may not persist across restarts unless backed by persistent storage or a managed database.
- Multiple named knowledge bases per user
- Conversational memory
- Cross-document reasoning
- Document-change tracking
- Evaluation module
- Security hardening (CSRF, rate limiting, secure cookies)
- Docker packaging
- Production deployment





