An intelligent, modular, and production-grade AI Assistant built using LangChain, OpenAI, Anthropic, SymPy, Python, and Streamlit.
This project enables users to interact with an AI agent that can:
- 📚 Summarize and QA uploaded documents (PDFs, DOCX)
- 🧠 Solve complex mathematical problems (algebra, calculus, symbolic math)
- 📰 Fetch the latest news from real-world sources
- 🌍 Perform web and Wikipedia searches with detailed responses
- 🐍 Debug, explain, optimize, and generate Python code
- 🖥️ Execute Python snippets live
- 💱 Convert currencies with real-time rates
- 💬 Engage in open-ended, context-aware conversations
- Smart Document QA: Upload any PDF/DOCX, ask questions, get intelligent answers.
- News Summarization: Fetches real-world news and summarizes it like a professional report.
- Web + Wikipedia Search: Queries DuckDuckGo and Wikipedia, compiles coherent answers.
- Advanced Math Solver: Handles symbolic differentiation, integration, equation solving, and standard math.
- Code Engineering Suite:
- Debug Python code (find and fix errors).
- Explain Python code (step-by-step breakdown).
- Optimize Python code (performance, best practices).
- Generate Python code from instructions.
- Execute Python snippets live.
- Python 3.12+
- Streamlit (UI & Deployment)
- LangChain
- OpenAI API (gpt-4o / gpt-3.5-turbo)
- Anthropic Claude 3 Sonnet (backup LLM for reasoning)
- SymPy (Math engine)
- FAISS (Vector database for document retrieval)
- DuckDuckGo Search API (smart web search)
- NewsAPI / GNews API (real-time news)
- ExchangeRate API (currency conversion)
- Tools and Agents (Zero-Shot-ReAct Framework)
- Memory (Context retention across conversation turns)
- Smart retrievals using Contextual Compression Retriever + LLMChain Extractor
- Custom Runnable chains (
RunnablePassthrough
,RunnableParallel
) - Output parsing via StrOutputParser
- Error handling and fallback strategies
# 1. Clone the repository
git clone https://github.com/your-username/ai-personal-assistant.git
cd ai-personal-assistant
python3 -m venv venv
source venv/bin/activate # On Windows: venv\Scripts\activate
pip install -r requirements.txt
Create a .env file in the root directory with your API keys:
OPENAI_API_KEY=your-openai-api-key
ANTHROPIC_API_KEY=your-anthropic-api-key
GNEWS_API_KEY=your-newsapi-api-key
EXCHANGE_RATE_API_KEY=your-exchangerate-api-key
- Document Upload: Upload multiple PDFs or DOCX files to the sidebar.
- Question Asking: Ask questions related to the uploaded documents.
- Tool Routing: LangChain agent intelligently selects the best tool:
- SmartMathSolver for math
- PythonDebugger for code
- SmartWebSearch for real-world info
- Fallback Handling: If the document lacks an answer, the assistant gracefully transitions to general knowledge.
- Multi-turn Chat: Context is retained using conversation memory.
- Add support for image-based document QA (OCR).
- Add user authentication (Streamlit login).
- Deploy a production backend using FastAPI + LangServe.
- Expand toolset to include SQL Query Generation, Visualization Generator, and more.
- OpenAI
- LangChain
- Streamlit
- Anthropic
- FAISS
- DuckDuckGo Search API
- NewsAPI.org
This project is licensed under the Apache 2.0 License.
Name: Sayam Kumar
Email: sayamk565@gmail.com
LinkedIn: https://www.linkedin.com/in/sayam-kumar/
Feel free to contact me through email or LinkedIn in case you have any queries about this project.
Built with ❤️, Intelligence, and Curiosity.