A Retrieval-Augmented Generation application designed to help users diagnose common Hikvision camera, NVR, DVR, Hik-Connect, storage, network, playback, and image-quality issues using trusted support documents.
Try the deployed application directly on Streamlit Community Cloud:
The application may take a few seconds to start after a period of inactivity because it loads the multilingual embedding model during startup.
HikAssist is an Arabic conversational Retrieval-Augmented Generation system created to support users facing common Hikvision device problems.
The assistant accepts technical questions written in Arabic or Egyptian Arabic, retrieves the most relevant troubleshooting documents, and generates a grounded response based on the retrieved sources.
Example questions:
- ุงููุงู ูุฑุง ุฃูููุงูู ูู ุด ุธุงูุฑุฉ ุนูู ุงูู NVR
- ุงูู NVR ู ุด ุจูุณุฌู ุนูู ุงููุงุฑุฏ
- ุงููุงู ูุฑุงุช ู ุด ุธุงูุฑุฉ ุนูู Hik-Connect
- ุงูุตูุฑุฉ ุจุงูููู ู ุด ูุงุถุญุฉ
- ูุณูุช ููู ุฉ ู ุฑูุฑ ุงูุฌูุงุฒ
- Arabic and Egyptian Arabic query support
- Hybrid document retrieval
- BM25 keyword search
- Multilingual semantic embeddings
- Source-grounded answer generation
- Diagnostic follow-up questions
- Hikvision support-document citations
- Streamlit web interface
- OpenRouter LLM integration
- Offline retrieval fallback
- Public FAQ collection and translation pipeline
- Separate retrieval evaluation dataset
flowchart TD
A[User Question] --> B[Arabic Text Preprocessing]
B --> C[Query Representation]
C --> D[BM25 Keyword Retrieval]
C --> E[Multilingual Semantic Retrieval]
D --> F[Hybrid Scoring]
E --> F
F --> G[Top Relevant Chunks]
G --> H[Context Construction]
H --> I[OpenRouter LLM]
I --> J[Grounded Arabic Answer]
J --> K[Streamlit Interface]
The hybrid retrieval score combines sparse keyword matching and dense semantic similarity:
Hybrid Score = 0.35 ร BM25 + 0.65 ร Semantic Similarity
- The user enters a technical question.
- Arabic text is cleaned and normalized.
- Egyptian Arabic technical terms are mapped to standardized forms.
- BM25 retrieves documents based on keyword overlap.
- Multilingual embeddings retrieve semantically similar documents.
- The two retrieval scores are combined.
- The highest-ranking documents are added to the prompt context.
- The language model generates an answer using only the retrieved sources.
- The response and relevant sources are displayed in Streamlit.
| Component | Technology |
|---|---|
| Programming Language | Python |
| Web Interface | Streamlit |
| Sparse Retrieval | BM25 |
| Dense Retrieval | Sentence Transformers |
| Embedding Model | paraphrase-multilingual-MiniLM-L12-v2 |
| Vector Database | ChromaDB |
| LLM Provider | OpenRouter |
| Generation API | OpenAI-compatible API |
| Deployment | Streamlit Community Cloud |
| Data Format | Python and JSON |
simple-rag-lab/
โ
โโโ data/
โ โโโ raw/
โ โโโ processed/
โ
โโโ 01_documents.py
โโโ 02_preprocessing.py
โโโ 03_chunking.py
โโโ 04_vector_representation.py
โโโ 05_create_chroma_store.py
โโโ 06_retrieve_context.py
โโโ 07_prompting.py
โโโ 08_scrape_hikvision.py
โโโ 09_translate_scraped_data.py
โโโ 10_import_scraped_documents.py
โ
โโโ evaluation_questions.json
โโโ streamlit_app.py
โโโ requirements.txt
โโโ .env.example
โโโ .gitignore
โโโ README.md
| File | Responsibility |
|---|---|
01_documents.py |
Loads and organizes the knowledge documents |
02_preprocessing.py |
Normalizes Arabic and Egyptian Arabic text |
03_chunking.py |
Divides documents into searchable chunks |
04_vector_representation.py |
Creates embeddings and hybrid retrieval scores |
05_create_chroma_store.py |
Creates the persistent Chroma vector store |
06_retrieve_context.py |
Retrieves and formats relevant context |
07_prompting.py |
Builds prompts and calls the language model |
08_scrape_hikvision.py |
Collects public Hikvision support content |
09_translate_scraped_data.py |
Translates and restructures collected content |
10_import_scraped_documents.py |
Imports processed records into the knowledge base |
streamlit_app.py |
Runs the Streamlit user interface |
git clone https://github.com/abdelrhmanmouse/simple-rag-lab.git
cd simple-rag-labpython -m venv .venv
.\.venv\Scripts\Activate.ps1python3 -m venv .venv
source .venv/bin/activatepython -m pip install --upgrade pip
pip install -r requirements.txtCopy the environment example file:
Copy-Item .env.example .envcp .env.example .envOpen .env and add your OpenRouter configuration:
OPENROUTER_API_KEY=your_openrouter_api_key
OPENROUTER_MODEL=openai/gpt-4o-mini
OPENROUTER_TRANSLATION_MODEL=openrouter/freeNever upload a real API key to GitHub.
python 05_create_chroma_store.pystreamlit run streamlit_app.pyOpen the local address shown in the terminal:
http://localhost:8501
The application is deployed using Streamlit Community Cloud.
Deployment configuration:
Repository: abdelrhmanmouse/simple-rag-lab
Branch: main
Main file: streamlit_app.py
Python version: 3.11
Required Streamlit secrets:
OPENROUTER_API_KEY = "your_openrouter_api_key"
OPENROUTER_MODEL = "openai/gpt-4o-mini"
OPENROUTER_TRANSLATION_MODEL = "openrouter/free"Do not store API keys directly inside the repository.
The knowledge base contains sourced troubleshooting information covering areas such as:
- Cameras
- NVR and DVR devices
- Hik-Connect
- Network connectivity
- PoE problems
- Playback and recording
- Storage and hard-drive issues
- Password and device activation
- Image quality
- Night vision
- Remote access
Each document may contain:
- Document ID
- Title
- Category
- Product type
- Troubleshooting content
- Diagnostic questions
- Verification information
- Official source URL
The repository includes:
evaluation_questions.json
This file contains Egyptian Arabic evaluation questions and the expected source document for each question.
It can be used to calculate retrieval metrics such as:
- Hit Rate at K
- Recall at K
- Mean Reciprocal Rank
- Top-1 Accuracy
- Top-3 Accuracy
- Never commit
.envto GitHub. - Never expose the OpenRouter API key inside Python files.
- Store deployment keys in Streamlit Secrets.
- Use an API key with a spending limit for public applications.
- Do not request passwords, verification codes, or private device credentials from users.
- Sensitive operations such as reset, formatting, and firmware updates should include clear warnings.
- The application is intended for educational and technical-assistance purposes.
- Retrieval quality depends on the available knowledge documents.
- The generated response should not replace official Hikvision support.
- The application may require a short startup period after being inactive.
- Complex hardware or account-related problems may require escalation to an authorized technician.
- Add a cross-encoder reranker
- Add full conversational memory
- Add automatic retrieval evaluation
- Add response-groundedness evaluation
- Improve metadata filtering
- Expand the knowledge base
- Add multilingual support
- Improve document chunking
- Add feedback collection
- Add administrator analytics
- Cache embeddings for faster startup
- Connect retrieval directly to the persistent vector database
Contributions are welcome.
To contribute:
- Fork the repository.
- Create a new branch.
- Make your changes.
- Commit your changes.
- Push the branch.
- Open a Pull Request.
Developed as an educational Retrieval-Augmented Generation project for Arabic technical support.
GitHub: abdelrhmanmouse
HikAssist is an independent educational project and is not an official Hikvision product.
Hikvision and related product names are trademarks of their respective owners.
If you find this project useful, consider giving the repository a star.