TrinetraLabs/Placebo_AI
<div align="center">
π§ Placebo AI
Medical Intelligence Platform β Serverless RAG at LPU Speed
    
Instant, medically-grounded answers backed by 1.3M+ medical text vectors β with zero local disk footprint.
Live Demo Β· Architecture Β· Setup Β· Deployment
</div>
π Overview
Placebo AI is a cloud-native medical intelligence platform that combines retrieval-augmented generation (RAG) with a fully serverless data layer. Rather than shipping a multi-gigabyte vector index alongside the application, Placebo AI offloads all heavy assets β embeddings, document text, and images β to managed cloud services, leaving the application itself lightweight, stateless, and trivially deployable to any container platform.
The result is a system that can answer nuanced medical questions with grounded, source-backed context, streamed back to the user in near real-time thanks to Groq's LPU (Language Processing Unit) inference engine.
Disclaimer: Placebo AI is an informational and educational tool. It is not a substitute for professional medical diagnosis, advice, or treatment. Always consult a qualified healthcare provider for medical concerns.
ποΈ Architecture
Placebo AI's architecture was deliberately redesigned to eliminate the operational fragility of local, disk-resident datasets. The migration removed a 17GB vector store and an 88GB image corpus from the application's runtime footprint entirely, replacing them with serverless equivalents that scale independently of the app container.
flowchart LR
U[User Browser] -->|HTTPS| FE[Frontend<br/>Glassmorphic UI]
FE -->|JWT Auth| AUTH[Supabase Auth]
FE -->|Query| API[FastAPI Backend]
API -->|Keyword-Augmented<br/>Retrieval| ASTRA[(Astra DB<br/>Serverless Vector Search)]
API -->|Asset Fetch| HFDS[(HuggingFace Datasets<br/>Docs & Images)]
API -->|Grounded Prompt| GROQ[Groq LPU<br/>Llama-3.1-8b-instant]
ASTRA -->|Top-K Context| API
HFDS -->|Media/Refs| API
GROQ -->|Streamed Tokens| API
API -->|SSE Stream| FEDesign Principles
π§© Tech Stack
β‘ Key Features
- Zero Local Footprint β The former 17GB vector database and 88GB image archive have been fully migrated off-disk to Astra DB and HuggingFace Datasets respectively. The running application requires negligible local storage.
- Lightning-Fast Inference β Powered by Groq's LPU architecture, responses stream token-by-token with minimal latency compared to traditional GPU-based inference.
- Keyword-Augmented RAG Retrieval β A custom retriever layer blends semantic vector search with keyword-based re-ranking to improve relevance on medical terminology and abbreviations.
- Strict XML Prompt Boundaries β All retrieved context is wrapped in explicit XML tags before being passed to the LLM, reducing prompt injection risk and improving grounding fidelity.
- Secure Authentication β Supabase-issued JWTs are verified server-side on every protected request, ensuring session integrity without maintaining server-side session state.
- Accessibility & Performance β The frontend achieves perfect 100/100 Accessibility and SEO scores on Google Lighthouse, with a responsive, glassmorphic clinical interface.
- Platform-Agnostic Deployment β Being fully serverless on the data side, the same Docker image can be deployed to HuggingFace Spaces, Render, Railway, Vercel, or any container-compatible host without modification.
π API Overview
Update endpoint paths/names below to match your actual FastAPI routes β placeholders shown for structure.
π οΈ Installation & Setup
Prerequisites
- Python 3.10+
- A Groq API key
- A DataStax Astra DB instance (serverless vector-enabled)
- A Supabase project (for authentication)
1. Clone the repository
git clone https://github.com/labstrinetra/placebo.ai.git
cd placebo.ai2. Install dependencies
pip install -r requirements.txt3. Configure environment variables
Create a .env file in the project root:
GROQ_API_KEY=your_groq_api_key
ASTRA_DB_API_ENDPOINT=your_astra_endpoint
ASTRA_DB_APPLICATION_TOKEN=your_astra_token
SUPABASE_URL=your_supabase_url
SUPABASE_ANON_KEY=your_supabase_key4. Run the application
python src/app.pyThe application will be available at http://localhost:8000.
π¦ Deployment
Placebo AI is live in production on HuggingFace Spaces, running in a custom Docker container:
π Live URL: https://trinetralabs-placeboai.hf.space/
Because all heavy data lives off-container, the exact same repository can be deployed to any of the following without disk or memory tuning:
- Render β Docker web service, no persistent disk required
- Railway β one-click Docker deploy from GitHub
- Vercel β via Docker-compatible serverless functions (API routes)
- HuggingFace Spaces β current production host (Docker SDK)
Deployment Checklist
- [ ] All environment variables set in the host platform's secrets manager (never commit
.env) - [ ]
app_portmatches the platform's expected port (7860 for HF Spaces, configurable elsewhere) - [ ] Astra DB and Supabase projects are on production-tier plans if expecting sustained traffic
- [ ] Groq API rate limits reviewed for expected concurrent load
π Security Notes
- JWTs issued by Supabase are verified server-side on every authenticated request; no session state is persisted in the application.
- API keys and database tokens are read exclusively from environment variables β never hardcoded or logged.
- Retrieved context is sandboxed within explicit XML boundaries before being passed to the LLM, limiting the blast radius of prompt-injection attempts embedded in source documents.
πΊοΈ Roadmap
- [ ] Multi-turn conversational memory with session-scoped context windows
- [ ] Source citation UI (inline links to retrieved documents/images)
- [ ] Admin dashboard for corpus management and query analytics
- [ ] Rate limiting and usage quotas per authenticated user
π€ Contributing
Contributions, issues, and feature requests are welcome. Please open an issue first to discuss significant changes before submitting a pull request.
π License
Distributed under the MIT License. See LICENSE for details.
<div align="center">
Developed by Trinetra Labs**
</div>
