Skip to content

Repository files navigation

IUB Helpdesk Assistant

A Flask web application that answers common Islamia University of Bahawalpur (IUB) student questions. It searches a local FAQ database first and uses Google Gemini only when no suitable FAQ answer is found.

Built for the InventaCore AI Business Automation Challenge 2026 — Track 1: Customer Operations.

Business Problem

University helpdesk staff repeatedly answer the same routine student questions (fees, library hours, portal issues, hostel services, etc.) manually. This is slow, repetitive, and inconsistent across different staff members. This project automates that first layer of response.

Features

  • Searches 25 built-in FAQs covering fees, admissions, academics, campus, portal, transport, and hostel services.
  • Uses Gemini AI as a fallback for questions that do not match an FAQ.
  • Validates empty, oversized, and blocked questions before processing them.
  • Saves recent questions, answers, source, status, and timestamps in SQLite.
  • Provides a /history page showing the latest 20 interactions.

Requirements

  • Python 3.10 or newer
  • A Google Gemini API key

Install the Python packages:

python -m pip install -r requirements.txt

Setup

  1. Copy .env.example to .env in the project root.
  2. Add your Gemini API key:
GEMINI_API_KEY=your_api_key_here

Do not commit .env or share the API key.

Run the application

From the project folder, run:

python app.py

Then open http://127.0.0.1:5000 in a browser.

How it works

  1. A student submits a question on the home page.
  2. The app validates the question (maximum 300 characters).
  3. faq_search.py compares its keywords with saved FAQs using Jaccard similarity.
  4. A confident match is returned from the database.
  5. Otherwise, ai_fallback.py asks the Gemini gemini-2.5-flash model.
  6. The result is saved to helpdesk.db and can be viewed at http://127.0.0.1:5000/history.

Measurable Impact

In a live test of 10 varied student questions:

  • 4 (40%) were answered instantly from the FAQ database in under 1 second, at zero AI cost.
  • 6 (60%) required an AI-generated response for questions outside the stored FAQ set.
  • Every response returned successfully; error handling was separately verified by simulating an invalid API key, which was caught cleanly, shown as a safe message to the user, and logged as a failed interaction instead of crashing the app.
  • As more FAQs are added over time, the share of instant, free, database-answered queries is expected to increase, further reducing AI cost and response time.

Project structure

.
|-- app.py              # Flask routes and request handling
|-- ai_fallback.py      # Gemini AI fallback
|-- faq_search.py       # FAQ matching logic
|-- database.py          # SQLite setup, seed data, and interaction logging
|-- helpdesk.db          # Local SQLite database
|-- templates/           # Home and history HTML templates
|-- static/style.css     # Application styling
`-- .env                # Local Gemini API key (not committed)

Useful checks

python database.py      # Creates tables and seeds FAQs if needed
python faq_search.py    # Runs FAQ search examples
python ai_fallback.py   # Tests the Gemini connection

Limitations

  • FAQ matching uses keyword/word-overlap similarity (Jaccard), not deep semantic understanding — some rephrased questions (e.g. "wifi not working" vs. the stored "internet/Wi-Fi issues" FAQ) may not match and will go to AI instead. This is the intended fallback behavior, not a failure.
  • Currently runs on Flask's built-in development server; not hardened for production traffic.
  • FAQ database is limited to 25 sample questions for demonstration purposes.

Notes

  • The app initializes its database automatically when app.py starts.
  • If Gemini is unavailable or the key is invalid, the app shows a safe helpdesk message and records the failed request.
  • Use production configuration rather than Flask debug mode before deploying publicly.

Author

Musfirah Ather — 6th-semester AI student, The Islamia University of Bahawalpur

About

AI-powered FAQ helpdesk for IUB students — instant answers from a local database, with Google Gemini AI fallback for questions outside the FAQ set. Built for InventaCore AI Business Automation Challenge 2026.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages