Skip to main content

Drop-in RAG SDK for website chatbots

Project description

ragchatbot

PyPI version Python 3.10+ License: MIT

Add a semantic search chatbot to any website in minutes. Drop in your docs, get a working API — no ML experience required.

pip install ragchatbot
ragchatbot setup

Your chatbot API is live at http://localhost:8000.


What It Does

ragchatbot reads your documents, understands their meaning, and answers questions grounded in your actual content — not hallucinated responses.

Ask:

"what is your refund policy?"

and it finds the answer from your docs.


Requirements

  • Python 3.10 or higher
  • One of:

Quick Start

Step 1 — Install

pip install ragchatbot

Step 2 — Run guided setup

mkdir my-chatbot
cd my-chatbot
ragchatbot setup

Setup will:

  • Ask which LLM you want to use (Gemini, OpenAI, or Ollama)
  • Ask which model
  • Ask for your API key
  • Create all folders
  • Scan and index your docs automatically

Step 3 — Add your docs

Put your .md, .txt, .pdf, or .docx files in the docs/ folder:

docs/
├── faq.md
├── refund-policy.pdf
├── shipping-policy.docx
└── terms.txt

Then press y when setup prompts you — it will index everything.

Step 4 — Ask a question

ragchatbot ask "what is your refund policy?"

Step 5 — Start the API server

ragchatbot start

API live at http://localhost:8000

Interactive API docs at http://localhost:8000/docs


Using the API

Once the server is running, your frontend can call it:

const response = await fetch("http://localhost:8000/ask", {
  method: "POST",
  headers: { "Content-Type": "application/json" },
  body: JSON.stringify({
    question: "What is your refund policy?",
  }),
});

const data = await response.json();

console.log(data.answer); // answer from your docs
console.log(data.sources); // ["refund-policy.pdf"]

Works with React, Vue, vanilla JS, Next.js — any frontend.


CLI Commands

ragchatbot setup                        # guided setup — LLM, API key, index docs
ragchatbot ask "your question"          # ask a question from terminal
ragchatbot ask "question" --llm ollama  # ask using a specific LLM
ragchatbot start                        # index docs + start API server
ragchatbot start --port 9000            # use a different port
ragchatbot start --llm ollama           # start with a specific LLM
ragchatbot verify                       # re-check everything is working
ragchatbot init                         # scaffold folders + .env manually (advanced)
ragchatbot --help                       # show all commands

Using Ollama (Local, No API Key)

Ollama runs fully locally — no API key, no internet, no cost.

brew install ollama
ollama serve
ollama pull llama3.2

Then run setup and choose Ollama, or switch in .env:

ragchatbot_LLM=ollama
ragchatbot_MODEL=llama3.2

Using OpenAI

pip install ragchatbot[openai]

Run setup and choose OpenAI, or set in .env:

OPENAI_API_KEY=your-openai-api-key
ragchatbot_LLM=openai
ragchatbot_MODEL=gpt-4o-mini

Supported File Types

Type Status
Markdown .md ✅ Supported
Plain text .txt ✅ Supported
PDF .pdf ✅ Supported
Word .docx ✅ Supported

Settings Reference

All settings live in .env (created automatically by ragchatbot setup):

Setting Default Description
GEMINI_API_KEY Your Gemini API key
OPENAI_API_KEY Your OpenAI API key
ragchatbot_DOCS ./docs Folder containing your docs
ragchatbot_DB ./chroma_db Where vectors are stored
ragchatbot_LLM gemini Which LLM: gemini, openai, or ollama
ragchatbot_MODEL per LLM default Model name — set automatically during setup
HF_HUB_OFFLINE 1 Set to 0 only on first run

Links


License

MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

ragchatbot-1.0.0.tar.gz (18.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

ragchatbot-1.0.0-py3-none-any.whl (20.5 kB view details)

Uploaded Python 3

File details

Details for the file ragchatbot-1.0.0.tar.gz.

File metadata

  • Download URL: ragchatbot-1.0.0.tar.gz
  • Upload date:
  • Size: 18.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.1

File hashes

Hashes for ragchatbot-1.0.0.tar.gz
Algorithm Hash digest
SHA256 c51bd105faa1c0d76f14c5744e9eb40ec4805ce588df83d9508ddc3ce6086800
MD5 175e1d5d29bebd502988db81c865d138
BLAKE2b-256 34aa6f6a50daf8a6f484fcd72e6873af641a7d110437b7472c4b472358587037

See more details on using hashes here.

File details

Details for the file ragchatbot-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: ragchatbot-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 20.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.1

File hashes

Hashes for ragchatbot-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 6566fb251f5383514f2e2a9e3b31ffb2fbd50bc40cbaa31d2090ee094562f6d7
MD5 6542e9574ce8b67bccb8596bd4a2fbc8
BLAKE2b-256 de3d83c8132244c6eb7855ac068296165213200ebaa1594d9dbf97769ba58c5f

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page