Skip to content

About

Smart Course Material Q&A Bot is a Streamlit + LangChain RAG app that lets users upload PDFs, DOCX, or TXT files and ask contextual questions with source-backed answers. Powered by Google Gemini for chat and embeddings, it supports multiple AI personalities for an interactive learning experience.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

2 Commits

Folders and files

Repository files navigation

Smart Course Material Q&A Bot

A Streamlit + LangChain RAG app for asking questions about your course materials (PDF, DOCX, TXT) with multiple AI personalities.


Features

  • 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

Quickstart

  1. Clone this repo
  2. Create a virtual environment (recommended)
  3. Install dependencies:
    pip install -r requirements.txt
  4. Set up your environment:
    • Copy .env.example to .env
    • Get a Google Gemini API key from Google AI Studio
    • Edit .env and set:
      • GOOGLE_API_KEY=your-key-here
      • (optional, but recommended for stability)
        • GOOGLE_EMBEDDING_MODEL=models/gemini-embedding-001
        • GOOGLE_CHAT_MODEL=gemini-2.5-flash

Running the App

Option 1: Main launcher

python main.py

Option 2: Direct Streamlit

streamlit run app.py

If port 8501 is busy, use another port:

streamlit run app.py --server.port 8502

Environment Variables

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

Troubleshooting

  • Embeddings error (404 or NOT_FOUND):
    • Set GOOGLE_EMBEDDING_MODEL=models/gemini-embedding-001 in your .env.
  • Chat model error (404 or NOT_FOUND):
    • Set GOOGLE_CHAT_MODEL=gemini-2.5-flash in your .env.
  • Port already in use:
    • Use --server.port 8502 or another free port.
  • API key issues:
    • Make sure your key is valid and has Gemini API access enabled.

Project Structure

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)

Credits


License

MIT

About

Smart Course Material Q&A Bot is a Streamlit + LangChain RAG app that lets users upload PDFs, DOCX, or TXT files and ask contextual questions with source-backed answers. Powered by Google Gemini for chat and embeddings, it supports multiple AI personalities for an interactive learning experience.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages