AI Image


API Documentation

Diagrams is an innovative tool that transforms complex ideas and processes into easily digestible visualizations. It utilizes the power of and the networkx and matplotlib libraries to convert user prompts into a variety of diagram types - including state diagrams, UML diagrams, and graphs. Whether you're curious about how a jet engine works or want to understand the process of creating a REST API on AWS, Diagrams can create a unique, insightful visualization to aid your understanding. It supports a wide range of syntaxes such as Mermaid, GraphViz, PlantUML, and more, and even uses Cypher to create network graph diagrams. Additionally, Diagrams is equipped with an intelligent plugin API that can interpret follow-up questions or requests for modifications, making it a versatile tool for anyone seeking to learn or explain through visual means.




Example Prompts


Create a block diagram from this text: blockdiag { A -> B -> C -> D }


Generate a sequence diagram using this source: seqdiag { A -> B; B -> C; C -> A; }


I want an activity diagram from this text: actdiag { A -> B -> C -> D }


Make a network diagram using this input: nwdiag { network A { router


Create a packet diagram with this source code: packetdiag { colo=header;


Generate a rack diagram from this text: rackdiag {


Create a C


Generate a diagram using Ditaa with this input: +------+ | Hello | +------+ | World | +------+


Create an ERD diagram from this source: [Person] { *name; *email; }


Generate a Graphviz diagram using this code: digraph G { A -> B; B -> C; C -> A; }


Make a Mermaid diagram with this input: graph LR; A --> B; B --> C; C --> A;


Create a Nomnoml diagram from this source: [Person] -> [Address]


Generate a PlantUML diagram using this code: @startuml; Alice -> Bob: Authentication Request; Bob --> Alice: Authentication Response; @enduml


Create an SVG diagram with this input: svgbob { A->B->C->D }


Generate an Umlet diagram using this source: <state>State


Make a Vega diagram using this JSON: { "data": { "values": [ {"x":


Create a Vega-Lite diagram from this JSON: { "data": { "values": [ {"x":


Generate a Wavedrom diagram using this source: { "signal": [ { "name": "clk", "wave": "p......" }, { "name": "data", "wave": "x.


Create a network graph using this input: A-B; B-C; C-A;

Description for AI

You should use this plugin when users request visualizations or ask follow-up questions about a diagram or any modifications thereof.
Examples of user prompts to use this plugin include:
"Explain how a computer works using a visual diagram."
"Describe the process of create a REST API on AWS."
"How does a jet engine work?"
"Show me how ... works."
"Show me a network diagram of ... ."

This plugin is also useful when a you receive a question about how something works, requires an explanation about an idea or process, summarization, or asks for a description of a process. Any prompt that can be effectively summarized or explained in the format of a state diagram, UML diagram, graph or other types of diagrams can be visualized using this plugin. We will talk more about the types of diagrams which are supported in a bit.

To create a request to the plugin API, create the diagram based on what the user asked and pass it to the plugin API to render. Kroki supports a wide range of syntaxes including Mermaid, GraphViz, PlantUML, and many more. Neo4J uses Cypher to create network graph diagrams.

When creating diagrams:

Prefer hierarchical layouts for diagrams, and avoid linear diagrams.
If there are multiple options, choose the best one and let the user know about the other options available.
Here is a list of symbols which should not be used, for what purpose and what to use instead, delimited by commas:

  • ampersand &, label, "and"
  • round brackets (), node identifiers node labels edge labels, comma ,
  • empty text "", edges, use a label if it is not the same as the target node

Each type of diagram has a different syntax. If you do not know the syntax, do not use that type.

Things to always do:

Use short node identifiers, for example, P for Patient or AI for Artificial Intelligence.
Use double-quotes for all labels, nodes and edges.

Things to never do:
Referring to a subgraph root node from within a subgraph itself is a syntax error and will fail so don't do it ever.
This is wrong:

digraph G {
subgraph cluster_A {
T [label="Y"];
A -> A0;

subgraph cluster_A0 {

The correct way to do it:
digraph G {
subgraph cluster_A {
T [label="Y"];

A -> A0;

subgraph cluster_A0 {

Examples of invoking the plugin API:

User asks: "Show me how to design an N-tier architecture."
Your call to the api:

"diagram_type": "graphviz",
"diagram_source": "digraph G {\n rankdir=TB;\n node [shape=box];\n subgraph cluster_0 {\n label="Presentation Layer";\n color=blue;\n P [label="Web Server (e.g., Apache, Nginx)"];\n }\n subgraph cluster_1 {\n label="Application Layer";\n color=green;\n A [label="Application Server (e.g.,{

User asks: "Draw me a mindmap for a luxury cosmetics rollout of a new product. Use a maximum of 6 nodes."
Your call to the api:

  "diagram_type": "mermaid",  
  "diagram_source": "graph TB\n  NP[\"New Product Rollout\"]\n  NP --> R[\"Research\"]\n  NP --> PD[\"Product Development\"]\n  NP --> M[\"Marketing\"]\n  NP --> D[\"Distribution\"]\n  NP --> S[\"Sales\"]"  
User asks: "Show me how a product reviewer can interact with using plantuml."  
**Your call to the api:**  

"diagram_type": "plantuml",
"diagram_source": "@startuml\n left to right direction\n actor "Product Reviewer" as pr\n rectangle Amazon {\n usecase "Browse Products" as UC1\n usecase "Purchase Product" as UC2\n usecase "Write Review" as UC3\n usecase "Rate Product" as UC4\n }\n pr --> UC1\n pr --> UC2\n pr --> UC3\n pr --> UC4\n @enduml"

User asks: "Show me a network graph with the relationships between the members of the karate club."
Your call to the api:

  "diagram_type": "network",  
  "diagram_source": "{\"directed\": false, \"multigraph\": false, \"graph\": {}, \"nodes\": [{\"id\": \"Member 1\"}, {\"id\": \"Member 2\"}, {\"id\": \"Member 3\"}, {\"id\": \"Member 4\"}, {\"id\": \"Member 5\"}, {\"id\": \"Member 6\"}, {\"id\": \"Member 7\"}, {\"id\": \"Member 8\"}, {\"id\": \"Member 9\"}, {\"id\": \"Member 10\"}], \"links\": [{\"source\": \"Member 1\", \"target\": \"Member 2\"}, {\"source\": \"Member 1\", \"target\": \"Member 3\"}, {\"source\": \"Member 1\", \"target\": \"Member 8\"}, {\"source\": \"Member 2\", \"target\": \"Member 4\"}, {\"source\": \"Member 2\", \"target\": \"Member 5\"}, {\"source\": \"Member 2\", \"target\": \"Member 9\"}, {\"source\": \"Member 3\", \"target\": \"Member 6\"}, {\"source\": \"Member 3\", \"target\": \"Member 10\"}, {\"source\": \"Member 4\", \"target\": \"Member 7\"}, {\"source\": \"Member 5\", \"target\": \"Member 8\"}, {\"source\": \"Member 6\", \"target\": \"Member 9\"}, {\"source\": \"Member 7\", \"target\": \"Member 10\"}]}"  
When the user requests revisions to the diagram, for example, they ask to draw the crossover node in green then call the api with the same `diagram_type` parameter and the modified `diagram_source` text.  
**Interpreting the API response:**  
When you get the response, it will either include an image URL or an image. Render either of these inline using the alt text syntax.  
You should create the response in this order: first the image, then suggestion to edit using words, then the edit link, then the textual explanation.  
**Important Tips:**  
Do not repeat the same link.  
If an errorMessage is included in the response, show it to the user, don't try to render the diagram inline, still suggest they can edit it online or try again.  
Add textual explanation of the diagram contents in the end of the message. Keep it brief unless the user asks for more details.  
Do not use alias names in the textual explanation such as "Food_Critic" or "fc", just use the displayed name like "Food Critic".  
Don't show the diagram block unless the user asks for it.  

Similar Plugins and Alternatives