Skip to content

HunainBaloch/multi-tenant-ai-platform

Repository files navigation

Multi-Tenant AI Intelligence Platform

A robust, scalable, and secure Multi-Tenant AI Intelligence Platform designed to deliver advanced RAG (Retrieval-Augmented Generation) capabilities. Built with a modern tech stack, it ensures data isolation, efficient document processing, and intelligent chat interactions for multiple tenants.

🚀 Key Features

  • Multi-Tenancy Architecture: Secure data isolation and management for multiple tenants using a shared application instance.
  • Advanced RAG Pipeline: High-performance retrieval system leveraging Azure AI Search for semantic understanding and accurate context retrieval.
  • Intelligent Chat Interface: Interactive chat capabilities powered by LLMs, with context-aware responses based on ingested documents.
  • Document Ingestion Engine: Automated pipeline for scraping, processing, and indexing various document formats.
  • Robust Authentication: Secure JWT-based authentication and authorization system integrated directly into the FastAPI backend.
  • Scalable Infrastructure: Designed for cloud-native deployment on Azure, utilizing Cosmos DB for metadata and Azure AI Search for vector storage.
  • Comprehensive Monitoring: Integrated logging and telemetry for real-time performance tracking and debugging.

🛠️ Technology Stack

  • Frontend: Streamlit - For a rapid, interactive, and data-centric user interface.
  • Backend: FastAPI - High-performance, easy-to-learn framework for building APIs with Python.
  • Database: Azure Cosmos DB - Globally distributed, multi-model database service.
  • Vector Search: Azure AI Search - AI-powered cloud search service for mobile and web app development.
  • Containerization: Docker - For consistent development and deployment environments.
  • Orchestration: Azure Container Apps / Azure App Service (intended deployment targets).

📂 Project Structure

├── src/
│   ├── frontend/          # Streamlit application (UI logic, components, state management)
│   ├── backend/           # FastAPI application (Routes, Middleware, Auth, Controllers)
│   ├── shared/            # Shared utilities, constants, domain models, and logging config
│   ├── database/          # Database connection logic and ODM (Cosmos DB)
│   ├── vector_search/     # Azure AI Search client wrappers and index management
│   └── ingestion/         # Document processing and ingestion pipelines
├── tests/                 # Unit and integration tests (pytest)
├── deployment/            # Dockerfiles, CI/CD workflows, and IaC templates
├── docs/                  # Project documentation
├── .env.example           # Template for environment variables
└── requirements.txt       # Python dependencies

⚡ Getting Started

Prerequisites

  • Python 3.9+
  • Azure CLI (optional, for Azure deployment)
  • Access to Azure OpenAI, Azure Cosmos DB, and Azure AI Search resources.

1. Clone the Repository

git clone <repository-url>
cd Multi-Tenant-AI-Intelligence-Platform

2. Set Up Virtual Environment

# Create virtual environment
python -m venv .venv

# Activate (Windows PowerShell)
.venv\Scripts\Activate.ps1

# Activate (macOS/Linux)
source .venv/bin/activate

3. Install Dependencies

pip install --upgrade pip
pip install -r requirements.txt

4. Configure Environment Variables

Create a .env file in the root directory by copying .env.example. Fill in the required values:

cp .env.example .env

Required Variables:

  • JWT_SECRET_KEY: Secret for signing JWT tokens.
  • COSMOS_ENDPOINT, COSMOS_KEY, COSMOS_DB_NAME: Cosmos DB connection details.
  • AZURE_SEARCH_ENDPOINT, AZURE_SEARCH_API_KEY: Azure AI Search connection details.
  • OPENAI_API_KEY, OPENAI_API_BASE, OPENAI_API_VERSION: Azure OpenAI configuration.

Note: Never commit your .env file to version control.

5. Run Locally

Backend (FastAPI)

Start the backend server:

uvicorn src.backend.main:app --reload --host 0.0.0.0 --port 8000

API Documentation will be available at: http://localhost:8000/docs

Frontend (Streamlit)

In a new terminal window (with the virtual environment activated), start the frontend:

streamlit run src/frontend/app.py

The application will open in your browser at: http://localhost:8501

🧪 Testing

Run the test suite using pytest:

pytest

To run specific tests or with verbose output:

pytest tests/ -v

🚢 Deployment

The project includes Docker support and is ready for deployment to Azure.

  1. Build Docker Image:

    docker build -t multi-tenant-ai-platform .
  2. Deploy to Azure: Refer to the deployment/ directory for specific CI/CD pipelines (GitHub Actions) and Infrastructure-as-Code (IaC) templates.

🤝 Contributing

Contributions are welcome! Please follow these steps:

  1. Fork the repository.
  2. Create a feature branch (git checkout -b feature/AmazingFeature).
  3. Commit your changes (git commit -m 'Add some AmazingFeature').
  4. Push to the branch (git push origin feature/AmazingFeature).
  5. Open a Pull Request.

📄 License

[License Name] - See the LICENSE file for details.

About

A robust, scalable, and secure Multi-Tenant AI Intelligence Platform designed to deliver advanced RAG (Retrieval-Augmented Generation) capabilities. Built with a modern tech stack, it ensures data isolation, efficient document processing, and intelligent chat interactions for multiple tenants.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors