https://github.com/adithya-s-k/rag-saas

⚡Ship RAG Solutions Quickly and effortlessly

https://github.com/adithya-s-k/rag-saas

Science Score: 13.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
  • codemeta.json file
    Found codemeta.json file
  • .zenodo.json file
  • DOI references
  • Academic publication links
  • Committers with academic emails
  • Institutional organization owner
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (8.6%) to scientific vocabulary

Keywords

ai-saas arize-phoenix llamaindex mongodb qdrant rag saas saas-boilerplate
Last synced: 6 months ago · JSON representation

Repository

⚡Ship RAG Solutions Quickly and effortlessly

Basic Info
  • Host: GitHub
  • Owner: adithya-s-k
  • License: other
  • Language: TypeScript
  • Default Branch: main
  • Homepage: https://rag-saas.vercel.app
  • Size: 1.17 MB
Statistics
  • Stars: 128
  • Watchers: 3
  • Forks: 18
  • Open Issues: 1
  • Releases: 0
Topics
ai-saas arize-phoenix llamaindex mongodb qdrant rag saas saas-boilerplate
Created over 1 year ago · Last pushed over 1 year ago
Metadata Files
Readme Contributing License Code of conduct

README.md

RAG SaaS

Ship RAG solutions quickly⚡

RAG-SaaS Logo

A end to end SaaS Solution for Retrieval-Augmented Generation (RAG)
and Agentic based applications.

Features · Tech Stack · Getting Started · Deployment · Roadmap

GitHub Stars GitHub Forks GitHub Issues GitHub Pull Requests

Features Demo Video
  • 🔐 Basic Authentication
  • 💬 Chat History Tracking
  • 🧠 Multiple RAG Variations
    • Basic RAG
    • Two additional configurations
  • 👨‍💼 Admin Dashboard
    • 📥 Data Ingestion
    • 📊 Monitoring
    • 👁️ Observability
    • 🔄 RAG Configuration Switching
  • 🗄️ S3 Integration for PDF uploads
  • 🐳 Easy Deployment with Docker / Docker Compose
