A sophisticated AI-powered chatbot API designed to enhance my portfolio website by providing interactive responses about my projects, skills, and professional background. Built with FastAPI and CrewAI, it ensures intelligent and context-aware conversations.
This chatbot leverages multiple specialized AI agents using a hierarchical process to deliver comprehensive responses while maintaining conversation history and offering personalized interactions through advanced memory management.
- General Information Agent (RAG): Provides personal details and background.
- Repository Agent: Retrieves GitHub project information.
- About Repository Agent: Offers detailed insights into specific projects.
- Agent Manager: Coordinates responses between different agents.
- Agent Gmail Sender: Sends emails based on user requests.
- Preserves conversation context.
- Maintains user interaction history.
- Generates personalized responses.
- Built with FastAPI for high performance.
- CORS protection to prevent unauthorized access.
- Secure session management using cookies for better chatbot memory.
- Gmail SMTP for automated email communications.
- Secure email-sending capabilities.
- Template-based email formatting.
| Component | Technology Used |
|---|---|
| Backend Framework | FastAPI |
| AI Framework | CrewAI |
| LLM Model | Google Gemini Flash 2.0 |
| Memory Storage | Mem0 AI |
| Programming Language | Python 3.x |
| Email Service | SMTP |
| API | GitHub API |
| Monitoring | AgentOps |
Create a .env file and configure the following keys:
GITHUB_TOKEN=""
GOOGLE_API_KEY=""
MEM0_API_KEY=""
AGENTOPS_API_KEY=""
GMAIL_APP_PASSWORD="" pip install -r requirements.txt uvicorn api:app --host 0.0.0.0 --port 8000 | Method | Endpoint | Description |
|---|---|---|
GET |
/health |
Health check endpoint (returns API status). |
POST |
/chat |
Main chat interaction endpoint (accepts user input and returns AI responses). |
GET |
/chat/history/{user_id} |
Retrieves chat history for a specific user. |
PortfolioChatbot/
├── api.py # Main FastAPI application and endpoints
├── .env.sample # Sample environment variables template
├── requirements.txt # Project dependencies
│
├── utils/ # Core utility modules
│ ├── agents.py # AI agent definitions and configurations
│ ├── tasks.py # Task management and orchestration
│ ├── tools.py # Utility functions and helper tools
│ ├── base_models.py # Pydantic data models
│ ├── knowledge.py # Knowledge base management
│ └── model.py # AI model configurations
│
├── knowledge/ # Knowledge base storage
│ ├── My_RESUME.pdf # Resume storage
│ └── general_data/ # Portfolio-related knowledge
│
├── tests/ # Test suite
│
└── logs/ # Application logs
- FastAPI application setup.
- Endpoint definitions.
- CORS middleware integration.
- Request/Response handling.
- General Information Agent (RAG): Handles personal and background info.
- Repository Agent: Fetches GitHub project data.
- About Repository Agent: Provides detailed insights about a project.
- Agent Manager: Orchestrates agent interactions.
- Agent Gmail Sender: Handles email-sending capabilities.
- Task definition & execution.
- Assigns task to agent manager.
- Processes and formats responses.
Repository: Represents GitHub repository structure.ChatRequest: Defines incoming chat messages.ChatResponse: Defines AI-generated responses.CrewResponse: Defines structured agent responses.
- Stores structured portfolio information.
- Organizes knowledge base.
- Includes resume data.
- GitHub API integration.
- Gmail integration.
- Functions for retrieving repositories and content.
- Frontend: Integrated with my portfolio website → 0thman.me
- External Services:
- GitHub API → Retrieves repository data.
- Mem0 → Handles chatbot memory.
- Gemini API → AI response generation.
- AgentOps API → Monitoring the System.
- CORS Protection: Restricted to my portfolio domain.
- Secure API Key Management: Secrets stored in
.env. - Request Validation: Prevents malicious inputs.
If you encounter any bugs or have ideas for improvements, feel free to open an issue or submit a pull request!

