An AI-powered Study Assistant API that answers academic questions in clear, simple language. Built with FastAPI, powered by Groq's LLaMA 3.1 8B (via LangChain), with persistent conversational memory backed by MongoDB Atlas.
🔗 Live API: https://limitbreak-ai.onrender.com 📘 Swagger UI: https://limitbreak-ai.onrender.com/docs
This project is a RESTful backend service that lets clients send a study-related question and receive an AI-generated, student-friendly explanation. It's deployed on Render as a production-style web service, with interactive API docs exposed via Swagger UI.
- 🤖 Generative AI responses — powered by Groq's
llama-3.1-8b-instantmodel - 🧠 Conversational memory — retains context across multiple turns per user
- 💾 Persistent storage — chat history saved in MongoDB Atlas
- 📚 Study-focused — system prompt constrains the bot to academic/learning questions, answered in simple language
- ☁️ Cloud-deployed — live on Render with public API access
- 📖 Interactive docs — Swagger UI for testing without Postman/cURL
Each interaction is stored in MongoDB with:
| Field | Description |
|---|---|
user_id |
Unique identifier for the user/session |
user_message |
The user's query |
bot_response |
The AI-generated reply |
timestamp |
Order of the interaction |
On each new request, prior messages for that user_id are retrieved and appended to the prompt sent to the LLM — simulating memory in an otherwise stateless API.
- Framework: FastAPI
- LLM: Groq LLaMA 3.1 8B (via
langchain-groq) - Database: MongoDB Atlas (
pymongo) - Server: Uvicorn
- Deployment: Render
- Runtime: Python 3.12.3
Request body:
{
"user_id": "student1",
"message": "Explain Artificial Intelligence in simple words"
}Response:
{
"response": "Artificial Intelligence (AI) is like having a smart assistant..."
}Try it live at /docs.
-
Clone the repo:
git clone https://github.com/pavankarthikeyaatchyuta-lab/study-bot.git cd study-bot -
Create a virtual environment and install dependencies:
python -m venv venv source venv/bin/activate # Windows: venv\Scripts\activate pip install -r requirements.txt
-
Create a
.envfile with:GROQ_API_KEY=your_groq_api_key MONGODB_URI=your_mongodb_connection_string -
Run the server:
uvicorn main:app --reload
-
Open
http://127.0.0.1:8000/docsto test the/chatendpoint.
Deployed on Render as a managed web service:
- Start command:
uvicorn main:app --host 0.0.0.0 --port 10000(seestart.sh) - Runtime: specified in
runtime.txt - Environment variables:
GROQ_API_KEY,MONGODB_URIconfigured in Render dashboard
- User-facing frontend interface
- Authentication and user management
- Rate limiting / input validation
- Analytics on chat usage
- Trimming/summarizing long chat histories before they hit the prompt