This repository contains a Retrieval-Augmented Generation (RAG) application designed to load websites and PDF files and answer any questions posed to the model (LLama 3). The application is built using Python, LangChain, ChromaDB, and Gradio for the user interface. Embeddings are generated using the nomic-embed-text model.
- Data Ingestion: Load and preprocess websites and PDF files.
- Question Answering: Utilize Ollama 3 model for generating answers based on ingested data.
- User Interface: Interactive UI built with Gradio for seamless user experience.
- Database Management: Efficient data storage and retrieval using ChromaDB.
Ensure you have the following installed:
- Python 3.12
- Pip (Python package installer)
- Conda
- Ollama
-
Clone the repository:
git clone https://github.com/yourusername/rag-ollama3.git cd rag-ollama3
-
Create a virtual environment:
conda create -n rag conda activate
-
Install the required packages:
pip install -r requirements.txt
-
Pull LLama3 model:
ollama pull llama3
-
Pull nomic-embed-text model:
ollama pull nomic-embed-text
To start the application, run:
python app.py
The Gradio interface will launch, and you can access it via your web browser at http://127.0.0.1:7860.
- Pull the desired model:
ollama pull mistral
- Update line 55 to:
response = ollama.chat(model='mistral', messages=[{'role': 'user', 'content': formatted_prompt}])
rag-app/
├── app.py # Main application script
├── data/ # Directory for storing pdf files
├── requirements.txt # Python dependencies
├── src/ # Source code directory
│ ├── data_loader.py # Scripts for loading data
│ ├── ui.py # Gradio UI
│ └── rag_chain.py # Model handling and inference
└── README.md # This README file
Contributions are welcome! Please open an issue or submit a pull request for any improvements or bug fixes.
This project is licensed under the MIT License. See the LICENSE file for more details.