An unofficial advisor chatbot that provide up-to-date information about The University of Texas at Dallas powered by Google's PaLM 2 🌴, MongoDB 🍃 and Langchain 🦜️🔗.
You can do all of this with CompassUTD🧭
- Searching for course information and descriptions using natural language or shorthand names (e.g., "Comp Arch" instead of "CS 2340: Computer Architecture").
- Providing professor ratings from RateMyProfessors.com for UT Dallas faculty.
- Offering information about the majors and minors available at UT Dallas.
- Supplying general information about UT Dallas, such as tech support, parking, and more.
- Providing details about staff, schools, and departments, including contact information, office locations, hours, and more.
- Keeping users informed about the latest news and events at UT Dallas.
- And more to come!
- CompassUTD utilized Google PaLM 2's reasoning capabilities to generate accurate answers.
- PaLM 2 will ultilize Langchain's tools and the Programmable Search Engine to conduct research and locate the correct information.
- MongoDB is employed to store chat messages, enabling PaLM 2 to retain previous conversations for contextual understanding. It also generate a SessionId token so that the user can save their chat history in the cookies and enable them to see past messages.
The process of sending a message and then arrive at a conclusion follow the paper ReAct. The steps are as follow:
- Users initiate interaction with the chatbot via the web app.
- The web app transmits the user's message and a sessionId token to the FastAPI server deployed on GCP's Cloud Run container.
- The FastAPI server checks MongoDB to determine if the user has any previous messages stored in the database.
- Vertex AI's PaLM 2 model receives the current message along with the previous message retrieved from MongoDB.
- Utilizing the current and previous messages, PaLM 2 "reason" on the appropriate course of action to generate a response. This is the "Reason" in "ReAct"
- PaLM 2 "acts" on its plan by utilizing Langchain's microservices deployed on the same Cloud Run instance. This is the "Action" in "ReAct"
- If the initial response is unsatisfactory, steps 5 and 6 (the "ReAct" plan) are repeated until a satisfactory response is obtained or a timeout occurs.
- The response is then sent back to the FastAPI server, allowing the web app to retrieve the result by calling the FastAPI server.
This approach enables the chatbot to achieve high accuracy and retain conversation context, resulting in a more personalized user experience.
If you are interested in the frontend, check out Arihan's frontend github repo
Here are the steps to run this project locally or deploy it to Google Cloud Platform
-
Create a Google Cloud Platform account and enable Vertex AI and the required APIs for the project. Then create a service account, and save it API service account key as
google_key.json
and put it intrain-and-finetune
andfast_api_app/app
folder. -
Create a MongoDB Atlas account and create a cluster Save the connection string as
MONGODB_LOGIN
andMONGODB_LOCATION
for later. -
Get the API key to perform the search. Then create 3 search engines that match the following and save individual
Search Engine ID
:
- You have all the required information to create a
.env
file. Create a .env file in thefast_api_app/app
andtrain-and-finetune
folder with the following content. Replace the values with your own.
MONGODB_LOGIN = `REPLACE`
MONGODB_LOCATION = `REPLACE`
GOOGLE_APPLICATION_CREDENTIALS = google_key.json
GOOGLE_SEARCH_API = `REPLACE`
COURSE_SEARCH_ID = `REPLACE`
RANDOM_SEARCH_ID = `REPLACE`
DEGREE_SEARCH_ID = `REPLACE`
- Now you should be able to run the project locally in
train-and-finetune/ai_sandbox.ipynb
.
- If you would like to run the FastAPI server. Run the following commands in the terminal.
cd fast_api_app
# For in browser testing
uvicorn app.main:app --reload
# For Docker Container testing
local_docker_test.cmd
# For Google Cloud Run deployment
deploy_to_cloud_run.cmd
- Have fun! Open a GitHub issue if you have any questions.