A context-based chatbot designed to answer specialized cybersecurity questions based on 500+ scientific cybersecurity articles (in text format). It provides quick, fact-based answers – solely grounded in the available documents.
This project was created as part of a module at the Bern University of Applied Sciences by:
- Carlos Gomez
- Nelson Vidovic
- Lirim Zahiri
- Mouad Medini
- Niklaus Joel
- Official website: https://www.python.org/downloads/
- During setup, enable "Add Python to PATH"
- Then verify installation in your terminal:
python --version- Go to https://www.together.ai.
- Click "Get started" and register (no credit card needed).
- After logging in, your API KEY will show up automatically.
- If not, go to your dashboard at https://api.together.ai.
- Navigate to "API Keys" (bottom-left corner).
- Click "Create new API key", give it a name (e.g. chatbot-key), and copy the key.
- Save the key securely.
- This key is free, but subject to rate limits (e.g. ~50 requests/min, ~200,000 tokens/day).
git clone https://github.com/VNel/SAI3_Chatbot.git
cd SAI3_Chatbot/online_chatbot- Windows:
py -m venv venv- macOS:
python3 -m venv venv- Windows:
venv\Scripts\activate.bat- macOS:
source venv/bin/activatepip install -r requirements.txtfastapi
uvicorn
requests
gradio
python-dotenv
faiss-cpu
sentence-transformers
numpy
- Select the file
.env.template - Rename it to
.env - Then open
.envand insert your API key:
TOGETHER_API_KEY=<your_api_key>Without
.env, the chatbot cannot communicate with Together.ai.
- Windows:
py load_data.py- macOS:
python3 load_data.py-
Creates
documents.json(text chunks) -
Windows:
py build_index.py- macOS:
python3 build_index.py- Creates
index.faiss(semantic search index)
- Windows:
py web_ui.py- macOS:
python3 web_ui.pyAutomatically opens: http://localhost:7860
- Ask questions in German or English
- Answers are based only on local documents
- No hallucination
- Transparent source citation for each answer
- If no relevant info is found → clear feedback
| Item | Status |
|---|---|
| API key remains local | ✅ |
| No cloud storage | ✅ |
| No login required | ✅ |
| Local access via localhost | ✅ |
| Requirement | ✅ |
|---|---|
| Python 3.9 or higher installed | ✅ |
| Virtual environment active | ✅ |
pip install successful |
✅ |
.env with API key present |
✅ |
load_data.py ran successfully |
✅ |
build_index.py successful |
✅ |
web_ui.py started |
✅ |
├── clean_data/ # 500 cybersecurity articles (.txt)
├── vectorstore/ # Vector DB (auto-generated)
│ ├── documents.json
│ └── index.faiss
├── .env # (created by you)
├── load_data.py # Process texts
├── build_index.py # Create FAISS index
├── query_pipeline.py # Retrieval logic
├── llm_api.py # Together.ai API integration
├── web_ui.py # Launch web interface
├── requirements.txt # Python dependencies
└── README.md # This guideThis project is solely intended for research and educational purposes within the Business Information Technology program. It is not intended for production or commercial use.