- Diagram Agent
Diagram Agent is a powerful tool that combines the capabilities of workflow diagramming and questionnaire generation using AI. It leverages the Mermaid markdown-like syntax to create various types of diagrams and uses advanced language models to generate relevant questionnaires.
- Natural Language Processing: Diagram Agent uses advanced language models to generate relevant questionnaires.
- Diagram Generation: Create various types of diagrams such as flowcharts, sequence diagrams, Gantt charts, ER diagrams, class diagrams, and pie charts using natural language descriptions.
- Docker Support: Easily deployable using Docker for consistent environments across different systems.
- Modular Design: Extensible to support additional diagram types.
- Flowcharts
- Sequence Diagrams
- Gantt Charts
- ER Diagrams
- Class Diagrams
- Pie Charts
- Mindmaps
- Welcome Message: Users are greeted with a welcome message and instructions.
- Interactive Questionnaire: Users answer questions to specify the diagram details.
- Diagram Generation: The agent generates the requested diagram based on user input.
- Review and Modify: Users can request modifications if necessary.
- Final Output: The final Mermaid code is provided, ready for use in any Mermaid renderer.
- Interactive Console: Real-time interaction via console interface.
- WebSocket Integration: Real-time updates and communication between front end and back end.
- Responsive Design: Accessible on various devices.
- Docker
- Docker Compose
-
Clone the repository:
git clone https://github.com/your-repo/mermaid-agent.git cd mermaid-agent
-
Create a
.env
file:cp sample_env.txt .env
-
Open the
.env
file and fill in the required values:ANTHROPIC_API_KEY="your_anthropic_api_key" OPENAI_API_KEY="your_openai_api_key" FLASK_APP=app.py FLASK_ENV=development FLASK_DEBUG=1 LOG_LEVEL=INFO MAX_TOKENS=1000 TEMPERATURE=0.7 OUTPUT_DIRECTORY="./outputs" SECRET_KEY="your_secret_key"
-
Build and run the Docker container:
docker-compose up --build
-
Clone the repository:
git clone https://github.com/your-repo/mermaid-agent.git cd mermaid-agent
-
Create a virtual environment and activate it:
python3 -m venv env source env/bin/activate
-
Install the required packages:
pip install -r requirements.txt
-
Create a
.env
file:cp sample_env.txt .env
-
Open the
.env
file and fill in the required values:ANTHROPIC_API_KEY="your_anthropic_api_key" OPENAI_API_KEY="your_openai_api_key" FLASK_APP=app.py FLASK_ENV=development FLASK_DEBUG=1 LOG_LEVEL=INFO MAX_TOKENS=1000 TEMPERATURE=0.7 OUTPUT_DIRECTORY="./outputs" SECRET_KEY="your_secret_key"
-
Run the Flask application:
flask run
Access the application at http://localhost:5000
.
Send a POST request to /generate_diagram
with the following JSON payload:
{
"description": "Your diagram description here",
"diagram_type": "flowchart"
}
Send a POST request to /generate_questionnaire
with the following JSON payload:
{
"topic": "Your questionnaire topic here"
}
GET /
: Welcome messagePOST /generate_diagram
: Generate a diagram based on the provided description and typePOST /generate_questionnaire
: Generate a questionnaire based on the provided topic
Using Diagram Agent to create a flowchart for an AI chatbot system:
flowchart TD
A[User Input] --> B[API Gateway]
B --> C{Planner Agent}
C --> |Create Plan| D[Worker Agent]
D --> E[Tool Orchestrator]
E --> F[Web Search]
E --> G[LLM]
E --> H[Python REPL]
E --> I[Chroma DB Vector Store]
E --> J[Additional Tools]
F & G & H & I & J --> K[Results Aggregator]
K --> L[Final Resolver]
L --> M{QA Agent}
M --> |Approved| N[Output Publisher]
M --> |Not Approved| C
N --> O[User Interface]
subgraph Microservices Architecture
B
C
D
E
K
L
M
N
end
subgraph Data Storage
P[(Persistent Storage)]
I --- P
end
subgraph Security
Q[Authentication]
R[Encryption]
S[Rate Limiting]
end
B --- Q & R & S
Diagram Agent relies on several key libraries and frameworks:
Install required packages by running:
pip install -r requirements.txt
Contributions are welcome! Please submit a Pull Request.
- Anthropic Prompt caching support (massively reduces the token costs)
- More LLM provider support
- Federated inference capabilities
- Ollama support for local inference
- PDF/CSV upload support during the initial interview questionnaire to provide context from existing documents
- C4 diagram generation support
This project is licensed under the MIT License. See the LICENSE file for details.