# Telecom Egypt Intelligent Assistant
A bilingual (Arabic / English / Egyptian dialect) customer service assistant for Telecom Egypt. Supports text chat, voice input/output, and user document upload — all grounded in retrieval from the official te.eg website, running fully on-premises via Ollama.
---
## 1. Architecture Overview
```
┌──────────────────────┐
│ Streamlit UI │ (ui.py)
│ text / voice / docs │
└──────────┬───────────┘
│ HTTP (requests)
┌──────────▼───────────┐
│ FastAPI backend │ (app/main.py)
│ /chat /upload /voice │
└──────────┬───────────┘
┌────────────────┼────────────────┐
▼ ▼ ▼
┌───────────────┐ ┌─────────────┐ ┌──────────────┐
│ faster-whisper│ │ RAG pipeline│ │ Piper │
│ (ASR, local) │ │ (rag/*) │ │ (TTS, local)│
└───────────────┘ └──────┬──────┘ └──────────────┘
│
┌───────────▼────────────┐
│ Qdrant (vector DB) │
│ collection: TE.Eg │
└───────────┬────────────┘
│
┌───────────▼────────────┐
│ bge-m3 embeddings + │
│ qwen2.5:7b generation │
│ (via Ollama) │
└────────────────────────┘
```
---
## 2. Tech Stack
| Component | Choice | Notes |
|---|---|---|
| LLM (generation) | `qwen2.5:7b` via Ollama | See §5 for why, not `qwen3.5` |
| Embeddings | `bge-m3` via Ollama | Multilingual, 1024-dim, verified on Arabic + English |
| Vector DB | Qdrant | Local, Docker, cosine similarity |
| ASR | `faster-whisper` (`large-v3`) | Auto language detection, VAD-filtered (see §6) |
| TTS | Piper | Local, `langdetect`-driven voice selection |
| Scraping | Playwright + BeautifulSoup | Liferay CMS requires JS rendering |
| Doc ingestion | pypdf, python-docx, EasyOCR | OCR fallback for scanned PDFs/images |
| Chunking | LlamaIndex `SentenceSplitter` | `chunk_size=300`, `overlap=50` |
| Backend | FastAPI + Uvicorn | |
| Frontend | Streamlit | |
| Package management | `uv` | |
---
## 3. Setup Instructions
### Prerequisites
- Python 3.14
- Ollama installed and running locally
- …