wnxddev/humanoid-robotics-api
0
Humanoid Robotics RAG Chatbot API
A FastAPI backend for the Humanoid Robotics RAG Chatbot, deployed on Hugging Face Spaces.
Features
- ๐ค OpenAI Agents: GPT-4o powered conversational AI
- ๐ RAG System: Retrieval-augmented generation using Qdrant vector database
- ๐ Semantic Search: Cohere embeddings for accurate content retrieval
- ๐ค User Authentication: Secure JWT-based authentication
- ๐ฏ Personalization: Content adapted to user's background
- ๐ Translation: English to Urdu translation support
- ๐ Summarization: Text summarization capabilities
- ๐พ Session Management: Persistent chat history
API Endpoints
Health Check
GET /healthAuthentication
POST /api/v1/auth/signup- User registrationPOST /api/v1/auth/signin- User loginGET /api/v1/auth/profile- Get user profile
Chat & RAG
POST /agent/chat- Main chat endpoint with RAGGET /api/v1/history- Get chat history
Content Services
POST /api/v1/summarize- Summarize textPOST /api/v1/content/translate/{chapter_id}- Translate to UrduPOST /api/v1/content/personalize/{chapter_id}- Personalize content
Interests (Personalization)
POST /api/v1/interests- Update user interestsGET /api/v1/interests- Get user interestsPOST /api/v1/interests/filter-chapters- Filter chapters by interests
Architecture
FastAPI Backend
โโโ OpenAI Agent (GPT-4o)
โโโ Qdrant Vector DB (Embeddings)
โโโ Cohere (Text Embeddings)
โโโ Neon PostgreSQL (User Data)Environment Variables
This Space requires the following secrets to be configured:
OPENAI_API_KEY- OpenAI API key for GPT-4oCOHERE_KEY- Cohere API key for embeddingsQDRANT_URL- Qdrant Cloud instance URLQDRANT_KEY- Qdrant API keyNEON_URL- Neon PostgreSQL connection stringBETTERAUTH_SECRET- Secret for JWT token generationCORS_ORIGINS- Allowed CORS origins (comma-separated)QDRANT_COLLECTION_NAME- Qdrant collection name
Tech Stack
- Framework: FastAPI
- AI/ML: OpenAI Agents, Cohere
- Vector DB: Qdrant Cloud
- Database: Neon PostgreSQL
- Deployment: Docker on Hugging Face Spaces
API Documentation
Once deployed, visit /docs for interactive API documentation (Swagger UI).
Testing the API
# Health check
curl https://wnxddev-humanoid-robotics-api.hf.space/health
# Chat endpoint (requires authentication)
curl -X POST https://wnxddev-humanoid-robotics-api.hf.space/agent/chat \
-H "Content-Type: application/json" \
-d '{
"message": "What is inverse kinematics?",
"session_id": "test-session",
"mode": "full-book"
}'Frontend Integration
This API is designed to work with the Humanoid Robotics Docusaurus frontend:
- Frontend: https://website-wania-akrams-projects.vercel.app
- GitHub: https://github.com/waniaa00/Physical-AI-And-Humanoid-Robotics-Textbook
License
MIT License
Support
For issues and questions, please visit the GitHub repository or contact the maintainer.
