ChatBot-RAG
A powerful chatbot implementation using Retrieval Augmented Generation (RAG) to provide context-aware responses based on your data.
Features
- 🔍 Retrieval Augmented Generation: Enhances LLM responses with relevant context from your data
- 🧠 Ollama Support: Run models locally with Ollama for privacy and customization
- 🔗 LangChain Integration: Built on the powerful LangChain framework for advanced chains and pipelines
Installation
pip install chatbot-rag
Requirements
- Python 3.12
- Ollama (for local model hosting)
- Tesseract-OCR (for image-based data extraction)
Tesseract Installation
To enable image-based data extraction, you need to install Tesseract-OCR.
Follow the installation instructions provided at this link.
After installation, ensure the tesseract executable is accessible in your system's PATH.
For example, on Windows, you can verify by running:
tesseract --version
Ollama Installation
Ollama is required for hosting models locally.
Refer to the official Ollama documentation for installation instructions: Ollama Installation Guide.
Once installed, verify it is working by running:
ollama --version
Use
Quick Start
from chatbot_rag.chat import Chatbot
from chatbot_rag.RAG import RAG
# Use a specific Ollama model
rag = RAG(path="./data/")
rag()
bot = Chatbot(name="deepseek-r1:8b")
# Query with specific parameters
question = "Summarize my recent research on climate change"
context = rag._search_context(question,k=5)
response = bot(context,question)
print(response)
Using temporal paths
from chatbot_rag.chat import Chatbot
from chatbot_rag.RAG import RAG
with tempfile.TemporaryDirectory() as tmpdirname:
persistent_dir = os.path.join(tmpdirname, "all_info/")
os.makedirs(persistent_dir, exist_ok=True)
rag = RAG(path="./data/",base_persist_path=persistent_dir)
rag()
chatbot = Chatbot(name="llama3.1:8b")
question = "What is the main topic of the document?"
context = rag._search_context(question)
answer = chatbot(context=context, question=question)
print(f"Answer: {answer}")
Using other preprocessing (PyMuPDFPreprocessing)
from chatbot_rag.chat import Chatbot
from chatbot_rag.RAG import RAG
from src.chatbot_rag.preprocessing import PyMuPDFPreprocessing
kwargs = {"tesseract_path": "C:/Program Files/Tesseract-OCR/tesseract"}
rag = RAG(path="./data/",preprocessing=PyMuPDFPreprocessing,**kwargs)
rag()
chatbot = Chatbot(name="llama3.1:8b")
question = "What is the main topic of the document?"
context = rag._search_context(question)
answer = chatbot(context=context, question=question)
print(f"Question: {answer}")
By default, the system will attempt to extract information from images using Tesseract-OCR. You can disable image extraction by adding the following to the kwargs:
kwargs = {"extract_images": False}
and passing it directly to the RAG component.
Projects Using ChatBot-RAG
🌟 ChatBot-RAG App
ChatBot-RAG App is a chatbot framework leveraging Retrieval-Augmented Generation (RAG) to deliver context-aware responses.
It integrates 🔗 LangChain for advanced pipelines and supports 🧠 Ollama for local model hosting, ensuring enhanced privacy and customization.
Key Features:
- 🔍 Context-Aware Responses: Uses RAG to provide accurate and relevant answers.
- 🧠 Local Model Hosting: Powered by Ollama for privacy and flexibility.
- 🔗 Advanced Pipelines: Built on LangChain for seamless integration and extensibility.
Explore the project here: ChatBot-RAG App
License
This project is licensed under the Apache 2.0 License - see the LICENSE file for details.
Metadata
Release files for chatbot-rag 0.1.9
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| chatbot_rag-0.1.9.tar.gz | 12.6 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| chatbot_rag-0.1.9-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 24.3 kB
Release files / chatbot_rag-0.1.9.tar.gz
| Download URL | chatbot_rag-0.1.9.tar.gz |
|---|---|
| Size | 12.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
778e09970e057b550fc0c0d75327d3cfb544234967d792272b1f5a125d1df560
|
|
BLAKE2b-256 checksum How to use checksums |
ebe4cdf039879646475c451b50a040b13df270631bdbc572cc47d1574c8b4198
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.12.0
|
Release files / chatbot_rag-0.1.9-py3-none-any.whl
| Download URL | chatbot_rag-0.1.9-py3-none-any.whl |
|---|---|
| Size | 11.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
ee37ea1ce41745b4a5d09cf68c6461159e814de259d1dde69810b5be0126bb62
|
|
BLAKE2b-256 checksum How to use checksums |
a945f1248cd31d24f892b026b58e0d0a30caf252d588c8cf5c33fc77dcf81df3
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.12.0
|
Security for chatbot-rag 0.1.9
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.