A web-based AI Assistant built with Python, Flask, and Google Gemini API as part of a Prompt Engineering assignment.
https://ai-assistant-development-3.onrender.com
This AI Assistant can perform 4 distinct functions:
| # | Function | Description |
|---|---|---|
| 1 | Question Answering | Get clear answers to any question |
| 2 | Text Summarization | Summarize long text into concise format |
| 3 | Content Generation | Generate stories, poems, essays, ideas |
| 4 | Study Advisor | Get personalized study plans and roadmaps |
| Technology | Version | Purpose |
|---|---|---|
| Python | 3.12 | Backend language |
| Flask | 3.0.0 | Web framework |
| Google Gemini API | gemini-2.0-flash | AI model |
| google-genai | 2.8.0 | Official Gemini SDK |
| HTML5 / CSS3 | - | Frontend UI |
| JavaScript ES6 | - | Async API calls |
| python-dotenv | 1.0.0 | Secure API key management |
| Gunicorn | 26.0.0 | Production server |
ai_assistant/
├── app.py # Main Flask entry point
├── config.py # Configuration & settings
├── requirements.txt # Python dependencies
├── Procfile # Render deployment config
├── .env # API key (not in GitHub)
│
├── routes/ # URL endpoints
│ ├── qa_routes.py
│ ├── summarize_routes.py
│ ├── generate_routes.py
│ └── advisor_routes.py
│
├── services/ # Business logic
│ ├── gemini_service.py
│ ├── qa_service.py
│ ├── summarize_service.py
│ ├── generate_service.py
│ └── advisor_service.py
│
├── prompts/ # Prompt Engineering templates
│ ├── qa_prompts.py
│ ├── summarize_prompts.py
│ ├── generate_prompts.py
│ └── advisor_prompts.py
│
├── utils/
│ └── feedback_handler.py # Feedback storage
│
├── static/
│ ├── css/style.css
│ └── js/main.js
│
└── templates/
├── base.html
├── index.html
├── qa.html
├── summarize.html
├── generate.html
└── advisor.html
| Technique | Description | Used In |
|---|---|---|
| Role Prompting | Assign AI a specific role | QA, Advisor |
| Output Scaffolding | Specify exact output structure | QA Detailed |
| Constrained Generation | Word limits + audience | Summarize Academic |
| Creative Scaffolding | Guide creativity with parameters | Generate Detailed |
| Persona Prompting | Professional writer persona | Generate Structured |
| Multi-aspect Prompting | Multiple dimensions at once | Advisor Expert |
git clone https://github.com/Piyushrajsaaa/ai_assistant-development.git
cd ai_assistant-developmentpython -m venv venv
source venv/bin/activate # Mac/Linux
venv\Scripts\activate # Windowspip install -r requirements.txtCreate a .env file in the root folder:
Get your free key at: https://aistudio.google.com/app/apikey
python app.pyRun formal test cases:
python test_cases.pyExpected output: PASS | QA | Simple | What is Python?
PASS | QA | Educational | Explain OOP concepts
PASS | QA | Detailed | What is Artificial Intelligence?
PASS | QA | Edge | Empty input handled → validation working correctly
PASS | Summarize | Quick | ML paragraph
PASS | Summarize | Bullet | ML paragraph
PASS | Summarize | Academic | ML paragraph
PASS | Summarize | Edge | Too short text handled → validation working correctly
PASS | Generate | Simple | Poem about autumn
PASS | Generate | Detailed | Story about a robot
PASS | Generate | Structured | Essay about AI
PASS | Generate | Idea | Science fiction novel
PASS | Advisor | Quick | DSA tips
PASS | Advisor | Roadmap | Machine Learning
PASS | Advisor | Expert | System Design interviews **15/15 Tests Passing **
After every AI response, users can submit feedback:
- Yes — Response was helpful
- No — Response was not helpful
Feedback is stored locally in feedback.json with timestamp, function name, and rating.
- User authentication and chat history
- PDF/document upload for summarization
- Voice input using Web Speech API
- Analytics dashboard for feedback stats
- Multi-language support
- Full cloud deployment with database
Piyush Raj Computer Science Student Prompt Engineering Assignment — 2026
This project is for educational purposes only.