{"id":32624709,"url":"https://github.com/dheepakshakthi/168_rag_chatbot","last_synced_at":"2025-10-30T20:06:51.622Z","repository":{"id":320018825,"uuid":"1080481100","full_name":"dheepakshakthi/168_rag_chatbot","owner":"dheepakshakthi","description":"RAG based chatbot","archived":false,"fork":false,"pushed_at":"2025-10-21T12:40:53.000Z","size":37296,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-10-21T14:38:40.422Z","etag":null,"topics":["chatbot","ollama-python","rag","smollm2"],"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/dheepakshakthi.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,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-10-21T12:38:07.000Z","updated_at":"2025-10-21T12:40:58.000Z","dependencies_parsed_at":null,"dependency_job_id":"8575eb14-a031-4d8b-b021-ee16ef95cc1e","html_url":"https://github.com/dheepakshakthi/168_rag_chatbot","commit_stats":null,"previous_names":["dheepakshakthi/168_rag_chatbot"],"tags_count":null,"template":false,"template_full_name":null,"purl":"pkg:github/dheepakshakthi/168_rag_chatbot","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dheepakshakthi%2F168_rag_chatbot","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dheepakshakthi%2F168_rag_chatbot/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dheepakshakthi%2F168_rag_chatbot/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dheepakshakthi%2F168_rag_chatbot/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/dheepakshakthi","download_url":"https://codeload.github.com/dheepakshakthi/168_rag_chatbot/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dheepakshakthi%2F168_rag_chatbot/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":281873485,"owners_count":26576262,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-10-30T02:00:06.501Z","response_time":61,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"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":["chatbot","ollama-python","rag","smollm2"],"created_at":"2025-10-30T20:03:17.382Z","updated_at":"2025-10-30T20:06:51.614Z","avatar_url":"https://github.com/dheepakshakthi.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# RAG Chatbot for Coding Questions\n\nA Retrieval-Augmented Generation (RAG) chatbot that answers coding questions based on your PDF learning materials using the SmolLM2:1.7b model from Ollama.\n\n## Features\n\n- 📚 **PDF Processing**: Automatically processes PDF documents from the `data/` folder\n- 🔍 **Semantic Search**: Uses vector embeddings to find relevant content\n- 🤖 **Local LLM**: Powered by SmolLM2:1.7b via Ollama (runs locally)\n- 💬 **Interactive Chat**: Simple command-line interface for asking questions\n- 🎯 **Context-Aware**: Answers based on your specific learning materials\n\n## Prerequisites\n\n1. **Python 3.8+** installed\n2. **Ollama** installed with SmolLM2:1.7b model\n   - Install Ollama from: https://ollama.ai\n   - Pull the model: `ollama pull smollm2:1.7b`\n\n## Setup\n\n### 1. Install Dependencies\n\n```powershell\n# Activate virtual environment\n.\\master\\Scripts\\activate\n\n# Install required packages\npip install -r requirements.txt\n```\n\n### 2. Prepare Your Data\n\nPlace your PDF files in the `data/` folder. Currently includes:\n- `learning_java.pdf`\n- `Learning_Python.pdf`\n\n### 3. Ingest Documents\n\nProcess the PDFs and create the vector database:\n\n```powershell\npython ingest_documents.py\n```\n\nThis will:\n- Load all PDF files from the `data/` folder\n- Split them into manageable chunks\n- Create embeddings using sentence-transformers\n- Store them in a ChromaDB vector database\n\n## Usage\n\n### Start the Chatbot\n\n```powershell\npython chatbot.py\n```\n\n### Example Questions\n\n- \"How do I create a list in Python?\"\n- \"What is inheritance in Java?\"\n- \"Explain Python decorators\"\n- \"How do I handle exceptions in Java?\"\n- \"What are Python list comprehensions?\"\n- \"Explain Java interfaces\"\n\n### Commands\n\n- Type your question and press Enter\n- Type `sources` to see the source documents for the last answer\n- Type `quit` or `exit` to end the conversation\n\n## How It Works\n\n1. **Document Ingestion** (`ingest_documents.py`):\n   - Loads PDF files\n   - Splits into chunks (1000 chars with 200 overlap)\n   - Creates embeddings using all-MiniLM-L6-v2\n   - Stores in ChromaDB\n\n2. **RAG Pipeline** (`chatbot.py`):\n   - Takes user question\n   - Finds relevant chunks using semantic search\n   - Creates context from top 4 results\n   - Sends context + question to SmolLM2:1.7b\n   - Returns contextual answer\n\n## Project Structure\n\n```\nrag_chatbot/\n├── data/                      # PDF documents\n│   ├── learning_java.pdf\n│   └── Learning_Python.pdf\n├── chroma_db/                 # Vector database (created after ingestion)\n├── master/                    # Virtual environment\n├── ingest_documents.py        # Document processing script\n├── chatbot.py                # Main chatbot application\n├── requirements.txt          # Python dependencies\n└── README.md                 # This file\n```\n\n## Troubleshooting\n\n### \"Vector store not found\" error\nRun `python ingest_documents.py` first to create the vector database.\n\n### Ollama connection error\n- Make sure Ollama is running\n- Verify the model is installed: `ollama list`\n- Pull the model if needed: `ollama pull smollm2:1.7b`\n\n### Out of memory errors\n- Reduce `TOP_K_RESULTS` in `chatbot.py` (default: 4)\n- Reduce `chunk_size` in `ingest_documents.py` (default: 1000)\n\n## Customization\n\n### Change the LLM Model\nEdit `OLLAMA_MODEL` in `chatbot.py`:\n```python\nOLLAMA_MODEL = \"your-model-name\"\n```\n\n### Adjust Chunk Size\nEdit `chunk_size` in `ingest_documents.py`:\n```python\nchunk_size=1000,  # Increase or decrease\nchunk_overlap=200  # Adjust overlap\n```\n\n### Change Number of Retrieved Documents\nEdit `TOP_K_RESULTS` in `chatbot.py`:\n```python\nTOP_K_RESULTS = 4  # Increase for more context\n```\n\n## Adding More Documents\n\n1. Add PDF, text, or code files to the `data/` folder\n2. Re-run the ingestion: `python ingest_documents.py`\n3. The chatbot will now include the new materials\n\n## License\n\nMIT License - Feel free to use and modify as needed!\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdheepakshakthi%2F168_rag_chatbot","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdheepakshakthi%2F168_rag_chatbot","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdheepakshakthi%2F168_rag_chatbot/lists"}