mqasim077/physical-ai-textbook-api
0
Physical AI Textbook RAG API
A RAG-powered chatbot API for the Physical AI & Humanoid Robotics textbook.
Features
- Semantic search over textbook content using OpenAI embeddings
- Grounded responses with source citations
- FastAPI backend with health monitoring
Endpoints
Core
GET /- API infoGET /health- Health check
Chat (RAG)
POST /api/chat/- Chat with RAG contextGET /api/chat/search- Search textbook content
Diagram Generator
POST /api/diagram/generate- Generate AI diagramsGET /api/diagram/predefined- List predefined diagramsGET /api/diagram/cached- List cached diagramsGET /api/diagram/concept/{id}- Get specific diagram
Podcast Generator
GET /api/podcast/providers- List TTS providers (OpenAI, Higgs Audio)GET /api/podcast/providers/higgs/status- Check Higgs Audio availabilityPOST /api/podcast/generate- Generate podcast from chapterGET /api/podcast/chapters- List chapters with podcast infoGET /api/podcast/list- List generated podcastsGET /api/podcast/{id}- Get specific podcastGET /api/podcast/chapter/{id}/info- Get chapter podcast info
Authentication (OAuth)
GET /api/auth/status- Check configured providersGET /api/auth/session- Get current sessionGET /api/auth/github/url- Get GitHub OAuth URLGET /api/auth/google/url- Get Google OAuth URLGET /api/auth/github/callback- Handle GitHub OAuth callbackGET /api/auth/google/callback- Handle Google OAuth callbackPOST /api/auth/signout- Sign out current sessionGET /api/auth/me- Get current user info
Personalization
GET /api/personalization/status- Check onboarding statusGET /api/personalization/preferences- Get user preferencesPOST /api/personalization/preferences- Set user preferencesDELETE /api/personalization/preferences- Delete preferencesGET /api/personalization/progress- Get reading progressPOST /api/personalization/progress- Update chapter progressGET /api/personalization/recommendations- Get chapter recommendationsPOST /api/personalization/simplify- Get simplified content
Translation (Urdu)
POST /api/translation/translate- Translate text to UrduPOST /api/translation/translate/paragraph- Translate paragraphGET /api/translation/cache/stats- Get cache statisticsPOST /api/translation/cache/clear- Clear translation cache
Environment Variables
Set the following secrets in your Hugging Face Space:
OPENAI_API_KEY- Your OpenAI API keyGEMINI_API_KEY- Your Google Gemini API key (for diagrams)GITHUB_CLIENT_ID- GitHub OAuth App client ID (optional)GITHUB_CLIENT_SECRET- GitHub OAuth App secret (optional)GOOGLE_CLIENT_ID- Google OAuth client ID (optional)GOOGLE_CLIENT_SECRET- Google OAuth secret (optional)JWT_SECRET- Secret for JWT tokens (auto-generated if not set)
