Skip to content

mitadic/RAG_chatbot

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

49 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

RAG_chatbot

A chatbot service utilising an LLM API, enhanced with RAG.

Demo

demo
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."

Installation

Note

These installation steps portray a generic case on Linux and Mac OS.

Installation steps

  1. Clone the repository; enter the created directory.

     git clone https://github.com/mitadic/RAG_chatbot; cd RAG_chatbot
    
  2. Create a virtual environment; activate it.

     python -m venv .; source ./bin/activate
    
  3. Install the required packages for the venv.

     pip install -r requirements.txt
    
  4. Obtain your personal Gemini API key from Google AI Studio.

  5. Add your key to your environment

     echo API_KEY=ReplaceThisWithYourKey > .env
    

Usage

Run the app.

python app.py

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

Architecture

Project features and technologies overview

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

SQLite Database blueprint

image

Components Configuration

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.

image

Feedback

If you have any feedback, feel free to reach out.

gh_logo.png email_icon.jpg
@mitadic milosgtadic at yahoo.com

Credits

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

License

CC0 1.0 Universal

About

a chatbot service utilising an LLM API, enhanced with RAG

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages