This project implements a local AI agent capable of answering questions about pizza restaurant reviews. It utilizes the Retrieval-Augmented Generation (RAG) pattern, leveraging a local Large Language Model (LLM) via Ollama and a vector database (Chroma) to provide contextually relevant answers based on a provided dataset of reviews.
The primary purpose of this project is to demonstrate how to build a question-answering system using local AI models and RAG. It addresses the problem of efficiently querying and summarizing information from a collection of text documents (restaurant reviews in this case) without relying on external cloud services.
- Local LLM Integration: Uses Ollama to run LLMs (like Llama 3.2) locally.
- Retrieval-Augmented Generation (RAG): Employs Langchain and Chroma to retrieve relevant review snippets before generating an answer.
- Vector Embeddings: Uses
mxbai-embed-largevialangchain-ollamafor creating text embeddings. - Persistent Vector Store: Creates and utilizes a persistent Chroma vector database (
chrome_langchain_db/) to store review embeddings. - CSV Data Source: Reads restaurant reviews from a
realistic_restaurant_reviews.csvfile. - Interactive Q&A: Provides a command-line interface to ask questions about the reviews.
- Python 3.x
- Ollama installed and running with a model like
llama3.2andmxbai-embed-largepulled. - The following Python packages (install via
pip install -r requirements.txt):langchainlangchain-ollamalangchain-chromapandas
.
├── chrome_langchain_db/ # Chroma vector store directory (created on first run)
├── main.py # Main application script for interactive Q&A
├── realistic_restaurant_reviews.csv # Dataset containing restaurant reviews
├── requirements.txt # Project dependencies
├── vector.py # Script for embedding data and setting up the retriever
└── README.md # This file
- Clone the repository:
git clone <repository-url> cd LocalAIAgentWithRAG-main
- Ensure Ollama is running:
Make sure the Ollama service is active and you have pulled the necessary models:
ollama pull llama3.2 ollama pull mxbai-embed-large
- Install dependencies:
pip install -r requirements.txt
- Run the application:
The first time you run
main.py, it will executevector.pyto create the vector store. Subsequent runs will use the existing store.python main.py
- Ask questions:
Follow the prompts in the terminal to ask questions about the pizza reviews. Type
qto quit.
Contributions are welcome! Please feel free to submit pull requests or open issues to improve the project.
(Optional: Add your preferred license information here, e.g., MIT License)
- 🌐 Connect with me on LinkedIn: Syed Abdullah Shah
- 📩 Email: sa.abdullahshah.2001@gmail.com