This project is a simple LLM-powered question-answering system built using LangChain and Ollama. It allows users to ask questions about a pizza restaurant, and the system answers based on relevant reviews retrieved from a vector store. Features 🔍 Retrieve relevant restaurant reviews using a vector store 🤖 Generate intelligent answers using an LLM (llama3.2) 🔗 Built with LangChain prompt chaining 💬 Interactive CLI (command-line interface) 🛠️ Technologies Used Python 🐍 LangChain Ollama (LLM runner) Vector Store (Retriever-based search) 📂 Project Structure project/ │── main.py │── vector_store.py │── README.md ⚙️ Installation
- Clone the repository git clone https://github.com/your-username/pizza-llm-assistant.git cd pizza-llm-assistant
- Install dependencies pip install langchain langchain-core langchain-ollama
- Install Ollama
Download and install Ollama from: https://ollama.com
Then pull the model:
ollama pull llama3.2
Run the application:
python main.py
You will see:
Ask your question (q to quit): Example Questions "Is the pizza good?" "What do customers say about service?" "Are there vegetarian options?" 🧠 How It Works User enters a question The retriever fetches relevant reviews from the vector store Reviews + question are passed into a prompt template The LLM (llama3.2) generates a contextual answer 🧾 Code Overview 🔹 LLM Initialization model = OllamaLLM(model="llama3.2") 🔹 Prompt Template template = """ You are an expert in answering questions about a pizza restaurant.
Here are some relevant reviews: {reviews}
Here is the question to answer: {question} """ 🔹 Chain Execution result = chain.invoke({"reviews": reviews, "question": question}) ❗ Requirements Python 3.8+ Ollama installed and running llama3.2 model downloaded