A comprehensive AI-powered automation platform that combines natural language processing, document analysis, log analysis, calendar management, and GitHub PR review capabilities using LLaMA 3 and LangChain.
This AI-assistant is designed to facilitate efficient machine learning model training (RAG-based, storing issues and resolutions in a local vector database), automate pull request reviews with detailed comments on code quality and optimization, manage Gmail calendar, compose and send/delete mail with voice-controlled instructions, and summarize logs/documents/reports.
It uses Python (as the backend) wrapped in FastAPI and React as the Frontend.
- Natural language interface powered by LLaMA 3 (Ollama)
- Context-aware conversations
- Mathematical computation support
- Document Q&A capabilities
- Upload and analyze PDF and text documents
- AI-powered document summarization
- Question-answering on uploaded documents
- Upload and index log files
- Semantic search across logs using FAISS vector store
- Natural language queries for log analysis
- Support for multiple log files with consolidated indexing
- OAuth 2.0 authentication
- Create, view, and delete calendar events
- Schedule meetings with Google Meet links
- Retrieve events by date
- Support for attendees and locations
- Read and summarize emails
- Mark emails as read/unread
- AI-powered email summarization
- Automated pull request review
- Code quality analysis
- Vulnerability detection
- Best practices suggestions
- AI-generated review comments
- Save issue-resolution pairs
- RAG based engine selects three most relevant solutions from the local saved resolution history, before sending to the LLM for final verdict.
- Training history management
AI-python/
├── main_fastapi.py # Main FastAPI backend server
├── math_ai_agent_doc.py # LLaMA 3 agent with tool support
├── rag_log_analyzer.py # RAG-based log analysis
├── training_store.py # Issue resolution training store
├── pr_review.py # GitHub PR review automation
├── gmail_auth.py # Gmail OAuth authentication
├── ai-agent-ui/ # React frontend
├── logs/ # Log files directory
├── embeddings/ # FAISS vector store
├── uploaded_docs/ # Uploaded documents storage
└── credentials_*.json # OAuth credentials
- Python 3.10+
- Node.js 16+ (for frontend)
- Ollama with LLaMA 3 model installed
# Install Ollama (if not already installed)
curl -fsSL https://ollama.ai/install.sh | sh
# Pull LLaMA 3 model
ollama pull llama3
# Pull embedding model for RAG
ollama pull nomic-embed-textUse the automated setup script:
./setup.shOr follow manual installation:
- Clone the repository:
git clone https://github.com/sandeepknd/AI-agents.git
cd AI-agents- Install Python dependencies:
pip install -r requirements.txt- Set up environment variables:
# Create .env file
echo "GITHUB_TOKEN=your_github_token_here" > .env- Configure Google OAuth:
- Go to Google Cloud Console
- Create a project and enable Google Calendar API and Gmail API
- Create OAuth 2.0 credentials
- Download credentials and save as:
credentials_calendar.json(for Calendar)credentials_per_gmail.json(for Gmail)
cd ai-agent-ui
npm install# From the root directory
uvicorn main_fastapi:app --reload --host 0.0.0.0 --port 8000The API will be available at:
- API: http://localhost:8000
- API Documentation: http://localhost:8000/docs
# From ai-agent-ui directory
cd ai-agent-ui
npm startThe UI will be available at: http://localhost:3000
POST /ask- Send queries to the AI agent{ "query": "What is the derivative of x^2?" }
POST /upload- Upload and analyze documentsPOST /upload-log- Upload log files for indexingPOST /analyze-log- Query log files
GET /authorize-calendar- Start OAuth flowGET /oauth2callback- OAuth callbackGET /get-events- Get upcoming eventsPOST /create-event- Create calendar eventGET /get-events-by-date?date=YYYY-MM-DD- Get events for specific datePOST /schedule-meeting- Schedule meeting with Google Meet{ "title": "Team Standup", "start_time": "2024-03-15T10:00:00", "end_time": "2024-03-15T11:00:00", "description": "Daily standup meeting", "attendees": ["user@example.com"], "create_meet_link": true }DELETE /delete-event?event_id=xxx- Delete event
POST /train-model- Save issue-resolution pair{ "issue": "Server not responding", "resolution": "Restart the service using systemctl restart app" }POST /suggest-resolution- Get AI-powered resolution suggestionsGET /get-training-history- View training historyDELETE /clear-training-history- Clear training data
POST /webhook- GitHub webhook for PR eventsPOST /comment- Post comment on PR{ "pr_url": "https://github.com/user/repo/pull/123", "comment": "LGTM! Great work on this feature." }POST /generate-comment- Generate AI review comment{ "pr_url": "https://github.com/user/repo/pull/123" }
curl -X POST http://localhost:8000/ask \
-H "Content-Type: application/json" \
-d '{"query": "What is 15 factorial?"}'curl -X POST http://localhost:8000/upload-log \
-F "file=@application.log"
curl -X POST http://localhost:8000/analyze-log \
-H "Content-Type: application/json" \
-d '{"query": "Show me all error messages"}'curl -X POST http://localhost:8000/schedule-meeting \
-H "Content-Type: application/json" \
-d '{
"title": "Project Review",
"start_time": "2024-03-20T14:00:00",
"end_time": "2024-03-20T15:00:00",
"attendees": ["team@example.com"],
"create_meet_link": true
}'curl -X POST http://localhost:8000/generate-comment \
-H "Content-Type: application/json" \
-d '{"pr_url": "https://github.com/owner/repo/pull/42"}'- FastAPI - Modern web framework for APIs
- LangChain - LLM orchestration framework
- Ollama - Local LLM runtime (LLaMA 3)
- FAISS - Vector similarity search
- Sentence Transformers - Text embeddings
- Google API Client - Calendar and Gmail integration
- React 19 - UI framework
- Axios - HTTP client
- Tailwind CSS - Styling
- Framer Motion - Animations
- React Icons - Icon library
- LLaMA 3 - Large language model
- nomic-embed-text - Embedding model for RAG
- all-MiniLM-L6-v2 - Sentence similarity model
GITHUB_TOKEN=your_github_personal_access_token
HF_TOKEN=your_huggingface_token # Optional, for higher rate limitsThe application requests the following Google Calendar scopes:
https://www.googleapis.com/auth/calendar
For Gmail integration:
https://www.googleapis.com/auth/gmail.modifyhttps://www.googleapis.com/auth/gmail.readonly
# Check if Ollama is running
ollama list
# Restart Ollama service
systemctl restart ollama # Linux
# or
brew services restart ollama # macOSIf you encounter LangChain import errors, ensure you have the correct packages:
pip install --upgrade langchain langchain-community langchain-classic langchain-text-splitters# Find process using port 8000
lsof -i :8000
# Kill the process
kill -9 <PID># Frontend tests
cd ai-agent-ui
npm test
# Backend tests (if implemented)
pytestThe project follows PEP 8 for Python and Prettier for JavaScript/React.
- API Keys: Never commit
credentials_*.json,token.json, or.envfiles - OAuth Tokens: Tokens are stored locally in
token.jsonandtoken_mail.pickle - GitHub Token: Store in environment variable or
.envfile - CORS: Frontend is restricted to
http://localhost:3000in production
- Fork the repository
- Create a feature branch
- Make your changes
- Submit a pull request
[Specify your license here]
- LangChain for the excellent LLM framework
- Ollama for local LLM deployment
- FastAPI for the modern Python web framework
- React community for the frontend ecosystem
For issues, questions, or contributions, please open an issue on GitHub.
Built with ❤️ using LLaMA 3, LangChain, and FastAPI