diagen
v0.0.7
Published
Create beautiful, reflective diagrams from code and data.
Downloads
54
Readme
🚀 Features
- 🎨 Generate beautiful diagrams from your data
- 🤖 Utilize multiple AI models (OpenAI, Anthropic, Google) for diagram creation and improvement
- 🔄 Automatic diagram refinement through visual reflection and critique
- 📊 Support for various diagram types (flowcharts, architecture diagrams, etc.)
- 🛠 Easy-to-use CLI interface
- 📝 Customizable diagram generation process
How it works (explained by Diagen)
🏁 Run as a tool
Set up your API keys as environment variables:
- OpenAI:
OPENAI_API_KEY
- Anthropic:
ANTHROPIC_API_KEY
- Google (Gemini):
GEMINI_API_KEY
Example:
export OPENAI_API_KEY=your_openai_api_key_here
Run
diagen
in your terminal:npx diagen <source file>
Follow the interactive prompts:
- Provide a path to your source text file
- Choose AI models for generation, fixing, and critique
- Describe your data and desired diagram type
- Set parameters for diagram refinement
diagen will generate, render, and iteratively improve your diagram based on AI feedback.
Import as a function
npm install diagen
import { diagen } from "diagen";
const diagramResults = await diagen(
data,
dataDesc,
diagramDesc,
generationModel,
fixModel,
critiqueModel,
maxFixSteps,
maxCritiqueRounds,
provideFixHistory,
provideCritiqueHistory,
provideDataForCritique,
injectTempDir,
openDiagrams,
silent
);
Run from the repository
git clone https://github.com/southbridgeai/diagen.git
cd diagen
bun install
Run diagen directly from bun:
bun run src/run.ts <source file>
📋 Prerequisites
- Node.js (v14 or later)
- d2 (Diagram rendering tool)
🎛 Advanced Configuration
When running diagen, you can customize various aspects:
- AI models for different stages (generation, fixing, critique)
- Number of fix attempts and critique rounds
- Whether to use fix and critique history
- Output directory for generated files
📊 Supported Diagram Types
diagen can generate various types of diagrams, including but not limited to:
- Flowcharts
- Architecture diagrams
- Entity-relationship diagrams
- Process flow diagrams
- Mind maps
Specify your desired diagram type during the generation process for best results.
🤝 Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
- Fork the repository
- Create your feature branch (
git checkout -b feature/AmazingFeature
) - Commit your changes (
git commit -m 'Add some AmazingFeature'
) - Push to the branch (
git push origin feature/AmazingFeature
) - Open a Pull Request
📜 License
This project is licensed under the Apache 2.0 License - see the LICENSE file for details.
🙏 Acknowledgements
- d2 for diagram rendering
- OpenAI, Anthropic, and Google for their powerful AI models
- All contributors and users of diagen
Created with ❤️ by Hrishi Olickel