An LLM bias testing SaaS platform that audits GenAI applications for demographic bias.
| Layer | Technology |
|---|---|
| Frontend | Next.js 14 (App Router) + TypeScript + Tailwind CSS + shadcn/ui |
| Backend | FastAPI (Python 3.11) on Google Cloud Run |
| Auth + DB | Firebase Auth + Firestore (Spark free plan) |
| File Storage | Google Cloud Storage (free tier) |
| AI | Gemini 1.5 Flash API (free tier) |
| Stats | Python scipy + numpy |
BiasProbe/
├── frontend/ # Next.js 14 app
│ ├── app/
│ │ ├── layout.tsx
│ │ ├── page.tsx
│ │ ├── dashboard/page.tsx
│ │ ├── audit/
│ │ │ ├── new/page.tsx
│ │ │ └── [id]/page.tsx
│ │ └── reports/[id]/page.tsx
│ ├── components/
│ ├── lib/
│ ├── package.json
│ └── .env.local.example
├── backend/ # FastAPI app
│ ├── main.py
│ ├── routers/
│ │ ├── audit.py
│ │ └── report.py
│ ├── requirements.txt
│ └── .env.example
├── infra/ # Deployment config
│ ├── Dockerfile
│ ├── cloudbuild.yaml
│ └── setup.sh
├── probe-templates/ # Bias audit scenarios
│ ├── gender-bias.json
│ ├── racial-bias.json
│ └── age-bias.json
├── .env.example
└── README.md
# Create a new GCP project
gcloud projects create YOUR_PROJECT_ID --name="BiasProbe"
gcloud config set project YOUR_PROJECT_ID
# Enable required APIs
bash infra/setup.sh YOUR_PROJECT_IDAPIs enabled:
generativelanguage.googleapis.com— Gemini AIrun.googleapis.com— Cloud Runstorage.googleapis.com— Cloud Storagebigquery.googleapis.com— BigQueryfirebase.googleapis.com— Firebase
- Go to https://aistudio.google.com
- Sign in with your Google account
- Click Get API Key → Create API Key
- Copy the key and set it as
GEMINI_API_KEYin your.env
- Go to https://console.firebase.google.com
- Click Add project → link to your GCP project
- Enable Firestore (Native mode) and Firebase Auth
- Go to Project Settings → Service Accounts
- Click Generate new private key → download the JSON file
- Set the path or contents as
FIREBASE_SERVICE_ACCOUNT_JSONin your.env
Backend:
cd backend
python -m venv venv
source venv/bin/activate # Windows: venv\Scripts\activate
pip install -r requirements.txt
cp .env.example .env # Fill in your values
uvicorn main:app --reload
# API available at http://localhost:8000Frontend:
cd frontend
npm install
cp .env.local.example .env.local # Fill in your values
npm run dev
# App available at http://localhost:3000Backend → Cloud Run:
gcloud run deploy biasProbe-backend \
--source ./backend \
--region us-central1 \
--allow-unauthenticated \
--project YOUR_PROJECT_IDFrontend → Firebase Hosting:
cd frontend
npm run build
firebase deploy --only hosting| Variable | Description |
|---|---|
GEMINI_API_KEY |
Gemini 1.5 Flash API key from AI Studio |
FIREBASE_PROJECT_ID |
Your Firebase/GCP project ID |
FIREBASE_SERVICE_ACCOUNT_JSON |
Path to or JSON string of service account key |
GCS_BUCKET_NAME |
Google Cloud Storage bucket name |
GOOGLE_CLOUD_PROJECT |
GCP project ID for Cloud SDK |
| Method | Endpoint | Description |
|---|---|---|
| POST | /api/audit/create |
Create a new audit |
| POST | /api/audit/{id}/run |
Start running an audit |
| GET | /api/audit/{id}/status |
Poll audit progress |
| GET | /api/audit/{id}/results |
Fetch audit results |
| POST | /api/report/{id}/generate |
Generate a full report |
| GET | /api/report/{id}/pdf |
Download report as PDF |
MIT