CoolFace
Apppublic

wnxddev/humanoid-robotics-api

sourceHugging Facemitupdated 9mo agoView on Hugging Face
0likes
App README

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

bash
GET /health

Authentication

  • โ€”POST /api/v1/auth/signup - User registration
  • โ€”POST /api/v1/auth/signin - User login
  • โ€”GET /api/v1/auth/profile - Get user profile

Chat & RAG

  • โ€”POST /agent/chat - Main chat endpoint with RAG
  • โ€”GET /api/v1/history - Get chat history

Content Services

  • โ€”POST /api/v1/summarize - Summarize text
  • โ€”POST /api/v1/content/translate/{chapter_id} - Translate to Urdu
  • โ€”POST /api/v1/content/personalize/{chapter_id} - Personalize content

Interests (Personalization)

  • โ€”POST /api/v1/interests - Update user interests
  • โ€”GET /api/v1/interests - Get user interests
  • โ€”POST /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-4o
  • โ€”COHERE_KEY - Cohere API key for embeddings
  • โ€”QDRANT_URL - Qdrant Cloud instance URL
  • โ€”QDRANT_KEY - Qdrant API key
  • โ€”NEON_URL - Neon PostgreSQL connection string
  • โ€”BETTERAUTH_SECRET - Secret for JWT token generation
  • โ€”CORS_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

bash
# 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.