![f937cd54-217f-4106-81b6-56636a17306f (1)](https://github.com/user-attachments/assets/2f2c75fa-a3f0-4311-9a43-554d8cb3e04e)

Tech Stack

  • 🦙 LlamaIndex: For building and orchestrating RAG pipelines
  • 📦 MongoDB: Used as both a normal database and a vector database
  • ⚡ FastAPI: Backend API framework
  • ⚛️ Next.js: Frontend framework
  • 🔍 Qdrant: Vector database for efficient similarity search
  • 👁️ Arize Phoenix: Observability Platform to monitor/evaluate your RAG system

🌟 Why RAG-SaaS?

Setting up reliable RAG systems can be time-consuming and complex. RAG-SaaS allows developers to focus on fine-tuning and developing their RAG pipeline rather than worrying about packaging it into a usable application. Built on top of create-llama by LlamaIndex, RAG-SaaS provides a solid foundation for your RAG-based projects.

🚀 Getting Started

  1. Clone the repository: bash git clone https://github.com/adithya-s-k/RAG-SaaS.git cd RAG-SaaS

🐳 Docker Compose Deployment

Environment Variables

🔑 How to Set up .env ### Environment Variables To properly configure and run RAG-SaaS, you need to set up several environment variables. These are divided into three main sections: Frontend, Backend, and Docker Compose. Here's a detailed explanation of each: #### Frontend Environment (./frontend/.env.local) - `NEXT_PUBLIC_SERVER_URL`: (Compulsory) The endpoint URL of your FastAPI server. - `NEXT_PUBLIC_CHAT_API`: (Compulsory) Derived from NEXT_SERVER_URL, typically set to `${NEXT_PUBLIC_SERVER_URL}/api/chat`. #### Backend Environment (./backend/.env) 1. Model Configuration: - `MODEL_PROVIDER`: (Compulsory) The AI model provider (e.g., 'openai'). - `MODEL`: (Compulsory) The name of the LLM model to use. - `EMBEDDING_MODEL`: (Compulsory) The name of the embedding model. - `EMBEDDING_DIM`: (Compulsory) The dimensionality of the embedding model. 2. OpenAI Configuration: - `OPENAI_API_KEY`: (Compulsory) Your OpenAI API key. 3. Application Settings: - `CONVERSATION_STARTERS`: (Compulsory) A list of starter questions for users. - `SYSTEM_PROMPT`: (Compulsory) The system prompt for the AI model. - `SYSTEM_CITATION_PROMPT`: (Optional) Additional prompt for citation. - `APP_HOST`: (Compulsory) The host address for the backend (default: '0.0.0.0'). - `APP_PORT`: (Compulsory) The port for the backend (default: 8000). 4. Database Configuration: - `MONGODB_URI`: (Compulsory) The MongoDB connection URI. - `MONGODB_NAME`: (Compulsory) The MongoDB database name (default: 'RAGSAAS'). - `QDRANT_URL`: (Compulsory) The URL for the Qdrant server. - `QDRANT_COLLECTION`: (Compulsory) The Qdrant collection name. - `QDRANT_API_KEY`: (Optional) API key for Qdrant authentication. 5. Authentication: - `JWT_SECRET_KEY`: (Compulsory) Secret key for signing JWT tokens. - `JWT_REFRESH_SECRET_KEY`: (Compulsory) Secret key for signing JWT refresh tokens. - `ADMIN_EMAIL`: (Compulsory) Administrator email for application login. - `ADMIN_PASSWORD`: (Compulsory) Administrator password for application login. 6. AWS S3 Configuration (Optional): - `AWS_ACCESS_KEY_ID`: AWS Access Key ID. - `AWS_SECRET_ACCESS_KEY`: AWS Secret Access Key. - `AWS_REGION`: AWS Region for your services. - `BUCKET_NAME`: The name of the S3 bucket to use. 7. Observability: - `ARIZE_PHOENIX_ENDPOINT`: (Optional) Endpoint for Arize Phoenix observability. #### S3 Integration To enable S3 integration for PDF uploads/Ingestion: 1. Set the following environment variables in your `.env` file: ``` AWS_ACCESS_KEY_ID=your_access_key AWS_SECRET_ACCESS_KEY=your_secret_key AWS_REGION=bucket_region BUCKET_NAME=your_bucket_name ``` ### Docker Compose Env (./env) ``` backend: build: context: ./backend dockerfile: Dockerfile image: ragsaas/backend:latest container_name: backend ports: - '8000:8000' environment: # MongoDB Configuration MONGODB_NAME: RAGSAAS MONGODB_URI: mongodb://admin:password@mongodb:27017/ # Qdrant Configuration QDRANT_COLLECTION: default QDRANT_URL: http://qdrant:6333 # QDRANT_API_KEY: # OPENAI_API_KEY is compulsory OPENAI_API_KEY: # Backend Application Configuration MODEL_PROVIDER: openai MODEL: gpt-4o-mini EMBEDDING_MODEL: text-embedding-3-small EMBEDDING_DIM: 1536 FILESERVER_URL_PREFIX: http://backend:8000/api/files SYSTEM_PROMPT: 'You are a helpful assistant who helps users with their questions.' APP_HOST: 0.0.0.0 APP_PORT: 8000 JWT_SECRET_KEY: JWT_REFRESH_SECRET_KEY: ARIZE_PHOENIX_ENDPOINT: http://arizephoenix:4317 ```

For Docker Compose deployment, use:

bash docker compose up -d

Pull down the containers

bash docker compose down

Development Mode

To run the project in development mode, follow these steps:

  1. Start the Next.js Frontend:

Navigate to the frontend directory and install the required dependencies. Then, run the development server:

bash cd frontend npm install npm run dev

  1. Set Up the Vector Database (Qdrant), Database (MongoDB), and Observability Platform (Arize Phoenix):

You can either self-host these services using Docker or use hosted solutions.

Self-Hosted Options:

  • Qdrant:

    bash docker pull qdrant/qdrant

  • MongoDB:

    bash docker pull mongo

  • Arize Phoenix: bash docker pull arizephoenix/phoenix

Hosted Options:

  1. Start the FastAPI Server:

Navigate to the backend directory and set up the Python environment. You can use either Conda or Python's built-in venv:

bash cd backend

Using Conda:

bash conda create -n ragsaas-venv python=3.11 conda activate ragsaas-venv

Using Python's venv:

bash python -m venv ragsaas-venv \ragsaas-venv\Scripts\activate # On Windows source ragsaas-venv/bin/activate # On macOS/Linux

Install the required dependencies and run the server:

bash pip install -e . python main.py


Roadmap

  • [x] add support to store ingested data in AWS S3
  • [x] Add Docker compose for each set up
  • [x] Implement Observability
  • [ ] Improve authentication system
  • [ ] Integrate OmniParse API for efficient Data ingestion
  • [ ] Provide more control to Admin over RAG configuration
  • [ ] Implement Advanced and Agentic RAG

👥 Contributing

We welcome contributions to RAG-SaaS! Please see our CONTRIBUTING.md for more details on how to get started.

📄 Licensing

This project is available under a dual license:

  • Apache License 2.0 for students, developers, and individuals
  • GNU General Public License v3.0 for companies and commercial use

See the LICENSING.md file for more details.

🙏 Acknowledgements

This project is built on the following frameworks, technologies and tools:

Contact & Support

Bug Reports

If you encounter any issues or bugs, please report them in the Issues tab of our GitHub repository.

Commercial Use & Custom Solutions

For inquiries regarding:

  • Commercial licensing
  • Custom modifications
  • Managed deployment
  • Specialized integrations

Please contact: adithyaskolavi@gmail.com

We're here to help tailor RAG-SaaS to your specific needs and ensure you get the most out of our solution.

Star History

Star History Chart

Owner

  • Name: Adithya S K
  • Login: adithya-s-k
  • Kind: user
  • Location: Indian
  • Company: Cognitivelab

Exploring Generative AI • Google DSC Lead'23 • Cloud & Full Stack Engineer • Drones & IoT • FOSS Contributor

GitHub Events

Total
  • Issues event: 1
  • Watch event: 68
  • Fork event: 15
Last Year
  • Issues event: 1
  • Watch event: 68
  • Fork event: 15

Committers

Last synced: 12 months ago

All Time
  • Total Commits: 105
  • Total Committers: 1
  • Avg Commits per committer: 105.0
  • Development Distribution Score (DDS): 0.0
Past Year
  • Commits: 105
  • Committers: 1
  • Avg Commits per committer: 105.0
  • Development Distribution Score (DDS): 0.0
Top Committers
Name Email Commits
Adithya S K a****i@g****m 105

Issues and Pull Requests

Last synced: 12 months ago

All Time
  • Total issues: 1
  • Total pull requests: 0
  • Average time to close issues: N/A
  • Average time to close pull requests: N/A
  • Total issue authors: 1
  • Total pull request authors: 0
  • Average comments per issue: 0.0
  • Average comments per pull request: 0
  • Merged pull requests: 0
  • Bot issues: 0
  • Bot pull requests: 0
Past Year
  • Issues: 1
  • Pull requests: 0
  • Average time to close issues: N/A
  • Average time to close pull requests: N/A
  • Issue authors: 1
  • Pull request authors: 0
  • Average comments per issue: 0.0
  • Average comments per pull request: 0
  • Merged pull requests: 0
  • Bot issues: 0
  • Bot pull requests: 0
Top Authors
Issue Authors
  • leoncool23 (1)
Pull Request Authors
Top Labels
Issue Labels
Pull Request Labels

Dependencies

backend/Dockerfile docker
  • build latest build
  • python 3.11 build
frontend/package-lock.json npm
  • 1190 dependencies
frontend/package.json npm
  • @hookform/resolvers ^3.9.0 development
  • @types/node ^20 development
  • @types/react ^18 development
  • @types/react-dom ^18 development
  • @types/react-syntax-highlighter ^15.5.13 development
  • @types/uuid ^10.0.0 development
  • eslint ^8 development
  • eslint-config-next 14.2.6 development
  • postcss ^8 development
  • react-syntax-highlighter ^15.5.0 development
  • tailwindcss ^3.4.1 development
  • typescript ^5 development
  • @llamaindex/pdf-viewer ^1.1.3
  • @radix-ui/react-accordion ^1.2.0
  • @radix-ui/react-alert-dialog ^1.1.1
  • @radix-ui/react-aspect-ratio ^1.1.0
  • @radix-ui/react-avatar ^1.1.0
  • @radix-ui/react-checkbox ^1.1.1
  • @radix-ui/react-collapsible ^1.1.0
  • @radix-ui/react-context-menu ^2.2.1
  • @radix-ui/react-dialog ^1.1.1
  • @radix-ui/react-dropdown-menu ^2.1.1
  • @radix-ui/react-hover-card ^1.1.1
  • @radix-ui/react-label ^2.1.0
  • @radix-ui/react-menubar ^1.1.1
  • @radix-ui/react-navigation-menu ^1.2.0
  • @radix-ui/react-popover ^1.1.1
  • @radix-ui/react-progress ^1.1.0
  • @radix-ui/react-radio-group ^1.2.0
  • @radix-ui/react-scroll-area ^1.1.0
  • @radix-ui/react-select ^2.1.1
  • @radix-ui/react-separator ^1.1.0
  • @radix-ui/react-slider ^1.2.0
  • @radix-ui/react-slot ^1.1.0
  • @radix-ui/react-switch ^1.1.0
  • @radix-ui/react-tabs ^1.1.0
  • @radix-ui/react-toast ^1.2.1
  • @radix-ui/react-toggle ^1.1.0
  • @radix-ui/react-toggle-group ^1.1.0
  • @radix-ui/react-tooltip ^1.1.2
  • @types/mdast ^4.0.4
  • @vercel/analytics ^1.3.1
  • ai ^3.3.16
  • class-variance-authority ^0.7.0
  • clsx ^2.1.1
  • cmdk ^1.0.0
  • framer-motion ^11.3.30
  • input-otp ^1.2.4
  • jwt-decode ^4.0.0
  • llamaindex ^0.5.19
  • lucide-react ^0.435.0
  • next 14.2.6
  • next-themes ^0.3.0
  • react ^18
  • react-dom ^18
  • react-hook-form ^7.52.2
  • react-markdown ^9.0.1
  • react-resizable-panels ^2.1.1
  • rehype-katex 7.0.0
  • remark ^15.0.1
  • remark-code-import ^1.2.0
  • remark-gfm ^3.0.1
  • remark-math ^6.0.0
  • sonner ^1.5.0
  • tailwind-merge ^2.5.2
  • tailwindcss-animate ^1.0.7
  • uuid ^10.0.0
  • vaul ^0.9.1
  • zod ^3.23.8
backend/pyproject.toml pypi
  • aiostream ^0.5.2
  • cachetools ^5.3.3
  • docx2txt ^0.8
  • duckduckgo-search 6.1.7
  • fastapi ^0.109.1
  • llama-index 0.10.58
  • llama-index-agent-openai 0.2.6
  • llama-index-vector-stores-mongodb ^0.1.3
  • python ^3.11,<3.12
  • python-dotenv ^1.0.0
  • uvicorn ^0.23.2