π§ Technical Mindmap Generator
An AI-powered Streamlit application that generates interactive radial mindmaps for technical keywords using Gemini, Tavily, and Knowledge Graph APIs.
β¨ Features
- π― Interactive Radial Mindmaps: Beautiful, explorable visualizations with zoom, pan, and hover
- π€ AI-Powered Analysis: Leverages three powerful APIs for comprehensive results
- β‘ Optimized Performance: Sequential API calls with async processing
- π¨ Modern UI: Clean, responsive design inspired by GPT/Claude/Perplexity
- π Query History: Track and revisit previous mindmaps in the same session
- π Real-time Data: Fresh insights from authoritative web sources
ποΈ Architecture
Sequential API Call Strategy
The application uses an optimized 3-step approach for maximum data quality:
User Input (Technical Keyword)
β
βββββββββββββββββββββββββββββββββββ
β STEP 1: Tavily API β
β β’ Web search & context β
β β’ Related term extraction β
β β’ Source collection β
βββββββββββββββββββββββββββββββββββ
β (context + terms)
βββββββββββββββββββββββββββββββββββ
β STEP 2: Knowledge Graph API β
β β’ Structured entity data β
β β’ Relationship mapping β
β β’ Entity descriptions β
βββββββββββββββββββββββββββββββββββ
β (entities + relationships)
βββββββββββββββββββββββββββββββββββ
β STEP 3: Gemini AI β
β β’ Synthesis of all data β
β β’ Mindmap structure generation β
β β’ Hierarchical organization β
βββββββββββββββββββββββββββββββββββ
β
PyVis Radial Visualization
Why Sequential?
Each API call benefits from context gathered in previous steps, maximizing relevance and reducing noise.
π¦ Installation
Prerequisites
- Python 3.9+
- pip package manager
- API Keys:
- Gemini API Key (Free tier available)
- Tavily API Key (Free tier: 1000 requests/month)
- Google Cloud Project with Knowledge Graph API enabled
Step-by-Step Setup
1. Clone or Download the Project
# If using git
git clone <repository-url>
cd technical-mindmap-generator
# Or download and extract the ZIP file
2. Create Virtual Environment
# Create virtual environment
python -m venv venv
# Activate it
# On macOS/Linux:
source venv/bin/activate
# On Windows:
venv\Scripts\activate
3. Install Dependencies
pip install -r requirements.txt
This will install:
- streamlit
- pyvis
- networkx
- google-generativeai
- tavily-python
- google-cloud-enterpriseknowledgegraph
- aiohttp
- python-dotenv
- pydantic
- requests
4. Configure API Keys
Create a .env file in the project root:
# Copy the example file
cp .env.example .env
# Edit with your API keys
nano .env # or use any text editor
Add your API keys to .env:
GEMINI_API_KEY=your_actual_gemini_api_key_here
TAVILY_API_KEY=your_actual_tavily_api_key_here
GOOGLE_CLOUD_PROJECT_ID=your_google_cloud_project_id_here
# Optional settings
MAX_CONCURRENT_REQUESTS=3
CACHE_ENABLED=true
DEBUG_MODE=false
MAX_NODES=20
MAX_DEPTH=2
5. Get Your API Keys
Gemini API Key:
- Visit https://ai.google.dev/
- Click "Get API Key"
- Sign in with Google account
- Create new API key
- Copy the key
Tavily API Key:
- Visit https://tavily.com/
- Sign up for free account
- Navigate to API Keys section
- Copy your API key
Google Cloud Knowledge Graph:
- Visit https://console.cloud.google.com/
- Create new project or select existing
- Enable "Enterprise Knowledge Graph API"
- Copy your project ID
6. Run the Application
streamlit run app.py
The application will open automatically in your browser at http://localhost:8501
π Usage
Basic Workflow
- Enter Keyword: Type any technical term (e.g., "Machine Learning", "Kubernetes")
- Generate: Click the "π Generate Mindmap" button
- Wait: Processing takes 10-15 seconds as data is fetched from all APIs
- Explore: Interact with the mindmap:
- π Zoom: Mouse wheel or pinch gesture
- π Pan: Click and drag
- βΉοΈ Hover: View detailed node information
- π§ Navigate: Use built-in navigation controls
- View Details: Expand the metadata section for sources and statistics
- New Query: Enter another keyword; previous mindmaps saved in history
Example Keywords to Try
- AI/ML: Machine Learning, Neural Networks, Deep Learning, Transformers
- DevOps: Kubernetes, Docker, CI/CD, Microservices
- Blockchain: Ethereum, Smart Contracts, DeFi, NFTs
- Cloud: AWS, Serverless, Cloud Native, Edge Computing
- Programming: Python, JavaScript, Rust, TypeScript
π Project Structure
technical-mindmap-generator/
β
βββ app.py # Main Streamlit application
βββ requirements.txt # Python dependencies
βββ .env.example # Environment variables template
βββ .env # Your API keys (create this)
βββ README.md # This file
β
βββ config/
β βββ __init__.py
β βββ settings.py # Configuration management
β
βββ utils/
βββ __init__.py
βββ api_handler.py # API integration layer
βββ mindmap_generator.py # PyVis visualization
βοΈ Configuration
Environment Variables
Edit .env to customize behavior:
| Variable | Default | Description |
|---|---|---|
GEMINI_API_KEY |
Required | Gemini AI API key |
TAVILY_API_KEY |
Required | Tavily search API key |
GOOGLE_CLOUD_PROJECT_ID |
Required | Google Cloud project ID |
MAX_CONCURRENT_REQUESTS |
3 | Max parallel API calls |
CACHE_ENABLED |
true | Enable result caching |
DEBUG_MODE |
false | Enable debug logging |
MAX_NODES |
20 | Maximum nodes in mindmap |
MAX_DEPTH |
2 | Maximum hierarchy depth |
Customization
Mindmap Colors (in utils/mindmap_generator.py):
self.level_colors = {
0: "#ff6b6b", # Center - red/coral
1: "#4ecdc4", # Primary - teal
2: "#95e1d3", # Secondary - light teal
3: "#f9ca24", # Tertiary - yellow
4: "#a29bfe" # Quaternary - purple
}
UI Theme (in app.py CSS section):
- Modify gradient colors
- Adjust border radius
- Change font sizes and families
π Troubleshooting
Common Issues
Issue: "Missing API Keys" error
- Solution: Ensure
.envfile exists and contains valid API keys - Check that
.envis in the project root directory - Verify no extra spaces around
=in.env
Issue: Mindmap not displaying
- Solution: Check browser console for JavaScript errors
- Try refreshing the page (Ctrl+R or Cmd+R)
- Ensure PyVis generated HTML successfully
Issue: Slow performance
- Solution:
- Reduce
MAX_NODESin.env - Check internet connection
- Verify API rate limits not exceeded
- Reduce
Issue: "Import Error" on startup
- Solution:
- Ensure virtual environment is activated
- Run
pip install -r requirements.txtagain - Check Python version is 3.9+
Issue: Knowledge Graph API error
- Solution:
- Verify Google Cloud project has Knowledge Graph API enabled
- Check project ID is correct
- Ensure billing is enabled (free tier available)
Debug Mode
Enable debug logging:
# In .env
DEBUG_MODE=true
Then check console output for detailed error messages.
π§ Development
Adding New Features
Add a new API source:
- Edit
utils/api_handler.py - Add new async method (e.g.,
fetch_xyz_data) - Integrate into
fetch_all_data()method - Update documentation
Customize visualization:
- Edit
utils/mindmap_generator.py - Modify
create_radial_mindmap()method - Update PyVis options for physics/styling
Testing
Run a simple test:
# test_api.py
from utils.api_handler import fetch_mindmap_data
from config.settings import settings
result = fetch_mindmap_data(
keyword="Python",
gemini_key=settings.gemini_api_key,
tavily_key=settings.tavily_api_key,
google_project_id=settings.google_cloud_project_id
)
print(f"Nodes: {len(result['mindmap']['nodes'])}")
print(f"Edges: {len(result['mindmap']['edges'])}")
π― API Usage & Costs
Free Tier Limits
Gemini API:
- 60 requests per minute
- 1500 requests per day
- Free for personal use
Tavily API:
- 1000 requests per month (free tier)
- Upgrade available for more
Knowledge Graph API:
- 100,000 free calls per day
- No credit card required for free tier
Cost Optimization Tips
- Enable caching to reduce redundant calls
- Use
MAX_NODESto limit result size - Batch similar queries if possible
- Monitor usage in respective dashboards
π Tech Stack
| Technology | Purpose | Version |
|---|---|---|
| Streamlit | Web framework | 1.28+ |
| PyVis | Graph visualization | 0.3.2+ |
| NetworkX | Graph algorithms | 3.1+ |
| Gemini AI | Language model | Latest |
| Tavily | Web search | Latest |
| Knowledge Graph | Entity data | Latest |
| AsyncIO | Async operations | Built-in |
| Pydantic | Data validation | 2.0+ |
π€ Contributing
Contributions are welcome! Here's how:
- Fork the repository
- Create feature branch (
git checkout -b feature/amazing-feature) - Commit changes (
git commit -m 'Add amazing feature') - Push to branch (
git push origin feature/amazing-feature) - Open Pull Request
Development Guidelines
- Follow PEP 8 style guide
- Add docstrings to all functions
- Test thoroughly before submitting
- Update documentation as needed
π License
This project is licensed under the MIT License - see LICENSE file for details.
π Acknowledgments
- Streamlit - Amazing web framework
- PyVis - Interactive visualizations
- Google Gemini - Powerful AI synthesis
- Tavily - Real-time web search
- Google Knowledge Graph - Structured data
π§ Support
For issues, questions, or suggestions:
- Open an issue on GitHub
- Email: your.email@example.com
- Documentation: See inline code comments
π Roadmap
Upcoming Features
- Export mindmaps as PNG/SVG/PDF
- Persistent storage with database
- User authentication and sharing
- Custom color themes
- Advanced filtering options
- Integration with more knowledge sources
- Collaborative editing
- Mobile app version
- API endpoint for programmatic access
Built with β€οΈ using Python, Streamlit, and AI
πΈ Screenshots
Add screenshots of your application here
Last Updated: October 2025
Version: 1.0.0
Status: Production Ready