{"id":25009169,"url":"https://github.com/augustine-aj/rag-basics","last_synced_at":"2026-02-23T01:32:02.572Z","repository":{"id":264430115,"uuid":"893353395","full_name":"augustine-aj/RAG-Basics","owner":"augustine-aj","description":"🤖 An Intelligent Chatbot: Powered by the locally hosted Ollama 3.2 LLM 🧠 and ChromaDB 🗂️, this chatbot offers semantic search 🔍, session-aware responses 🗨️, and an interactive Streamlit interface 🎨 for seamless user interaction. 🚀","archived":false,"fork":false,"pushed_at":"2024-12-12T03:04:14.000Z","size":121,"stargazers_count":4,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-04-23T17:13:24.229Z","etag":null,"topics":["chromadb-integration","dynamic-interaction","interactive-ui","local-llm-integration","semantic-sear","session-aware-responses"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/augustine-aj.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2024-11-24T07:58:21.000Z","updated_at":"2025-01-27T09:41:35.000Z","dependencies_parsed_at":null,"dependency_job_id":"24038c7f-1ce4-49b4-9838-ee774759a522","html_url":"https://github.com/augustine-aj/RAG-Basics","commit_stats":null,"previous_names":["augustine-aj/rag-basics"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/augustine-aj/RAG-Basics","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/augustine-aj%2FRAG-Basics","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/augustine-aj%2FRAG-Basics/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/augustine-aj%2FRAG-Basics/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/augustine-aj%2FRAG-Basics/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/augustine-aj","download_url":"https://codeload.github.com/augustine-aj/RAG-Basics/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/augustine-aj%2FRAG-Basics/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29734468,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-22T20:09:16.275Z","status":"ssl_error","status_checked_at":"2026-02-22T20:09:13.750Z","response_time":110,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["chromadb-integration","dynamic-interaction","interactive-ui","local-llm-integration","semantic-sear","session-aware-responses"],"created_at":"2025-02-05T04:12:38.307Z","updated_at":"2026-02-23T01:32:02.548Z","avatar_url":"https://github.com/augustine-aj.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# RAG-Basics\n\n# 1. Retrieval-Based Q\u0026A System\n\nThis repository contains a retrieval-based Question and Answer (Q\u0026A) system that uses **ChromaDB** and sentence embeddings to retrieve the most relevant response for a user's query. The application provides a simple user interface built with **Streamlit** and processes user queries using a pre-trained **SentenceTransformer** model.\n\n## Table of Contents\n- [Features](#features)\n- [Directory Structure](#directory-structure)\n- [Installation](#installation)\n- [Usage](#usage)\n- [File Descriptions](#file-descriptions)\n- [Future Improvements](#future-improvements)\n\n## Features\n- **Streamlit UI**: A user-friendly interface for submitting queries and displaying results.\n- **ChromaDB Integration**: Persistent vector database to store and retrieve embeddings for question-answer pairs.\n- **Preprocessing**: Automatic text preprocessing for consistent query handling.\n- **Top-k Retrieval**: Retrieves the top-k relevant responses for a given user query.\n\n## Directory Structure\n\n```plaintext\nRetrieval/\n├── Data/\n│   ├── Raw Data/\n│   │   └── chatbot_basic_conversations.json\n│   ├── Chroma DB/\n│   │   └── chatbot basic conversations/\n├── setup_chromDB.py\n├── chromaDB_query_handler.py\n├── retrieval_ui.py\n```\n\n## Installation\n- **Clone this repository:**\n\n```bash\ngit clone https://github.com/augustine-aj/RAG-basics.git\ncd RAG-basics/Retrieval\n```\n- **Install required dependencies:**\n\n```bash\npip install -r requirements.txt\n```\n- **Run the setup script to initialize ChromaDB and load the Q\u0026A pairs:**\n\n```bash\npython setup_chromaDB.py\n```\n\n## Usage\n- **Start the Streamlit application:**\n\n```bash\nstreamlit run retrieval_ui.py\n```\nOpen the URL provided by Streamlit in your browser (e.g., http://localhost:8501).\n\n- **Interact with the application:**\n\n  - Enter your query in the input box.\n  - Click Get Response to see the retrieved answer.\n## File Descriptions\n```retrieval_ui.py```\n\n- Provides a graphical user interface for users to interact with the Q\u0026A system.\n- Displays the retrieved answer based on the input query.\n```setup_chromaDB.py```\n\n- Loads the Q\u0026A pairs from the JSON file.\n- Encodes questions using a pre-trained SentenceTransformer model.\n- Stores embeddings and metadata in a ChromaDB collection.\n```chromaDB_query_handler.py```\n- Handles user queries by encoding them into embeddings and querying ChromaDB for the most relevant responses.\n- Implements utility functions like setup_chroma_client() and retrieve_documents().\n- \n## Future Improvements\n- **Error Handling:** Improve error handling for missing files or incorrect input formats.\n- **Scalability:** Optimize embedding storage and retrieval for larger datasets.\n- **Advanced Retrieval:** Add semantic search capabilities for complex queries.\n- **Web Scraping:** Dynamically update the Q\u0026A database with web-scraped data.\n- **Multilingual Support:** Extend support for queries in multiple languages.\n\n# 2. Generator Model\n## Ollama 3.2 ChatBot\n\nWelcome to the Ollama 3.2 ChatBot repository! This project features an interactive chatbot built using **Streamlit** for the web interface and **OllamaLLM** (Langchain integration with Ollama 3.2) for generating intelligent responses. The bot now has **simple conversational memory**, where new responses are generated using the past 5 interactions to maintain context.\n\n## Table of Contents\n\n- [Project Overview](#project-overview)\n- [Features](#features)\n- [Installation](#installation)\n  - [Prerequisites](#prerequisites)\n  - [Installing Dependencies](#installing-dependencies)\n  - [Setting Up Ollama 3.2](#setting-up-ollama-32)\n- [Running the Application](#running-the-application)\n- [Project Structure](#project-structure)\n- [Example Interaction](#example-interaction)\n- [Contributing](#contributing)\n\n## Project Overview\n\nThis project provides a conversational chatbot powered by **Ollama 3.2**. It utilizes **Langchain** for the integration and **Streamlit** for the web interface, allowing users to interact with the chatbot in real time. The bot retains a conversation history and provides meaningful responses based on the context of the dialogue. \n\n**New Feature**: The bot now uses **simple conversational memory**. This means that each new response is generated based on the last 5 interactions, making the conversation feel more connected and contextually aware.\n\n## Features\n\n- **Interactive Chatbot**: Users can interact with the chatbot and ask questions.\n- **Context-Aware Responses**: The bot retains the conversation history (last 5 interactions) to generate more relevant and coherent answers.\n- **Streamlit Interface**: A user-friendly web interface to interact with the chatbot.\n- **Response Generation**: The chatbot uses Ollama 3.2 LLM to generate detailed, intelligent answers based on user queries.\n\n## Installation\n\n### Prerequisites\n\nTo run the chatbot, you need Python 3.x installed on your local machine.\n\nYou also need to install the following tools:\n\n- **Ollama 3.2**: The chatbot relies on this model for generating responses. Follow the [Ollama Setup Guide](https://ollama.com) for installing Ollama models on your local system.\n- **Langchain**: A Python library used for integrating the Ollama model.\n- **Streamlit**: A library used for building the web interface.\n\n### Installing Dependencies\n- **Clone this repository:**\n\n```bash\ngit clone https://github.com/augustine-aj/RAG-basics.git\ncd RAG-basics/Generator Model\n```\n\nYou can install the required dependencies by using the `requirements.txt` file in this repository.\n\nRun the following command in your terminal:\n\n```bash\npip install -r requirements.txt\n```\nThis will install all the necessary libraries, including `langchain` and `streamlit`.\n\n## Setting Up Ollama 3.2\nTo use the Ollama 3.2 model locally, you need to install it on your system. Follow these steps:\n\n- **1. Install Ollama:** You can install Ollama by following the official installation guide on the [Ollama website](https://ollama.com/).\n- **2. Download the LLM Model:** Ensure that the `llama3.2` model is available and set up on your local machine.If it not downloaded then dowload it from [here](https://ollama.com/library/llama3.2).\n\n## Running the Application\n**1. Start the Streamlit App:** To run the chatbot interface, execute the following command in the terminal:\n```bash\nstreamlit run chatbot.py\n```\n**2. Access the ChatBot:** Once the app is running, open the provided URL (usually ```http://localhost:8501```) in your browser to start interacting with the chatbot.\n\n**3. Chat with the Bot:** Type your message into the text input field, and the bot will respond based on the context of the conversation.\n\n## Project Structure\nThe project consists of two main files:\n\n1. ```response_generation.py```: Handles the logic for generating chatbot responses using the Ollama 3.2 model. The new responses are based on the most recent 5 interactions in the chat history.\n2. ```chatbot.py```: Sets up the Streamlit interface and manages the conversation flow, using the response generation from ```response_generation.py```.\n\n**Note:** *****The response generated is based on the recent conversation history (last 5 interactions), making the responses contextually more relevant.*****\n\n## Contributing\nFeel free to fork the repository, submit issues, and contribute to improving the chatbot! Contributions are always welcome.\n\n\n3. # 🌟 Ollama 3.2 ChatBot with ChromaDB Integration 🤖\n\nWelcome to the **Ollama 3.2 ChatBot** project! 🚀 This chatbot application utilizes a locally hosted Ollama 3.2 Language Model (LLM) for generating intelligent and engaging responses, supported by a **vector database** (ChromaDB) for retrieving relevant information from a predefined knowledge base. The application is built with **Streamlit**, offering an interactive and user-friendly web interface. 💬\n\n## 🌟 Enhanced Features\n\n- **Semantic Search**: Incorporates advanced semantic search capabilities using ChromaDB to retrieve the most relevant information based on user queries. This ensures accurate and context-aware results. 🔍\n- **Session-Aware Responses**: Tracks the **current session's chat history** to generate interactive and contextually rich responses, enhancing the overall user experience. 💡\n- **Dynamic Interaction**: Leverages the combination of semantic search and session tracking to provide more meaningful and conversational answers that adapt to the flow of the dialogue. 🗨️\n\n---\n\n## 🛠️ Features\n\n- **Local LLM Integration**: The chatbot uses **Ollama 3.2**, a locally hosted language model, for generating responses. 🤖\n- **ChromaDB Integration**: Utilizes **ChromaDB**, a vector database, to store and retrieve Q\u0026A pairs based on embeddings. 🗄️\n- **Predefined Knowledge Base**: Supports easy customization of the knowledge base data in **JSON format** for seamless updates. 📚\n- **Interactive UI**: A clean and user-friendly interface built with **Streamlit** for smooth interaction. 🎨\n- **Response Ranking**: Ranks retrieved documents based on relevance and generates fallback responses when relevant data is unavailable. 🔍\n\n---\n\n## 🗂️ Project Structure\n\n```\n.\n├── Data\n│   ├── ChromaDb\n│   │   └── chatbot_basic_conversations\n│   └── Raw Data\n│       └── chatbot_basic_conversations.json\n├── setup_chromaDB.py\n├── chromaDB_query_handler.py\n├── response_generation.py\n├── rag_app.py\n├── requirements.txt\n└── README.md\n```\n---\n\n## 🔑 Key Files\n\n- **setup_chromDB.py**:  \n  - Initializes the ChromaDB client. 🗂️  \n  - Loads Q\u0026A pairs from a JSON file and stores them in the database. 📝\n\n- **chromaDB_query_handler.py**:  \n  - Handles querying ChromaDB to retrieve relevant documents. 🔄  \n  - Automatically initializes and populates the database if it's missing. ⚙️\n\n- **response_generation.py**:  \n  - Generates responses using the retrieved documents and the **Ollama 3.2** model. 🧠  \n  - Implements document ranking and fallback mechanisms. 🔄\n\n- **rag_app.py**:  \n  - A **Streamlit-based web application** for user interaction. 💻  \n  - Displays retrieved documents, chat history, and generated responses. 🗨️\n\n---\n\n## 📋 Prerequisites\n\nBefore you start, make sure you have the following installed:\n\n- **Python 3.8+** ⬇️  \n- **Required Python Libraries**:  \n  - `streamlit` 🌐  \n  - `chromadb` 🗄️  \n  - `sentence_transformers` 🔠  \n  - `langchain_ollama` 🤖  \n- **Ollama 3.2** installed locally on your machine 🖥️\n\n---\n\n## ⚙️ Setup Instructions\n\n### 1. Clone the Repository\n\nFirst, clone the repository to your local machine:\n\n```bash\ngit clone https://github.com/augustine-aj/RAG-Basics/llama 3.2b rag app.git\ncd llama 3.2b rag app\n```\n\n### 2. Install Dependencies\n\nInstall the required Python libraries:\n\n```bash\npip install -r requirements.txt\n```\n\nThe `requirements.txt` file includes the following libraries:\n\n- `streamlit`\n- `chromadb`\n- `sentence_transformers`\n- `langchain_ollama`\n\n### 3. Prepare Knowledge Base\n\nMake sure the JSON file containing Q\u0026A pairs (chatbot_basic_conversations.json) is present in the Data/Raw Data directory. 📂\n\n### 4. Run the Application\n\nStart the chatbot application with:\n\n```bash\nstreamlit run rag_app.py\n```\n\n---\n\n## 💡 Usage\n\n1. Open the application in your browser (the URL will be provided in the terminal after running Streamlit). 🌐\n2. Type your query into the chat box. 🖱️\n3. View retrieved documents, chat history, and generated responses in the interface. 📜\n4. Responses are generated based on the knowledge base stored in ChromaDB. 🔍\n\n---\n\n## 📝 Notes\n\n- Ensure that Ollama 3.2 is installed and running locally for the chatbot to work properly. 🖥️\n- The quality of responses is dependent on the data in your knowledge base (ChromaDB). 📚\n- Responses may take a few seconds due to resource constraints. ⏳\n\n---\n\n## License\n\n📝 License\nThis project is licensed under the MIT License. See the LICENSE file for details. 📄\n\n---\n\n## 📞 Contact\n\n**Augustine Joseph 💼**\n\n- 📧 Email: [augustine04849@gmail.com](mailto\\:augustine04849@gmail.com)\n- 🐱 GitHub: [@augustine-aj](https://github.com/augustine-aj)\n- 🔗 LinkedIn: [linkedin.com/in/augustine-aj](https://linkedin.com/in/augustine-aj)\n\n---\n\nEnjoy building and interacting with your Ollama 3.2 ChatBot! 🚀\n\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faugustine-aj%2Frag-basics","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Faugustine-aj%2Frag-basics","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faugustine-aj%2Frag-basics/lists"}