A comprehensive knowledge graph visualization platform with intelligent CSV-to-graph generation powered by Large Language Models (LLMs).
- Interactive Graph Visualization: Explore knowledge graphs with React Flow
- Table View Integration: View and edit CSV data alongside graph visualization
- Multiple Export Formats: Export graphs as PNG, JPEG, or SVG
- Responsive Design: Optimized for desktop and mobile devices
- LLM-Powered Analysis: Automatically generate meaningful nodes and edges from CSV data
- Smart Relationship Detection: AI identifies entities, processes, events, and their relationships
- Configurable Parameters: Customize node/edge limits and provide additional context
- Multiple AI Providers: Support for both OpenAI and Azure OpenAI
- Real-time Feedback: Visual progress indicators and detailed analysis results
- Node.js 18+
- npm or yarn
- OpenAI API key OR Azure OpenAI service setup
-
Clone the repository
git clone <repository-url> cd knowledge-hub
-
Install dependencies
npm install
-
Configure Environment Variables
cp .env.example .env.local
-
Set up your AI provider (see Configuration section below)
-
Run the development server
npm run dev
-
Open your browser Navigate to http://localhost:3000
Add to your .env.local file:
# OpenAI Configuration
OPENAI_API_KEY=your_openai_api_key_hereFor deployment with Azure OpenAI, add to your .env.local file:
# Azure OpenAI Configuration
USE_AZURE_OPENAI=true
AZURE_OPENAI_API_KEY=your_azure_openai_api_key_here
AZURE_OPENAI_ENDPOINT=https://your-resource-name.openai.azure.com
AZURE_OPENAI_DEPLOYMENT_NAME=your-deployment-name
AZURE_OPENAI_API_VERSION=2024-02-15-preview- Navigate to the Explorer page
- Click on "Table View" to load your CSV data
- The sidebar will show the "Search" tab with AI generation options
- Load CSV Data: Click "Table View" to load your source data
- Access AI Generator: In the sidebar's "Search" tab, scroll down to find the AI Graph Generation section
- Configure Options (Optional):
- Click "Options" to customize:
- Additional Context: Provide domain-specific information to help the AI
- Max Nodes: Set the maximum number of nodes to generate (5-50)
- Max Edges: Set the maximum number of relationships to create (5-100)
- Generate: Click "Generate Graph with AI"
- Review Results: The AI will analyze your data and show:
- Success message with node/edge counts
- Processing statistics
- AI reasoning behind the analysis
- The new graph will automatically replace the current visualization
- Use the standard graph tools for further exploration:
- Zoom and pan
- Select nodes and edges for details
- Export the generated graph
- Data Preprocessing: The system samples your CSV data (up to 50 rows) for analysis
- LLM Analysis: The AI identifies:
- Entities: People, places, concepts, materials
- Processes: Actions, workflows, procedures
- Events: Time-based occurrences
- Relationships: Causal, temporal, dependency, and associative connections
- Graph Generation: Creates optimally positioned nodes and meaningful edges
- Validation: Ensures all relationships reference valid nodes
- Event: Time-based occurrences or milestones
- Process: Actions, workflows, or procedures
- Material: Physical or conceptual materials
- Entity: People, organizations, or concepts
- Concept: Abstract ideas or categories
- Causal: Cause-and-effect relationships
- Process: Workflow or procedural connections
- Temporal: Time-based sequences
- Dependency: Required relationships
- Association: General connections
- Headers: First row should contain column names
- Content: Any structured data with relationships
- Size: Optimal performance with datasets under 10,000 rows
- Encoding: UTF-8 recommended
Manufacturing Process Data:
Process,Material,Output,Duration,Department
Mixing,Raw Chemicals,Mixed Solution,30 min,Chemistry
Heating,Mixed Solution,Heated Compound,45 min,Processing
Quality Check,Heated Compound,Approved Product,15 min,QA
Organizational Data:
Person,Department,Role,Reports To,Project
Alice,Engineering,Manager,Bob,Project A
Bob,Engineering,Director,CEO,Project A
Carol,Marketing,Specialist,Dave,Project B
- Graph Canvas: Interactive visualization area
- Sidebar Tabs:
- Search: AI generation tools and node creation
- Properties: Selected element details
- Comments: Collaboration features
- Table View: CSV data viewer/editor (toggle on/off)
- Export Tools: PNG, JPEG, SVG export options
- Bottom: Table below graph (default)
- Right: Table beside graph (side-by-side)
- Overlay: Floating table over graph
knowledge-hub/
βββ src/
β βββ app/
β β βββ api/
β β β βββ generate-graph/ # LLM graph generation API
β β β βββ graphs/ # Graph CRUD operations
β β β βββ csv/ # CSV data handling
β β βββ explorer/ # Main application page
β β βββ page.tsx # Landing page
β βββ components/
β β βββ Graph/
β β β βββ GraphGenerator.tsx # AI generation component
β β β βββ GraphCanvas.tsx # Main visualization
β β β βββ ...
β β βββ Table/ # CSV table components
β βββ types/
β β βββ graph.ts # TypeScript definitions
β βββ utils/
β βββ csvParser.ts # CSV processing utilities
βββ public/
βββ data/ # Sample CSV files
# Development
npm run dev
# Production build
npm run build
# Start production server
npm start
# Linting
npm run lintAPI Key Not Configured
- Error: "OpenAI API key not configured"
- Solution: Set
OPENAI_API_KEYin your.env.localfile
Quota Exceeded
- Error: "OpenAI API quota exceeded"
- Solution: Check your OpenAI billing and usage limits
Invalid CSV Data
- Error: "Invalid CSV data provided"
- Solution: Ensure your CSV has headers and valid data rows
Generation Timeout
- The AI generation may take 10-30 seconds for complex datasets
- Large datasets are automatically sampled to ensure performance
- API keys are server-side only and never exposed to the client
- CSV data is processed locally and only metadata is sent to the LLM
- All AI requests are rate-limited and validated
- No sensitive data is stored permanently by the AI service
- Use smaller CSV files (< 10,000 rows) for faster processing
- Provide specific context to help the AI focus on relevant relationships
- Start with lower node/edge limits and increase as needed
- Clean your CSV data (remove empty rows, standardize formats)
- Use descriptive column headers
- Provide domain-specific context in the options
- Include relevant relationships in your data structure
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add some amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
This project is licensed under the MIT License - see the LICENSE file for details.
For issues, questions, or feature requests:
- Check the existing issues in the repository
- Create a new issue with detailed information
- Include error messages, CSV samples, and screenshots when relevant
Happy Knowledge Graphing! ππ