A Python application that researches any topic using Google Gemini and saves structured reports locally.
Research Assistant lets users enter a topic, generate an AI-powered structured research report, and come back to view saved reports whenever they want.
- Enter any topic and receive a structured research report generated by Gemini
- Reports saved locally as JSON, with unique filenames so nothing gets overwritten
- View a single saved report or all saved reports at once
- Input validation for empty topics
- Error handling for invalid AI responses, missing reports, and corrupted JSON files
%%{init: {"flowchart": {"nodeSpacing": 60, "rankSpacing": 90, "curve": "linear", "padding": 16, "useMaxWidth": true}, "themeVariables": {"fontSize": "17px", "fontFamily": "JetBrains Mono, monospace"}}}%%
flowchart LR
M{"<b>📂 Menu</b>"}
A["<b>📝 Enter topic</b>"]
B["<b>✅ Validate</b>"]
C["<b>🤖 Gemini AI</b>"]
D["<b>💾 Save</b>"]
E["<b>📚 View reports</b>"]
F["<b>📄 Display</b>"]
X["<b>🚪 Exit</b>"]
M -->|1| A --> B --> C --> D --> M
M -->|2| E --> F --> M
M -->|3| X
classDef menu fill:#0a1128,stroke:#3b82f6,color:#ffffff,stroke-width:3px;
classDef research fill:#0a1a14,stroke:#10b981,color:#ffffff,stroke-width:3px;
classDef view fill:#1f1508,stroke:#f59e0b,color:#ffffff,stroke-width:3px;
classDef exit fill:#1a0e14,stroke:#e11d48,color:#ffffff,stroke-width:3px;
linkStyle default stroke:#8a8a8a,stroke-width:2px;
class M menu;
class A,B,C,D research;
class E,F view;
class X exit;
Blue is the menu, green is the research path from topic to saved report, amber is viewing what's already saved, and red is exit. Both paths loop back to the menu when they finish.
| Scenario | Response |
|---|---|
| Empty topic entered | Please enter a valid research topic. |
| Gemini returns invalid JSON | Error: Gemini returned an invalid JSON response. |
| AI request fails | Research could not be generated. Please try again. |
| No saved report found | No saved research report found. |
| Saved report file is corrupted | Invalid JSON format in the research report. |
Research Assistant combines several practical concepts into one working application: object-oriented design for representing a research report, API integration with an external AI service, environment variable management for API keys, JSON parsing for both AI responses and local storage, file handling for saving and loading reports, structured error handling across both AI and file failures, and datetime tracking for report timestamps.