Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 0 additions & 18 deletions .env

This file was deleted.

45 changes: 45 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
# Multi-Modal AI Platform - Environment Variables Example
# Copy this file to .env and fill in your actual values.
# NEVER commit your .env file to version control.

# ── Application Settings ──────────────────────────────────────────────────────
APP_HOST=0.0.0.0
APP_PORT=8000
# Set to "true" to enable uvicorn auto-reload (development only)
RELOAD=false
# Runtime environment label (development | staging | production)
ENVIRONMENT=development

# ── Security ──────────────────────────────────────────────────────────────────
# A long random string used as an application secret (e.g. `openssl rand -hex 32`)
SECRET_KEY=your-secret-key-here
# Static API key for the student/demo auth path
STUDENT_API_KEY=student-api-key-123

# ── Weaviate Vector Database ──────────────────────────────────────────────────
# Cluster URL from https://cloud.weaviate.io/
WEAVIATE_URL=https://your-cluster.weaviate.network
WEAVIATE_API_KEY=your-weaviate-api-key

# ── OpenAI ────────────────────────────────────────────────────────────────────
OPENAI_API_KEY=your-openai-api-key-here

# ── OpenRouter (optional alternative LLM gateway) ────────────────────────────
OPENROUTER_API_KEY=your-openrouter-api-key-here
# Override the RAG model (must be a valid OpenRouter model key, e.g. meta-llama/llama-3.1-8b-instruct:free)
# RAG_MODEL=

# ── Embeddings ────────────────────────────────────────────────────────────────
# Set to "true" to use local sentence-transformers instead of the OpenAI API
USE_LOCAL_EMBEDDINGS=true

# ── Filebase / S3-compatible Storage ─────────────────────────────────────────
# Credentials from https://filebase.com/dashboard/access-keys
FILEBASE_ACCESS_KEY=your-filebase-access-key
FILEBASE_SECRET_KEY=your-filebase-secret-key
BUCKET_NAME=multimodal-student-bucket

# ── Cache & Rate Limiting ─────────────────────────────────────────────────────
CACHE_DEFAULT_TTL=300
RATE_LIMIT=60
RATE_LIMIT_WINDOW=60
Binary file modified .gitignore
Binary file not shown.
24 changes: 24 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
FROM python:3.11-slim

# Set working directory
WORKDIR /app

