Skip to content

KovalM/rag-fastapi-project

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

RAG Project Example

This repository contains an example of building a simple Retrieval-Augmented Generation (RAG) application using FastAPI and LangChain. The project was developed as part of a university lecture at BSUIR and demonstrates the step-by-step creation of a RAG system.

The project is based on an example described in this article and has been adapted to work with Llama3.2 and to demonstrate the incremental creation of the application.

I would like to express my sincere gratitude to the author of the article!

📌 About the Project

  • Technologies: FastAPI, LangChain, Llama3.2, OpenAI API, ChromaDB, SQLite, Streamlit
  • Architecture: App Architecture
  • Key Features:
    • 💬 Interactive chat interface
    • 📚 Document upload and processing
    • 🔍 Context-aware responses using RAG
    • 🗄️ Use of SQLite and Chroma databases for persistent data storage
    • 📝 Chat history tracking
    • 🔒 Session management

Dialog Screenshot

🚀 How to Use

1. Clone the repository

git clone https://github.com/KovalM/rag-fastapi-project.git
cd rag-fastapi-project

2. Create a virtual environment and install dependencies

python -m venv venv
source venv/bin/activate  # For Linux/Mac
venv\Scripts\activate    # For Windows
# Installing dependencies may take up to 8 GB of disk space
pip install -r requirements.txt

3. Install and run Llama3.2 via Ollama

curl -fsSL https://ollama.com/install.sh | sh  # Install Ollama (Linux/Mac)
powershell -Command "irm https://ollama.com/install.ps1 | iex"  # Install Ollama (Windows)
ollama pull llama3.2  # Download the model

You can read more about installing Ollama here: Ollama Download

4. Run the FastAPI server

cd api
uvicorn main:app --reload

The API will be available at http://127.0.0.1:8000.

API documentation: http://127.0.0.1:8000/docs.

5. Run the Streamlit app

cd app
streamlit run streamlit_app.py

The Streamlit interface will be available in your browser at http://localhost:8501.

🔍 Step-by-Step Learning

You can explore the process of developing the RAG application by reviewing the commit history. Each commit represents a logically complete stage of work.

📄 Presentation

A detailed explanation of the project is available in the presentation.

🤝 Contacts

If you have any questions or suggestions, please reach out via Issues or create a Pull Request!

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages