Skip to content

About

Arabic-Egyptian RAG assistant for Hikvision technical support using BM25, multilingual embeddings, OpenRouter, and Streamlit.

Topics

Resources

Stars

8 stars

Watchers

0 watching

Forks

Latest commit

ย 

History

7 Commits

Folders and files

NameName
Last commit message
Last commit date
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

๐ŸŽฅ HikAssist

Arabic-Egyptian RAG Assistant for Hikvision Technical Support

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.

๐Ÿš€ Live Demo

Open in Streamlit

๐Ÿ‘‰ Click here to try the application

Open in Streamlit

Python Streamlit RAG License


๐Ÿš€ Live Demo

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.


๐Ÿ“Œ Project Overview

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
  • ุงู„ุตูˆุฑุฉ ุจุงู„ู„ูŠู„ ู…ุด ูˆุงุถุญุฉ
  • ู†ุณูŠุช ูƒู„ู…ุฉ ู…ุฑูˆุฑ ุงู„ุฌู‡ุงุฒ

โœจ Key Features

  • 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

๐Ÿง  RAG Architecture

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]
Loading

The hybrid retrieval score combines sparse keyword matching and dense semantic similarity:

Hybrid Score = 0.35 ร— BM25 + 0.65 ร— Semantic Similarity

๐Ÿ”„ Application Workflow

  1. The user enters a technical question.
  2. Arabic text is cleaned and normalized.
  3. Egyptian Arabic technical terms are mapped to standardized forms.
  4. BM25 retrieves documents based on keyword overlap.
  5. Multilingual embeddings retrieve semantically similar documents.
  6. The two retrieval scores are combined.
  7. The highest-ranking documents are added to the prompt context.
  8. The language model generates an answer using only the retrieved sources.
  9. The response and relevant sources are displayed in Streamlit.

๐Ÿ› ๏ธ Technology Stack

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

๐Ÿ“ Project Structure

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

Main Modules

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

โš™๏ธ Local Installation

1. Clone the repository

git clone https://github.com/abdelrhmanmouse/simple-rag-lab.git
cd simple-rag-lab

2. Create a virtual environment

Windows PowerShell

python -m venv .venv
.\.venv\Scripts\Activate.ps1

Linux or macOS

python3 -m venv .venv
source .venv/bin/activate

3. Install dependencies

python -m pip install --upgrade pip
pip install -r requirements.txt

4. Configure environment variables

Copy the environment example file:

Windows

Copy-Item .env.example .env

Linux or macOS

cp .env.example .env

Open .env and add your OpenRouter configuration:

OPENROUTER_API_KEY=your_openrouter_api_key
OPENROUTER_MODEL=openai/gpt-4o-mini
OPENROUTER_TRANSLATION_MODEL=openrouter/free

Never upload a real API key to GitHub.

5. Create the Chroma vector store

python 05_create_chroma_store.py

6. Run the application

streamlit run streamlit_app.py

Open the local address shown in the terminal:

http://localhost:8501

โ˜๏ธ Streamlit Deployment

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.


๐Ÿ“š Knowledge Base

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

๐Ÿ“Š Evaluation

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

๐Ÿ” Security Notes

  • Never commit .env to 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.

โš ๏ธ Limitations

  • 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.

๐Ÿ”ฎ Future Improvements

  • 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

๐Ÿค Contributing

Contributions are welcome.

To contribute:

  1. Fork the repository.
  2. Create a new branch.
  3. Make your changes.
  4. Commit your changes.
  5. Push the branch.
  6. Open a Pull Request.

๐Ÿ‘จโ€๐Ÿ’ป Author

Developed as an educational Retrieval-Augmented Generation project for Arabic technical support.

GitHub: abdelrhmanmouse


๐Ÿ“„ Disclaimer

HikAssist is an independent educational project and is not an official Hikvision product.

Hikvision and related product names are trademarks of their respective owners.


โญ Support the Project

If you find this project useful, consider giving the repository a star.

Open the Live Application

About

Arabic-Egyptian RAG assistant for Hikvision technical support using BM25, multilingual embeddings, OpenRouter, and Streamlit.

Topics

Resources

Stars

8 stars

Watchers

0 watching

Forks

Releases

Contributors

Languages