# Install system dependencies needed by some Python packages
RUN apt-get update && apt-get install -y --no-install-recommends \
gcc \
libsndfile1 \
ffmpeg \
&& rm -rf /var/lib/apt/lists/*

# Install Python dependencies first (layer-cache friendly)
COPY requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt

# Copy application source
COPY . .

# Expose the application port (default 8000)
EXPOSE 8000

# Default command – can be overridden in docker-compose
CMD ["uvicorn", "backend.main:app", "--host", "0.0.0.0", "--port", "8000"]
71 changes: 54 additions & 17 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,17 @@ A comprehensive multi-modal AI platform that processes text, images, audio, and
source venv/bin/activate # On Windows: venv\Scripts\activate
```

3. **Install dependencies**
```bash
pip install -r requirements.txt
```

4. **Set up environment variables**
```bash
cp .env.example .env
# Open .env and fill in your actual credentials (see Configuration section below)
```

### Phase 2: Cloud Services Setup

1. **Google Cloud Storage Setup**
Expand All @@ -50,6 +61,7 @@ A comprehensive multi-modal AI platform that processes text, images, audio, and
- Note your cluster URL and API key

3. **Update environment variables**
Edit the `.env` file (created in Phase 1 step 4) with your cloud service credentials:
```env
# API Configuration
API_HOST=localhost
Expand All @@ -72,6 +84,22 @@ A comprehensive multi-modal AI platform that processes text, images, audio, and
MODEL_CONFIG_PATH=config/models.json
```

## 🐳 Docker Setup

```bash
# 1. Copy and configure environment
cp .env.example .env
# Edit .env with your credentials

# 2. Build and start all services
docker compose up --build

# 3. Access the API
# Swagger UI: http://localhost:8000/docs
```

To enable auto-reload during development, set `RELOAD=true` in your `.env`.

## 🏃‍♂️ Quick Start

1. **Initialize the database**
Expand Down Expand Up @@ -129,43 +157,52 @@ multi Model AI/
├── config/
│ └── models.json # AI model configurations
├── requirements.txt # Python dependencies
├── Dockerfile # Container image build file
├── docker-compose.yml # Multi-service container orchestration
├── README.md # This file
├── .env.example # Environment variables template
├── .env.example # Environment variables template (copy to .env)
└── .gitignore # Git ignore rules
```

## 🔧 Configuration

### Environment Variables

Create a `.env` file with the following variables:
Copy `.env.example` to `.env` and fill in your values. **Never commit the `.env` file** — it is excluded by `.gitignore`.

```env
# API Configuration
API_HOST=localhost
API_PORT=8000
DEBUG=True
```bash
cp .env.example .env
```

# Database
DATABASE_URL=sqlite:///./app.db
Key variables:

# Cloud Storage
GCS_BUCKET_NAME=multimodal-student-storage
GCS_KEY_PATH=./gcs-key.json
```env
# Application
APP_HOST=0.0.0.0
APP_PORT=8000
RELOAD=false
ENVIRONMENT=development

# Security
SECRET_KEY=your-secret-key-here
STUDENT_API_KEY=student-api-key-123

# Weaviate Vector Database
WEAVIATE_URL=https://your-cluster.weaviate.network
WEAVIATE_API_KEY=your-api-key

# AI Model Configuration
# AI Model APIs
OPENAI_API_KEY=your_openai_api_key
MODEL_CONFIG_PATH=config/models.json
OPENROUTER_API_KEY=your_openrouter_api_key # optional

# Security
SECRET_KEY=your-secret-key-here
API_KEY=student-api-key-123
# Filebase / S3 Storage
FILEBASE_ACCESS_KEY=your-access-key
FILEBASE_SECRET_KEY=your-secret-key
BUCKET_NAME=multimodal-student-bucket
```

See `.env.example` for a complete list of all supported variables with descriptions.

### Model Configuration

Create `config/models.json` to configure AI models:
Expand Down
6 changes: 3 additions & 3 deletions backend/storage.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@ def __init__(self, bucket_name: str):
bucket_name: Name for your storage bucket (must be globally unique)
"""
# Get credentials from environment variables
access_key = os.getenv('068004E9D0BE3AECE1E7')
secret_key = os.getenv('dMvlaq4pdisOwZqs37kKTldybXZGpQr15ky1x29V')
access_key = os.getenv('FILEBASE_ACCESS_KEY')
secret_key = os.getenv('FILEBASE_SECRET_KEY')

if not access_key or not secret_key:
raise ValueError(
"FILEBASE_ACCESS_KEY and FILEBASE_SECRET_KEY must be set in environment variables. "
Expand Down
24 changes: 18 additions & 6 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,23 +1,35 @@
version: '3.8'

services:
app:
build: .
ports:
- "${APP_PORT}:${APP_PORT}"
- "${APP_PORT:-8000}:${APP_PORT:-8000}"
environment:
- APP_HOST=${APP_HOST:-0.0.0.0}
- APP_PORT=${APP_PORT:-8000}
- RELOAD=${RELOAD:-false}
- ENVIRONMENT=${ENVIRONMENT:-development}
- WEAVIATE_URL=${WEAVIATE_URL}
- WEAVIATE_API_KEY=${WEAVIATE_API_KEY}
- OPENAI_API_KEY=${OPENAI_API_KEY}
- OPENROUTER_API_KEY=${OPENROUTER_API_KEY}
- STUDENT_API_KEY=${STUDENT_API_KEY}
- FILEBASE_ACCESS_KEY=${FILEBASE_ACCESS_KEY}
- FILEBASE_SECRET_KEY=${FILEBASE_SECRET_KEY}
- BUCKET_NAME=${BUCKET_NAME:-multimodal-student-bucket}
env_file:
- .env
volumes:
- .:/app
command: >
sh -c "uvicorn backend.main:app --host ${APP_HOST} --port ${APP_PORT} --reload ${RELOAD:+--reload}"
sh -c "if [ \"${RELOAD:-false}\" = 'true' ];
then uvicorn backend.main:app --host ${APP_HOST:-0.0.0.0} --port ${APP_PORT:-8000} --reload;
else uvicorn backend.main:app --host ${APP_HOST:-0.0.0.0} --port ${APP_PORT:-8000};
fi"
depends_on:
- weaviate

weaviate:
image: semitechnologies/weaviate:1.19.0
image: semitechnologies/weaviate:1.24.0
ports:
- "8080:8080"
environment:
Expand All @@ -28,4 +40,4 @@ services:
- weaviate_data:/var/lib/weaviate

volumes:
weaviate_data:
weaviate_data:
62 changes: 32 additions & 30 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
# Multi-Modal AI Platform Dependencies (Student Edition)

# Core AI/ML Libraries
torch>=2.0.0
transformers>=4.30.0
sentencepiece>=0.1.99
accelerate>=0.20.0
openai>=1.0.0
langchain>=0.1.0
langchain-openai>=0.1.0
langchain-community>=0.0.10
torch>=2.4.0
transformers>=4.48.0
sentencepiece>=0.2.0
accelerate>=1.2.0
openai>=1.68.0
langchain>=0.3.0
langchain-openai>=0.3.0
langchain-community>=0.3.0

# Computer Vision
opencv-python>=4.8.0
pillow>=10.0.0
imageio>=2.31.0
opencv-python>=4.10.0
pillow>=11.0.0
imageio>=2.36.0

# Audio Processing
librosa>=0.10.0
Expand All @@ -22,42 +22,44 @@ pydub>=0.25.0
moviepy>=1.0.3

# Data Processing
pandas>=2.0.0
numpy>=1.24.0
scikit-learn>=1.3.0
pandas>=2.2.0
numpy>=1.26.0
scikit-learn>=1.5.0

# Web Framework
fastapi>=0.100.0
uvicorn>=0.23.0
python-multipart>=0.0.6
fastapi>=0.115.0
uvicorn>=0.34.0
python-multipart>=0.0.20

# Database & Vector Storage
sqlalchemy>=2.0.0
alembic>=1.11.0
weaviate-client>=3.25.0
alembic>=1.14.0
weaviate-client>=3.26.0

# Cloud Storage
google-cloud-storage>=2.10.0
google-cloud-storage>=2.19.0
boto3>=1.37.0

# Environment and Configuration
python-dotenv>=1.0.0
pydantic>=2.0.0
pydantic>=2.10.0

# Security & Authentication
python-jose[cryptography]>=3.3.0
passlib[bcrypt]>=1.7.4

# Testing
pytest>=7.4.0
pytest-asyncio>=0.21.0
pytest-cov>=4.1.0
pytest>=8.3.0
pytest-asyncio>=0.25.0
pytest-cov>=6.0.0

# Development & Code Quality
black>=23.0.0
flake8>=6.0.0
mypy>=1.5.0
pre-commit>=3.3.0
black>=24.0.0
flake8>=7.0.0
mypy>=1.13.0
pre-commit>=4.0.0

# Monitoring & Logging
structlog>=23.1.0
prometheus-client>=0.17.0
structlog>=24.0.0
prometheus-client>=0.21.0
psutil>=6.1.0