Spaces:
Sleeping
Sleeping
metadata
title: Cet Advisement Bot
emoji: π
colorFrom: red
colorTo: red
sdk: docker
app_port: 8501
tags:
- streamlit
pinned: false
short_description: A chatbot designed to aid course advisement at City Tech
license: apache-2.0
Project Title: Academic Advisement Bot
Description
The Academic Advisement Bot is an application designed to assist students with course advisement, leveraging a Retrieval-Augmented Generation (RAG) system. It provides detailed and accurate answers to student queries regarding course prerequisites, corequisites, semester plans, and general education requirements based on the Computer Engineering Technology (CET) curriculum. The bot also includes user authentication, API key management, and an automated evaluation system for its performance.
Features
- Conversational AI: Utilizes a RAG chain to provide context-aware answers to academic queries.
- Course Information: Provides detailed information on CET courses, including prerequisites, corequisites, and semester-wise plans.
- User Authentication: Secure login and registration system with password hashing and strength validation.
- API Key Management: Allows users to set and manage their OpenAI API keys for model interaction.
- Automated Evaluation: Includes a feature to run automated evaluations against predefined Q&A pairs to assess the bot's accuracy using cosine similarity.
- Session Management: Handles user sessions and timeouts.
- Interactive UI: Built with Streamlit for an intuitive and user-friendly experience.
Technologies Used
- Python 3.x
- Streamlit: Web application framework.
- LangChain: For building the RAG conversational chain.
- FAISS: For efficient similarity search on course embeddings.
- Sentence Transformers: For generating embeddings.
- OpenAI API: For language model interactions (requires user-provided API key).
- SQLite3: For user authentication and API key storage.
- Pandas: For data manipulation and evaluation results.
- Scikit-learn: For cosine similarity calculation in evaluation.
- Docker: For containerization.
- Dotenv: For environment variable management.
Project Structure
cet_advisement_bot/
βββ .gitattributes
βββ Dockerfile
βββ README.md <-- This file
βββ requirements.txt
βββ docs/
β βββ original_cat.pdf <-- Original course catalog document
β βββ original_vector/ <-- FAISS index for course embeddings
β βββ index.faiss
β βββ index.pkl
βββ queries/
β βββ QueriesDataSet_Final.xlsx <-- Dataset (queries) for evaluation.
βββ src/
βββ app.py <-- Main Streamlit application, handles UI, auth, and chat
βββ chains.py <-- Defines the RAG chain and retriever
βββ embeddings.py <-- Handles embedding model loading
βββ history.py <-- Manages chat history for conversational context
βββ streamlit_app.py <-- (Potentially deprecated or merged into app.py, needs clarification)
Setup and Installation
Prerequisites
- Python 3.x
- Docker (optional, for containerized deployment)
- An OpenAI API Key (to be provided within the application)
Local Setup
- Clone the repository:
git clone https://github.com/your-repo/cet_advisement_bot.git cd cet_advisement_bot
- Create a virtual environment and activate it:
python -m venv venv .\venv\Scripts\activate # On Windows source venv/bin/activate # On macOS/Linux
- Install dependencies:
pip install -r requirements.txt
- Prepare data files:
The application expects
original_cat.pdf
and theoriginal_vector
directory (containingindex.faiss
andindex.pkl
) to be present in thedocs/
directory. These files are crucial for the RAG system. Ensure these are downloaded and placed correctly. (Note: If these files are large and hosted externally, instructions for downloading them usinggdown
or similar tools should be added here.) - Run the Streamlit application:
The application will open in your web browser.streamlit run src/app.py
Docker Deployment
- Build the Docker image:
docker build -t cet-advisement-bot .
- Run the Docker container:
Access the application atdocker run -p 8501:8501 cet-advisement-bot
http://localhost:8501
in your browser.
Usage
- Login/Register: Upon launching the application, you will be prompted to log in or register a new account.