A full-stack, feature-rich conversational AI application powered by Large Language Models (LLMs), Python, and Streamlit. Moves beyond basic classification models to build contextual, memory-aware, multi-provider generative AI applications.
-
Multi-LLM Provider Engine: Seamlessly switch between Google Gemini (
gemini-2.5-flash,gemini-1.5-pro), OpenAI (gpt-4o,gpt-4o-mini), Anthropic (claude-3-5-sonnet), and a built-in Demo/Mock Mode (no API key required). -
Conversation Memory: Remembers context across chat turns (e.g., handles "My name is Alex"
$\rightarrow$ "What is my name?"$\rightarrow$ "Your name is Alex"). -
Prompt Engineering & Personas: Pre-loaded system instructions including:
- 📊 Data Analyst Mentor
- 💻 Senior Coding Tutor
- 🎧 Customer Support Agent
- ⏱️ Executive Personal Assistant
- ✏️ Custom System Persona
- Hyperparameter Controls: Fine-tune Temperature (0.0 Factual to 1.0 Creative) and Max Tokens in real time via sidebar sliders.
- 📄 Document Q&A (PDF RAG): Upload PDFs to extract context and perform document-based question answering.
- 🔍 Live Web Search: Toggle real-time search context using DuckDuckGo to answer queries with up-to-date online information.
- 🎙️ Voice I/O: Integrated Speech Synthesis (Text-To-Speech audio playback) and browser Web Speech API for voice dictation.
- 💾 SQLite Chat Persistence: Save, load, and manage past chat sessions persistently.
- 📥 Export Options: One-click conversation download in
JSONorTXTformats. - 🎨 Modern Dark Mode UI: Built with glassmorphism CSS, dynamic badges, responsive chat bubbles, and clean typography.
+-----------------------------------------------------------------------------------+
| STREAMLIT FRONTEND |
| +-----------------------+ +----------------------+ +-----------------------+ |
| | User Query Input | | Persona / Sys Prompt | | Temp & Token Sliders | |
| +-----------+-----------+ +----------+-----------+ +-----------+-----------+ |
+--------------|--------------------------|---------------------------|-------------+
| | |
v v v
+-----------------------------------------------------------------------------------+
| LLM CHATBOT ENGINE |
| +------------------------+ +-------------------------+ +--------------------+ |
| | Conversation Memory | | RAG Context (PDF PyPDF) | | DuckDuckGo Search | |
| +-----------+------------+ +------------+------------+ +---------+----------+ |
+--------------|----------------------------|-------------------------|-------------+
| | |
+--------------------+-------+-------------------------+
|
v
+-------------------------------------------------+
| UNIFIED API ROUTER |
+--------+-----------------+-----------------+----+
| | |
v v v
+---------------+ +---------------+ +---------------+
| Google Gemini | | OpenAI API | | Anthropic API |
| (gemini-2.5) | | (gpt-4o-mini) | | (claude-3.5) |
+-------+-------+ +-------+-------+ +-------+-------+
| | |
+-----------------+-----------------+
|
v
+-------------------------------------------------+
| GENERATED RESPONSE & VOICE TTS OUTPUT |
+-------------------------------------------------+
AI_Chatbot/
├── app.py # Main Streamlit web application & modern interface
├── chatbot.py # Unified Multi-LLM provider client & memory manager
├── prompts/ # System prompt persona templates
│ ├── default_system.txt # General Assistant persona
│ ├── analyst_mentor.txt # Data Analyst Mentor persona
│ ├── coding_tutor.txt # Senior Coding Tutor persona
│ ├── customer_support.txt # Customer Support Agent persona
│ └── personal_assistant.txt # Executive Assistant persona
├── utils/ # Feature extension modules
│ ├── __init__.py
│ ├── pdf_processor.py # PDF document reader & context builder
│ ├── search.py # DuckDuckGo live web search wrapper
│ ├── voice.py # gTTS audio synthesis & Web Speech HTML generator
│ └── database.py # SQLite database history logger & session manager
├── requirements.txt # Python dependency requirements
├── .env.example # Template for API keys
├── .gitignore # Git ignore configuration
└── README.md # Comprehensive project documentation
cd AI_Chatbot# Windows
python -m venv .venv
.venv\Scripts\activate
# macOS / Linux
python3 -m venv .venv
source .venv/bin/activatepip install -r requirements.txtCopy .env.example to .env and add your API key(s):
cp .env.example .envNote: You can also enter your API key directly in the app's sidebar UI!
streamlit run app.pyOpen your browser at http://localhost:8501.
- Push code to your GitHub repository.
- Create a new Web Service on Render.
- Connect your repository and configure:
- Environment:
Python 3 - Build Command:
pip install -r requirements.txt - Start Command:
streamlit run app.py --server.port $PORT --server.address 0.0.0.0
- Environment:
- Add environment variables (
GEMINI_API_KEY, etc.) in Render's Environment tab.
- Create a new Space on Hugging Face.
- Select Streamlit as the SDK.
- Upload all project files (
app.py,chatbot.py,utils/,prompts/,requirements.txt). - Set secrets under Settings
$\rightarrow$ Repository Secrets.
AI Chatbot using Multi-Model LLMs & RAG
Developed a full-stack conversational AI application using Large Language Models (Gemini, OpenAI, Anthropic), Python, and Streamlit. Implemented conversation memory management, customizable system personas, hyperparameter controls, PDF document Q&A (RAG), live web search integration, SQLite history persistence, and text-to-speech audio synthesis.
Apache-2.0 License. Free to use and modify for learning and portfolio development!