Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Yash-pede/aiplanet

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

27 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

AiPlanet πŸš€

A powerful document ingestion and Retrieval Augmented Generation (RAG) platform for intelligent document interactions

Python FastAPI Next.js License

✨ Features

  • πŸ”„ Workflow Management: Create and manage custom workflows with prompt templates and model configurations
  • πŸ“„ Document Processing: Intelligent document ingestion with chunking and embedding
  • πŸ’¬ Contextual Chat: Chat with your documents using advanced RAG technology
  • πŸ—„οΈ Vector Storage: Powered by Chroma vector database for efficient similarity search
  • πŸ‘₯ Session Management: Organize conversations with persistent session storage
  • πŸ”Œ API-First: RESTful API architecture for seamless integrations

πŸŽ₯ Demo Video

Chat With PDF Demo


πŸ—οΈ Architecture

graph LR
    A[Frontend UI<br/>Next.js + React] <--> B[FastAPI Backend<br/>Python]
    B <--> C[Chroma Vector DB<br/>Embeddings]
    B <--> D[Supabase<br/>Auth + Database]
    B <--> E[Gemini API<br/>LLM + Embeddings]
Loading

Tech Stack

Component Technology
Frontend Next.js, React, Tailwind CSS
Backend FastAPI, Python 3.9+
Database Supabase (PostgreSQL)
Vector Store Chroma DB
Authentication Supabase Auth
LLM/Embeddings Google Gemini API

πŸš€ Quick Start

Prerequisites

Before getting started, ensure you have:

  • Python 3.9+ installed
  • Node.js 18+ and npm/yarn
  • Supabase account with API keys
  • Google Gemini API key
  • Docker (optional, for containerized deployment)

Installation

  1. Clone the repository

    git clone https://github.com/Yash-pede/aiplanet.git
    cd aiplanet
  2. Backend Setup

    cd backend
    python -m venv venv
    source venv/bin/activate  # On Windows: venv\Scripts\activate
    pip install -r requirements.txt
  3. Environment Configuration

    cp .env.example .env

    Update your .env file:

    SUPABASE_URL=your_supabase_url
    SUPABASE_ANON_KEY=your_supabase_anon_key
    SUPABASE_SERVICE_KEY=your_supabase_service_key
    GOOGLE_API_KEY=your_gemini_api_key
    CHROMA_PATH=./chroma_db
    TEMP_DIR=./temp
    DEBUG=true
  4. Start the Backend

    uvicorn app.main:app --reload --host 0.0.0.0 --port 8000
  5. Frontend Setup

    cd ../client
    npm install
    npm run dev

πŸ“– Usage

Creating a Workflow

  1. Navigate to the workflows section
  2. Define your prompt template
  3. Select your preferred LLM and embedding models
  4. Configure document sources
  5. Save and activate your workflow

Document Processing

  1. Upload documents through the UI or API
  2. Documents are automatically:
    • Downloaded and parsed
    • Split into meaningful chunks
    • Embedded using Gemini
    • Stored in Chroma vector database

Chatting with Documents

  1. Create a new chat session
  2. Select your workflow
  3. Ask questions about your documents
  4. Get contextual responses powered by RAG

πŸ”Œ API Reference

Core Endpoints

Endpoint Method Description
/api/health GET Health check
/api/workflows GET, POST Manage workflows
/api/workflows/{id} GET, PUT, DELETE Individual workflow operations
/api/workflows/{id}/execute POST Execute workflow
/api/documents POST Upload document metadata
/api/sessions POST Create chat session
/api/messages POST Send message

Metadata Endpoints

Endpoint Method Description
/api/metadata/available-embedding-models GET List available embedding models
/api/metadata/available-llm-models GET List available LLM models

For detailed API documentation, visit /docs when running the backend server.

πŸ“ Project Structure

aiplanet/
β”œβ”€β”€ backend/                 # FastAPI backend
β”‚   β”œβ”€β”€ app/
β”‚   β”‚   β”œβ”€β”€ api/            # API routes
β”‚   β”‚   β”œβ”€β”€ services/       # Business logic
β”‚   β”‚   β”œβ”€β”€ dao/           # Data access objects
β”‚   β”‚   β”œβ”€β”€ clients/       # External service clients
β”‚   β”‚   β”œβ”€β”€ schemas/       # Pydantic models
β”‚   β”‚   └── core/          # Configuration and utilities
β”‚   β”œβ”€β”€ requirements.txt
β”‚   └── .env.example
β”œβ”€β”€ client/                 # Next.js frontend
β”‚   β”œβ”€β”€ app/               # App router pages
β”‚   β”œβ”€β”€ components/        # React components
β”‚   β”œβ”€β”€ hooks/            # Custom React hooks
β”‚   β”œβ”€β”€ lib/              # Utility libraries
β”‚   └── utils/            # Helper functions
β”œβ”€β”€ docker-compose.yml     # Docker configuration
└── README.md

πŸ”§ Configuration

Backend Configuration

Key configuration options in app/core/config.py:

  • APP_NAME: Application name
  • API_PREFIX: API route prefix
  • CORS_ORIGINS: Allowed CORS origins
  • DEBUG: Debug mode toggle

πŸ”„ How It Works

Document Processing Pipeline

graph TD
    A[Document Upload] --> B[Metadata Storage]
    B --> C[File Download]
    C --> D[Document Parsing]
    D --> E[Text Chunking]
    E --> F[Generate Embeddings]
    F --> G[Store in Chroma]
    G --> H[Mark as Processed]
Loading

Chat Flow

graph TD
    A[User Message] --> B[Similarity Search]
    B --> C[Retrieve Context]
    C --> D[Construct Prompt]
    D --> E[LLM Generation]
    E --> F[Save Response]
    F --> G[Return to User]
Loading

πŸ” Security

  • Authentication: Supabase-based user authentication with JWT tokens
  • Authorization: Role-based access control per user
  • CORS: Configurable cross-origin resource sharing
  • Input Validation: Comprehensive request validation using Pydantic
  • Error Handling: Secure error responses without sensitive data exposure

🚧 Roadmap

Short Term

  • Support for additional file formats (Word, HTML, Images)
  • Dynamic model switching during conversations
  • Enhanced UI for workflow visualization
  • Improved error handling and user feedback

Medium Term

  • Advanced admin dashboard
  • Parallel document processing
  • Caching layer for improved performance
  • Webhook support for integrations

Long Term

  • Multi-tenant architecture
  • Custom model fine-tuning
  • Advanced analytics and insights
  • Enterprise SSO integration
Built with ❀️ by the Yash Pede

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published