mohamed10ayman24/personal-ai-agent
๐ค Personal AI Agent โ RAG-Powered Portfolio Assistant
<div align="center">
"Don't just read my CV โ talk to it."
A production-ready AI assistant that represents me 24/7. Powered by real data from my CV, GitHub & LinkedIn. No hallucinations. No static bios. Just accurate, context-aware answers โ in any language.
๐ Live Portfolio โข ๐ API Docs โข ๐ Live API
</div>
๐ Table of Contents
- ๐ Overview
- โจ Key Features
- ๐ ๏ธ Tech Stack
- ๐๏ธ Architecture
- ๐ก API Reference
- ๐ Admin Endpoints
- ๐๏ธ Project Structure
- โ๏ธ Local Setup
- ๐ณ Docker
- โ๏ธ Deployment on Hugging Face Spaces
- ๐ก Example Questions
- ๐ Live Integration
- ๐จโ๐ป Author
๐ Overview
Most portfolios are static pages. Mine talks back.
This project is a production-grade RAG (Retrieval-Augmented Generation) pipeline that acts as a live AI representative of my professional identity. Instead of making recruiters or collaborators dig through a PDF, they can just ask โ and get precise, grounded answers pulled directly from my actual data.
Built from scratch using LangChain, Google Gemini, and FastAPI, deployed on Hugging Face Spaces, and embedded live into my portfolio. Every feature was engineered with real-world reliability in mind: per-session memory, rate limiting, admin controls, and a smart fallback system so the chat never goes dark.
The goal: Replace "Here's my CV" with "Ask me anything."
โจ Key Features
๐ ๏ธ Tech Stack
๐๏ธ Architecture
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ Data Sources โ
โ ๐ CV (PDF) โ ๐ GitHub API โ ๐ผ LinkedIn ZIP โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโฌโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ
โผ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ LangChain Ingestion Pipeline โ
โ Text Splitting โ Gemini Embeddings โ FAISS Store โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโฌโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ
โผ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ FastAPI Backend โ
โ โ
โ โโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโ โ
โ โ POST /ask โ โ GET /health โ โ /admin/* โ โ
โ โ + Rate Limitโ โ + Uptime โ โ + Auth Guard โ โ
โ โ + Session โ โ + Sessions โ โ + CV Upload โ โ
โ โ Memory โ โ โ โ + Rebuild โ โ
โ โโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโ โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโฌโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ
โผ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ Portfolio Frontend โ
โ https://poortflio.netlify.app/ โ
โ Hero Section Chat Widget โ live, session-aware โ
โ Smart fallback when API is warming up โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ๐ก API Reference
Base URL: https://mohamed10ayman24-personal-ai-agent.hf.space
GET /
Returns agent status and basic info.
{
"status": "running",
"name": "Mohamed Aymen Salem",
"sources_loaded": 5,
"uptime_seconds": 3600.0,
"ready": true
}GET /health
Health check with session and rate limit info.
{
"status": "ok",
"ready": true,
"uptime_seconds": 3600.0,
"active_sessions": 3,
"rate_limit": "5 req/60s"
}POST /ask
Ask the agent anything about Mohamed. Supports multi-turn conversations via session_id.
Request:
{
"question": "What are your main technical skills?",
"session_id": "user_abc123"
}Response:
{
"answer": "Mohamed's core skills include Python (Async, OOP), TensorFlow, FastAPI, OpenCV, DeepFace, Gemini API, and the full Microsoft Power Platform stack...",
"sources": ["CV", "GitHub", "LinkedIn"],
"name": "Mohamed Aymen Salem"
}Rate limit error (429):
{
"detail": "Rate limit exceeded. Try again in 45s (max 5 requests per 60s)."
}๐ Try it live โ Swagger UI: `/docs`
๐ Admin Endpoints
All admin endpoints require the following header:
X-Admin-Secret: your-secret-hereRebuild after updating your CV:
curl -X POST https://mohamed10ayman24-personal-ai-agent.hf.space/admin/rebuild \
-H "X-Admin-Secret: your-secret-here"Upload a new CV:
curl -X POST https://mohamed10ayman24-personal-ai-agent.hf.space/admin/upload-cv \
-H "X-Admin-Secret: your-secret-here" \
-H "Content-Type: application/pdf" \
--data-binary @new_cv.pdfCheck system status:
curl https://mohamed10ayman24-personal-ai-agent.hf.space/admin/status \
-H "X-Admin-Secret: your-secret-here"๐๏ธ Project Structure
personal-ai-agent/
โโโ main.py # CLI entry point (interactive chat)
โโโ api.py # FastAPI app โ all endpoints + session management
โโโ Dockerfile # Container config
โโโ requirements.txt
โโโ .env.example # All configurable variables
โโโ src/
โ โโโ cv_loader.py # PDF ingestion via pypdf
โ โโโ github_fetcher.py # GitHub REST API scraper
โ โโโ linkedin_loader.py # LinkedIn ZIP/CSV parser
โ โโโ rag_chain.py # Gemini embeddings + LangChain RAG chain
โโโ data/
โโโ cv.pdf # Your CV (tracked via Git LFS)
โโโ linkedin_export.zip # LinkedIn data export (tracked via Git LFS)
โโโ vectorstore/ # FAISS index (auto-generated, gitignored)โ๏ธ Local Setup
1. Clone & install
git clone https://github.com/MohammedAymen/personal-ai-agent
cd personal-ai-agent
pip install -r requirements.txt2. Configure environment
cp .env.example .envFill in .env:
# Required
GOOGLE_API_KEY=AIza...
YOUR_NAME=Mohamed Aymen Salem
# GitHub (optional but recommended)
GITHUB_TOKEN=ghp_...
GITHUB_USERNAME=MohammedAymen
# File paths
CV_PDF_PATH=data/cv.pdf
LINKEDIN_CSV_PATH=data/linkedin_export.zip
# Security
ADMIN_SECRET=your-strong-secret-here
# CORS โ comma-separated list of allowed origins
ALLOWED_ORIGINS=https://poortflio.netlify.app,http://localhost:3000
# Rate limiting
RATE_LIMIT=5 # max requests per window per IP
RATE_LIMIT_WINDOW=60 # window in seconds
# Session memory
SESSION_TTL=1800 # seconds before inactive session expires (default: 30 min)3. Add your data
data/cv.pdf โ your CV (PDF)
data/linkedin_export.zip โ LinkedIn data export4. Run
# Interactive CLI mode
python main.py
# API server mode
uvicorn api:app --reload --host 0.0.0.0 --port 8000
# Then open: http://localhost:8000/docs๐ณ Docker
docker build -t personal-ai-agent .
docker run -p 8000:8000 \
-e GOOGLE_API_KEY=your_key \
-e GITHUB_TOKEN=your_github_token \
-e GITHUB_USERNAME=MohammedAymen \
-e YOUR_NAME="Mohamed Aymen Salem" \
-e ADMIN_SECRET=your-secret \
personal-ai-agent`Dockerfile` overview:
FROM python:3.9-slim
WORKDIR /app
COPY requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt
COPY . .
EXPOSE 8000
CMD ["uvicorn", "api:app", "--host", "0.0.0.0", "--port", "8000"]โ๏ธ Deployment on Hugging Face Spaces
This project runs as a Docker Space on Hugging Face โ free, public, and always on.
Steps:
1. Git LFS โ track binary files:
git lfs install
git lfs track "*.pdf" "*.zip"
git add .gitattributes2. Clean history (if binaries were committed before LFS):
git lfs migrate import --include="*.pdf,*.zip" --everything3. Set secrets in Hugging Face (never commit these):
GOOGLE_API_KEY โ your Gemini API key
ADMIN_SECRET โ your admin password
GITHUB_TOKEN โ your GitHub token4. Push & deploy:
git remote add space https://huggingface.co/spaces/mohamed10ayman24/personal-ai-agent
git push space mainThe Space rebuilds automatically on every push. โ
๐ก Example Questions
"What are Mohamed's main technical skills?"
"Tell me about the Blockchain Voting System project"
"Does he have experience with FastAPI or async Python?"
"What is his educational background?"
"Has he worked with computer vision before?"
"What certifications does he have?"
"ู
ุง ูู ู
ุดุงุฑูุนู ูู ู
ุฌุงู ุงูุฐูุงุก ุงูุงุตุทูุงุนูุ"
"ูู ูุฏูู ุฎุจุฑุฉ ูู Power Platformุ"๐ Live Integration
This API is the brain behind the AI Chat Widget embedded in the hero section of my portfolio. Every visitor gets their own isolated conversation โ powered by real data, not a script.
๐ [https://poortflio.netlify.app/](https://poortflio.netlify.app/)
How it works for visitors:
- Page loads โ a unique
session_idis generated in the browser - Visitor types a question โ sent to the Hugging Face API with their session ID
- The API retrieves relevant context from the vector store and responds with Gemini
- Conversation history is maintained per session for natural follow-up questions
- If the API is cold-starting โ smart fallback answers from local curated data
๐จโ๐ป Author
Mohamed Aymen Salem AI Engineer & Developer โ Machine Learning ยท Computer Vision ยท NLP ๐ Port Said, Egypt
  
Built with โค๏ธ ยท Powered by Gemini ยท Deployed on Hugging Face
