Skip to main content

The Python framework for lightning-fast AI prototypes

Project description

RapidAI ๐Ÿš€

PyPI version Python 3.10+ License: MIT

Production-ready Python framework for building AI applications fast

RapidAI is designed for one thing: getting from idea to deployed AI application in under an hour. When your boss asks you to POC the latest AI tool, this is the framework you reach for.

Vision

A web framework that bridges the gap between Flask's simplicity and Django's batteries-included approach, but optimized specifically for modern AI development. Think of it as "the Rails of AI apps" - convention over configuration, but for LLM-powered applications.

โœจ Features

  • ๐Ÿค– Zero-config LLM integration - Built-in support for Anthropic Claude, OpenAI, Cohere with unified interface
  • ๐Ÿ“ก Streaming by default - SSE/WebSocket streaming built into routes, not bolted on
  • ๐Ÿ”„ Background jobs - Async task processing with automatic retry and job tracking
  • ๐Ÿ“Š Built-in monitoring - Token usage, cost tracking, and metrics dashboard
  • ๐ŸŽจ UI components - Pre-built chat interfaces with customizable themes
  • ๐Ÿ“š RAG system - Document loading, embeddings, vector DB integration for retrieval
  • ๐Ÿ“ Prompt management - Version control and templating for prompts with Jinja2
  • ๐Ÿ’พ Smart caching - Semantic caching using embedding similarity
  • ๐Ÿงช Testing utilities - TestClient, MockLLM, MockMemory for easy testing
  • โšก CLI tool - Project templates, dev server, deployment, and more

๐Ÿš€ Quick Start

Simple Chat Endpoint

from rapidai import App, LLM

app = App()
llm = LLM("claude-3-haiku-20240307")

@app.route("/chat", methods=["POST"])
async def chat(message: str):
    response = await llm.complete(message)
    return {"response": response}

if __name__ == "__main__":
    app.run()

With Streaming

from rapidai import App, LLM

app = App()
llm = LLM("claude-3-haiku-20240307")

@app.route("/chat", methods=["POST"])
async def chat(message: str):
    async for chunk in llm.stream(message):
        yield chunk

if __name__ == "__main__":
    app.run()

With Background Jobs

from rapidai import App, background

app = App()

@background(max_retries=3)
async def process_document(doc_id: str):
    # Long-running task runs in background
    await analyze_document(doc_id)

@app.route("/process", methods=["POST"])
async def start_processing(doc_id: str):
    job = await process_document(doc_id)
    return {"job_id": job.id, "status": job.status}

With Monitoring

from rapidai import App, LLM, monitor

app = App()
llm = LLM("claude-3-haiku-20240307")

@app.route("/chat", methods=["POST"])
@monitor()  # Automatically tracks tokens and costs
async def chat(message: str):
    return await llm.complete(message)

@app.route("/metrics")
async def metrics():
    return app.get_metrics_html()  # Built-in dashboard

๐Ÿ“ฆ Installation

pip install rapidai-framework

Optional Dependencies

Install with specific features:

# Anthropic Claude support
pip install "rapidai-framework[anthropic]"

# OpenAI support
pip install "rapidai-framework[openai]"

# RAG (document loading, embeddings, vector DB)
pip install "rapidai-framework[rag]"

# Redis (for caching and memory)
pip install "rapidai-framework[redis]"

# Everything
pip install "rapidai-framework[all]"

# Development tools
pip install "rapidai-framework[dev]"

๐Ÿ“‹ What's Included

Core Framework

  • โœ… App class - Fast async web server with routing
  • โœ… LLM clients - Anthropic Claude, OpenAI, Cohere with unified interface
  • โœ… Streaming - Built-in SSE support for real-time responses
  • โœ… Memory - Conversation history (in-memory and Redis)
  • โœ… Caching - Semantic caching with embedding similarity
  • โœ… Config - Environment-based configuration with Pydantic

Advanced Features

  • โœ… Background jobs - @background decorator with retry logic and job tracking
  • โœ… Monitoring - @monitor decorator with token/cost tracking and HTML dashboard
  • โœ… RAG system - Document loading (PDF, DOCX, TXT, HTML, MD), embeddings, vector DB
  • โœ… Prompt management - Template-based prompts with Jinja2 and versioning
  • โœ… UI components - Pre-built chat interfaces with themes and customization
  • โœ… Testing utilities - TestClient, MockLLM, MockMemory for easy testing

Developer Tools

  • โœ… CLI tool - rapidai new, rapidai dev, rapidai deploy, rapidai test
  • โœ… Project templates - Chatbot, RAG, Agent, API templates
  • โœ… Type hints - Full type coverage for IDE support
  • โœ… Documentation - Complete guides and API references at rapidai.dev

