A chatbot service utilising an LLM API, enhanced with RAG.
![]() |
|---|
| Here's how to utilize Google's Gemini to not rely on common knowledge and instead focus on the uploaded documents in order to reply: "Bananas are vegetables. Bananas can attend preschool." |
Note
These installation steps portray a generic case on Linux and Mac OS.
-
Clone the repository; enter the created directory.
git clone https://github.com/mitadic/RAG_chatbot; cd RAG_chatbot -
Create a virtual environment; activate it.
python -m venv .; source ./bin/activate -
Install the required packages for the venv.
pip install -r requirements.txt -
Obtain your personal Gemini API key from Google AI Studio.
-
Add your key to your environment
echo API_KEY=ReplaceThisWithYourKey > .env
Run the app.
python app.pyVisit the now locally hosted service via any browser by c/p the following url. Create users, then log in as those users via the 🔒 symbol to simulate conversations with Gemini.
127.0.0.1:8000/docs#
If you wish to start over from scratch and initialize a fresh database, delete the files (.sqlite and .index) in the directory /data/. You may want to do so if you lose track of users' passwords, because the emulated "admin" can't delete such users.
| Component | Technology |
|---|---|
| Database | SQLite |
| Database interaction | sqlalchemy.orm |
| Endpoint routing | FastAPI |
| LLM API | Gemini API |
| Authentication | fastapi.security.OAuth2PasswordBearer |
| RAG (vector DB embeddings and sim. search) | Faiss |
| UI | auto-generated Swagger UI |
To see all the project dependencies, check out requirements.txt
The diagram below focuses on the travel path of the Query. Note what is fed into the Query Wrapper before the resulting string is sent to Gemini API.
If you have any feedback, feel free to reach out.
| @mitadic | milosgtadic at yahoo.com |
This has been a final bootcamp project where I've had the good fortune of Zisis Batzos's mentorship. While I've set the project targets mostly independently, this was made possible with the help of Zisis's expertise and guidance which have equiped me with the technical vocabulary and the clarity of mind to limit the app's utility, for instance by omitting a flashy front-end, and maximize the extent of my learning about Generative AI and the general RAG application design.
| Visual resource | Tool |
|---|---|
| demo gif | ffmpeg |
| Database diagram | dbdiagram.io |
| Components configuration diagram | draw.io |


