ProfSync is a professor rating and review system similar to Rate My Professor. This repository contains the backend code for the ProfSync application, which includes a chatbot capable of handling both professor-specific queries and casual conversations.
- Express.js server setup with CORS support
- Integration with Google's Generative AI (Gemini) for message classification and response generation
- Pinecone vector database integration for efficient similarity search
- Conversation memory management for context preservation
- Dynamic response formatting for both professor-specific and casual conversations
Before you begin, ensure you have met the following requirements:
- Node.js installed
- npm (Node Package Manager) installed
- Pinecone account and API key
- Google Generative AI API key
-
Clone the repository:
git clone [repository-url]
-
Navigate to the project directory:
cd profsync-backend
-
Install the dependencies:
npm install
-
Create a
.env
file in the root directory and add the following environment variables:REACT_APP_GOOGLE_API_KEY=[Your Google API Key] REACT_APP_PINECONE_API_KEY=[Your Pinecone API Key] REACT_APP_PINECONE_INDEX_NAME=[Your Pinecone Index Name] PORT=5000
To start the server, run:
npm start
The server will start running on http://localhost:5000
.
Send a message to the chatbot.
Request body:
{
"message": "Your message here"
}
Response:
{
"response": "HTML formatted response from the chatbot"
}
-
Message Classification: Incoming messages are classified as either "Professor-Specific" or "Casual Conversation" using Google's Generative AI.
-
Embedding Generation: For professor-specific queries, the message is converted into an embedding using Google's text-embedding-004 model.
-
Pinecone Search: The embedding is used to search for similar entries in the Pinecone vector database.
-
Response Generation:
- For professor-specific queries, the Pinecone results are summarized using Google's Generative AI.
- For casual conversations, a generic response is generated.
-
Response Formatting: The final response is formatted into HTML for easy rendering on the frontend.
- Frontend module can be accessed here.
- Code to generate and store data to pinecone can be accessed here
Contributions to ProfSync are welcome. Please follow these steps:
- Fork the repository
- Create a new branch (
git checkout -b feature/AmazingFeature
) - Commit your changes (
git commit -m 'Add some AmazingFeature'
) - Push to the branch (
git push origin feature/AmazingFeature
) - Open a Pull Request
This project is licensed under the Apache License, Version 2.0
For any questions or inquiries about this project, please contact [Your Name] at [your email or preferred contact method].