AI-powered course + career explorer for students, advisors, and incoming freshmen.
Ask natural-language questions about majors, courses, salaries, and career fit; MajorMatch replies conversationally and uses grounded tools when helpful (semantic course search, career-context lookup, and a career-track predictor).
- Chat-first Streamlit UI with tool-grounded replies.
- Semantic course search with embeddings and 2D projections (PCA / UMAP / t-SNE).
- Career-context tool (Adzuna) for live job-market data (optional).
- Simple ML track predictor with an interactive feature-selection UI.
- Portable fallback storage for embeddings (Postgres float[]); pgvector optional.
- Language(s): Jupyter Notebooks (project artifacts) + Python 3.10+
- Runtime / framework: Streamlit app (streamlit_app.py)
- Notable libraries: sentence-transformers, scikit-learn, SQLAlchemy, plotly, streamlit
README.md <- this file
streamlit_app.py <- Streamlit UI and main app loop
app_logic.py <- high-level UI helpers and orchestrator helpers
course_index.py <- course index, embeddings, projection & DB layer
requirements.txt <- Python dependencies for the main app
api/ <- tool implementations and orchestrator logic
ollama.py <- transport to Ollama (chat + streaming)
orchestrator.py <- tool-calling orchestrator & tool schemas
predict.py <- prediction helper and feature listing
search.py <- higher-level search or wrapper utilities
data/ <- place course CSV(s) here (title, description)
docs/ <- architecture notes, setup guide, implementation log
scripts/ <- utility scripts (indexing/embed.py)
tests/ <- lightweight pytest checks
ml_model/ <- model-training artifacts & separate requirements
-
Clone the repo:
git clone https://github.com/eigenlambda123/MajorMatch.git cd MajorMatch -
Create and activate a Python virtual environment:
- Linux / macOS
python -m venv venv source venv/bin/activate - Windows (PowerShell)
python -m venv venv .\venv\Scripts\Activate.ps1
- Linux / macOS
-
Install dependencies:
pip install -r requirements.txt
-
Prepare PostgreSQL (recommended) or use the default local connection string:
- Start Postgres and create a DB + user:
CREATE DATABASE semantic_search; CREATE USER postgres WITH PASSWORD 'postgres'; GRANT ALL PRIVILEGES ON DATABASE semantic_search TO postgres;
- Set DATABASE_URL env var (example):
- Linux / macOS
export DATABASE_URL="postgresql+psycopg2://postgres:postgres@localhost:5432/semantic_search"
- Windows (PowerShell)
$env:DATABASE_URL = "postgresql+psycopg2://postgres:postgres@localhost:5432/semantic_search"
- Linux / macOS
Note: MajorMatch attempts to create the
vectorextension if available.pgvectoris optional — embeddings are stored as float[] by default for portability. - Start Postgres and create a DB + user:
-
(Optional) Start Ollama for local model serving (Chat + tool-calling):
ollama serve
Environment variables:
- OLLAMA_BASE_URL — defaults to
http://localhost:11434 - OLLAMA_MODEL — defaults to
llama2:latest(you may prefer a smaller/faster local model)
- OLLAMA_BASE_URL — defaults to
-
Build the course index (reads CSVs from
data/and writes embeddings/projections to Postgres):- Default: index all CSVs under
data/or the specific file:python scripts/embed.py # or point at a file: python scripts/embed.py data/courses.csv - CSV requirements: must include
titleanddescriptioncolumns; rows missing them are skipped.
- Default: index all CSVs under
-
Run the Streamlit app:
streamlit run streamlit_app.py
Open the URL printed by Streamlit (usually http://localhost:8501).
Run the core test suite (example):
- Linux / macOS:
PYTHONPATH='.' pytest -q - Windows (PowerShell):
$env:PYTHONPATH='.'; .\venv\Scripts\python -m pytest -q
There is a focused test for orchestrator behavior: tests/test_orchestrator.py.
- DATABASE_URL — SQLAlchemy-compatible DB URL (see examples above).
- EMBEDDING_MODEL — sentence-transformers model name (default:
all-MiniLM-L6-v2). - EMBEDDING_DIMENSION — dimension of embeddings (default: 384).
- OLLAMA_BASE_URL — Ollama server URL (default:
http://localhost:11434). - OLLAMA_MODEL — Ollama model name to use for chat.
- ADZUNA_APP_ID / ADZUNA_APP_KEY — optional credentials for career-context job-market data.
- Put one or more CSV files into the
data/directory. - Required columns:
title,description. - The indexer computes sentence-transformer embeddings and stores them in Postgres (float[] by default). Projections (PCA/UMAP/t-SNE) are computed and persisted.
- streamlit_app.py implements the chat-first UI. User messages are sent to the orchestrator which decides whether to call tools.
- api/orchestrator.py handles tool-calling flow, executes tools (predict, career-context, semantic search), and asks the chat model to produce a grounded final reply.
- course_index.py stores and queries the course corpus (embeddings + projection coordinates) in Postgres and provides the semantic search + projection helpers.
- api/ollama.py handles model calls (streaming and batched) to the locally hosted Ollama model.
- If embeddings fail due to missing model packages:
- Ensure
sentence-transformers,torchand the model weights are installed. Large models can require extra disk and memory.
- Ensure
- If Postgres extension
vectorcreation fails: it’s okay — the app will fall back to float[] storage and compute similarity in Python. - If Ollama is unreachable: set
OLLAMA_BASE_URLcorrectly or start Ollama locally. Without Ollama, the assistant can’t perform tool calls; the UI still loads. - If UMAP / t-SNE projection raises errors on very small corpora, try indexing a larger set or use PCA as a fallback.
- The prediction tool expects explicit feature names. The UI can open an interactive prediction selector when the model requests it.
- To reindex after updating
data/, runpython scripts/embed.pyagain; the indexer clears and rebuilds the table. - Course projection methods are available: PCA, UMAP, t-SNE. Computation happens at index time and uses cached course embeddings for fast queries.
- Add issues for bugs or feature requests.
- Keep new CSVs under
data/; follow existing CSV column names. - If adding heavy dependencies, update
requirements.txtand note the change indocs/IMPLEMENTATION.md.
For architecture, data flow, and implementation details see:
- docs/PROJECT_DOCUMENTATION.md
- docs/instruction.md
- docs/IMPLEMENTATION.md