A Streamlit + LangChain RAG app for asking questions about your course materials (PDF, DOCX, TXT) with multiple AI personalities.
- Upload course material (PDF, DOCX, TXT)
- Ask questions and get answers with sources
- Choose from multiple AI personalities (Friendly Tutor, Strict Professor, etc.)
- Powered by Google Gemini (Generative AI) and LangChain
- Clone this repo
- Create a virtual environment (recommended)
- Install dependencies:
pip install -r requirements.txt
- Set up your environment:
- Copy
.env.exampleto.env - Get a Google Gemini API key from Google AI Studio
- Edit
.envand set:GOOGLE_API_KEY=your-key-here- (optional, but recommended for stability)
GOOGLE_EMBEDDING_MODEL=models/gemini-embedding-001GOOGLE_CHAT_MODEL=gemini-2.5-flash
- Copy
Option 1: Main launcher
python main.pyOption 2: Direct Streamlit
streamlit run app.pyIf port 8501 is busy, use another port:
streamlit run app.py --server.port 8502| Variable | Purpose | Example Value |
|---|---|---|
| GOOGLE_API_KEY | Your Google Gemini API key | AIza... |
| GOOGLE_EMBEDDING_MODEL | Embedding model for vector search | models/gemini-embedding-001 |
| GOOGLE_CHAT_MODEL | Chat model for answering questions | gemini-2.5-flash |
- Embeddings error (404 or NOT_FOUND):
- Set
GOOGLE_EMBEDDING_MODEL=models/gemini-embedding-001in your.env.
- Set
- Chat model error (404 or NOT_FOUND):
- Set
GOOGLE_CHAT_MODEL=gemini-2.5-flashin your.env.
- Set
- Port already in use:
- Use
--server.port 8502or another free port.
- Use
- API key issues:
- Make sure your key is valid and has Gemini API access enabled.
| File / Folder | Purpose |
|---|---|
| app.py | Streamlit web UI |
| main.py | Launcher script |
| bot_core.py | Core RAG logic (loading, embeddings, chains) |
| personalities.py | AI personality definitions |
| requirements.txt | Python dependencies |
| .env.example | Example environment config |
| langchain_6_(rag).py | Optional CLI RAG demo (not used by app) |
- Built with LangChain, Streamlit, and Google Gemini.
MIT