Status

Version: 1.0.0 - Production Ready ๐ŸŽ‰

See CHANGELOG.md for release notes.

๐Ÿ’ก Use Cases

Perfect for building:

  • ๐Ÿค– Chat applications - Customer support bots, AI assistants
  • ๐Ÿ“š RAG systems - Document Q&A, knowledge bases
  • ๐Ÿ”ง Internal tools - AI-powered dashboards and workflows
  • ๐Ÿ“Š Data processing - Background jobs for document analysis
  • ๐ŸŒ AI APIs - REST endpoints with LLM integration
  • ๐ŸŽฏ Rapid prototypes - POCs and MVPs in under an hour

๐ŸŽฏ Philosophy

  1. Convention over configuration - Sensible defaults, minimal boilerplate
  2. Provider agnostic - Swap OpenAI for Anthropic with one line
  3. Async-first - Built on modern async/await patterns
  4. Type-safe - Full type hints for excellent IDE support
  5. Batteries included - Everything you need, nothing you don't
  6. Production ready - Monitoring, testing, deployment from day one

๐Ÿ“š Documentation

Complete documentation available at rapidai.dev

๐Ÿ› ๏ธ CLI Tool

RapidAI includes a powerful CLI for project scaffolding and management:

# Create a new project from template
rapidai new my-chatbot --template chatbot

# Start development server with hot reload
rapidai dev

# Run tests
rapidai test

# Deploy to cloud platforms
rapidai deploy --platform vercel

# Generate documentation
rapidai docs

Available templates:

  • chatbot - Simple chat application
  • rag - RAG system with document Q&A
  • agent - AI agent with tools
  • api - REST API with LLM endpoints

๐Ÿ‘จโ€๐Ÿ’ป Development

# Clone the repository
git clone https://github.com/shaungehring/rapidai.git
cd rapidai

# Create virtual environment
python -m venv venv
source venv/bin/activate  # On Windows: venv\Scripts\activate

# Install in editable mode with dev dependencies
pip install -e ".[dev]"

# Install pre-commit hooks
pre-commit install

# Run tests
pytest

# Run tests with coverage
pytest --cov=rapidai tests/

# Type check
mypy rapidai

# Lint and format
ruff check rapidai
ruff format rapidai

๐Ÿค Community & Support

๐Ÿš€ Publishing

RapidAI is available on PyPI. To publish a new version:

# Test on TestPyPI first
./scripts/publish.sh test

# Publish to production PyPI
./scripts/publish.sh prod

See PUBLISHING.md for complete publishing guide.

๐Ÿ“„ License

MIT License - see LICENSE file for details.

๐Ÿ™ Contributing

We welcome contributions! Whether it's:

  • ๐Ÿ› Bug fixes
  • โœจ New features
  • ๐Ÿ“š Documentation improvements
  • ๐Ÿงช Test coverage
  • ๐Ÿ’ก Ideas and suggestions

See CONTRIBUTING.md for guidelines on how to contribute.

โญ Show Your Support

If you find RapidAI helpful, please consider:

  • โญ Starring the GitHub repository
  • ๐Ÿ“ข Sharing with your network
  • ๐Ÿ› Reporting issues you encounter
  • ๐Ÿ’ก Suggesting new features

Built with โค๏ธ for AI engineers who move fast

Version: 1.0.0 | Status: Production Ready ๐ŸŽ‰

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

rapidai_framework-1.0.1.tar.gz (54.4 kB view details)

Uploaded Source

Built Distribution

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

rapidai_framework-1.0.1-py3-none-any.whl (70.3 kB view details)

Uploaded Python 3

File details

Details for the file rapidai_framework-1.0.1.tar.gz.

File metadata

  • Download URL: rapidai_framework-1.0.1.tar.gz
  • Upload date:
  • Size: 54.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.2

File hashes

Hashes for rapidai_framework-1.0.1.tar.gz
Algorithm Hash digest
SHA256 f088ceaac826f461a0cd0bcd43fe8d2cacc037326b02d8200e8d68c2310d6f40
MD5 99e50e9d831a3fa16bd72075a3681934
BLAKE2b-256 8dec39416958c565dfaaeb5089ba3a4fd5da56a91f643f63a4c1399caa31c71e

See more details on using hashes here.

File details

Details for the file rapidai_framework-1.0.1-py3-none-any.whl.

File metadata

File hashes

Hashes for rapidai_framework-1.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 60685095d8c8dc0799086ae21df9cc4154340d7855440a8819baf2779ca77ca1
MD5 8682ea3e00b135369e1be556e62300a1
BLAKE2b-256 abca525fc0d53aa34dbc5c4fae37701eb5ccfff7a3abf7f5ec158c817c6c3f99

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