Skip to content

Chatbot widget using R2 and AutoRAG allowing category & product specific answer. Supporting Cloudflare, OpenAI and Anthropic LLM's for answer generation.

License

Notifications You must be signed in to change notification settings

arnemoor/rag-chatbot

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

48 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

AutoRAG - Open Source RAG Chatbot Framework

An open-source RAG (Retrieval-Augmented Generation) chatbot framework built on Cloudflare's infrastructure. Deploy your own AI-powered document Q&A system in minutes.

Framework Note: This is an open-source framework designed for evaluation, demonstration, and rapid deployment. By default, it runs in permissive mode to facilitate testing and integration. See Security Configuration for production hardening options.

โœจ Features

  • ๐Ÿš€ One-Command Deployment - Deploy to your Cloudflare account with a single script
  • ๐ŸŒ Multi-Language Support - EN, DE, FR, IT with automatic language detection
  • ๐Ÿ“š Smart Document Organization - Category and product-based document structure
  • ๐Ÿค– Multiple AI Models - Workers AI, OpenAI, and Anthropic support
  • ๐ŸŽจ Embeddable Widget - Drop into any website with two lines of code
  • ๐Ÿ“ R2 Storage Integration - Scalable document storage
  • ๐Ÿ” AutoRAG Indexing - Automatic document indexing and retrieval
  • ๐ŸŽฎ Interactive Playground - Test configurations before deployment

๐Ÿš€ Quick Start

Prerequisites

  • Cloudflare account (free tier works)
  • Node.js 18+ and npm (Node 20+ recommended for all features)
  • Git

Quick Start

# 1. Clone and setup
git clone https://github.com/arnemoor/rag-chatbot.git
cd rag-chatbot

# 2. Follow the setup guide
# See docs/SETUP.md for detailed instructions

๐Ÿ“– Complete Setup Guide โ†’

Manual steps required:

  1. Create AutoRAG instance in Cloudflare Dashboard
  2. Create API Token with proper permissions
  3. Copy credentials to .env file

Automated by scripts:

  • R2 bucket creation
  • Worker deployment
  • Widget deployment
  • URL configuration

๐Ÿ“‹ What You'll Get

After deployment, you'll receive:

  • Your Worker API URL: https://your-worker.workers.dev
  • Your Widget URL: https://your-widget.pages.dev
  • Integration code for your website
  • Direct links to playground, demo, and tools

๐Ÿ”ง Integration

Add the chatbot to any website:

<script src="https://your-widget.pages.dev/autorag-widget.min.js"></script>
<autorag-widget></autorag-widget>

With custom configuration:

<autorag-widget 
  language="en"
  category="fiction"
  theme="dark"
  position="bottom-right">
</autorag-widget>

๐Ÿ—๏ธ Architecture

Your Cloudflare Account
โ”œโ”€โ”€ Worker (API Backend)
โ”‚   โ”œโ”€โ”€ AutoRAG Integration
โ”‚   โ”œโ”€โ”€ Document Processing
โ”‚   โ””โ”€โ”€ Chat Endpoints
โ”œโ”€โ”€ Pages (Widget Frontend)
โ”‚   โ”œโ”€โ”€ Embeddable Widget
โ”‚   โ”œโ”€โ”€ Standalone Chat
โ”‚   โ””โ”€โ”€ Admin Tools
โ””โ”€โ”€ R2 Storage
    โ””โ”€โ”€ Document Storage

๐Ÿ“ Project Structure

rag-chatbot/
โ”œโ”€โ”€ worker/              # Backend API (Cloudflare Worker)
โ”œโ”€โ”€ widget/              # Embeddable widget (Cloudflare Pages)  
โ”œโ”€โ”€ scripts/             # Deployment and utility scripts
โ”œโ”€โ”€ docs/                # Documentation
โ”œโ”€โ”€ examples/            # Configuration examples
โ”œโ”€โ”€ sample-documents/    # Sample documents for testing
โ””โ”€โ”€ README.md           # Quick start guide

๐Ÿ” Configuration

Required Cloudflare Settings

  1. Account ID: Found in Cloudflare Dashboard โ†’ Right sidebar
  2. API Token: Create at Profile โ†’ API Tokens with permissions:
    • AutoRAG: Read/Write
    • R2: Read/Write
    • Workers: Edit
    • Pages: Edit

Optional AI Providers

Add to .env for external models:

OPENAI_API_KEY=your-key
ANTHROPIC_API_KEY=your-key

๐Ÿ“š Documentation

๐ŸŽฏ Use Cases

  • Customer Support - AI-powered support chatbot
  • Documentation Assistant - Interactive documentation helper
  • Knowledge Base - Searchable knowledge base with AI
  • Educational Platform - Course material Q&A system
  • Internal Tools - Employee handbook assistant

๐Ÿ› ๏ธ Development

Local Development

# Install all dependencies
./scripts/install-dependencies.sh

# Start Worker locally
cd worker
npm run dev

# Build Widget
cd widget
npm run build -- --watch

# Run all tests
./scripts/test-all.sh

Adding Documents

Upload documents to R2:

# Upload sample documents
./scripts/upload-library-documents.sh

# Or upload your own files
cd worker
npx wrangler r2 object put your-bucket/document.pdf --file=../path/to/document.pdf

Documents are automatically indexed by AutoRAG after upload.

๐Ÿค Contributing

Contributions are welcome! Please:

  1. Fork the repository
  2. Create a feature branch
  3. Make your changes
  4. Submit a pull request

๐Ÿ“„ License

MIT License - See LICENSE file

๐Ÿ†˜ Support

  • Documentation: Documentation Hub
  • Issues: Report issues in your fork
  • Discussions: Use your preferred communication channel

๐Ÿ™ Acknowledgments

Built with:


Note: This is an open source template. When you deploy it, all services run on YOUR Cloudflare infrastructure with YOUR URLs. No data or requests go to the original authors.

About

Chatbot widget using R2 and AutoRAG allowing category & product specific answer. Supporting Cloudflare, OpenAI and Anthropic LLM's for answer generation.

Resources

License

Contributing

Security policy

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 3

  •  
  •  
  •