What is this?

A response to the Community post: "Combining AIAssistant and new MermaidInk ResourceFunctions":
Using OpenAIMode is better!

Setup

In[]:=
Needs["AntonAntonov`OpenAIMode`"]
In[]:=
OpenAIMode["TokenLimit"->300,ImageSize->Small]

Definition

Code for automatic Mermaid diagrams making:
In[]:=
Clear[CellPrintToMermaidInk];​​CellPrintToMermaidInk[s_String]:=​​Block[{},​​NotebookWrite[EvaluationNotebook[],Cell["ResourceFunction[\"MermaidInk\"][\""<>StringReplace[StringTrim[s],{"```mermaid"->"","```"->""}]<>"\"]","Input"],All];​​SelectionEvaluateCreateCell[EvaluationNotebook[]]​​];

Competition

In[]:=
SetOptions[OpenAIInputExecuteToText,Epilog->CellPrintToMermaidInk];
In[]:=
Create mermaid-js code for a graph describing the competition dynamics of Google, Microsoft, Amazon, and Apple
In[]:=
ResourceFunction["MermaidInk"]["
graph TD;
Google-->Microsoft;
Google-->Amazon;
Google-->Apple;
Microsoft-->Amazon;
Microsoft-->Apple;
Amazon-->Apple;
"]
Out[]=

Animal taxonomy

In[]:=
Create mermaid-js code for a graph describing the taxonomy hierarchy of fish, turtles, squirrels and mammals.
In[]:=
ResourceFunction["MermaidInk"]["
graph TD
A(Fish) -- Subcategory --> B(Saltwater Fish)
A -- Subcategory --> C(Freshwater Fish)
B -- Subcategory --> D(Sharks)
D -- Subcategory --> E(Great White Sharks)
C -- Subcategory --> F(Catfish)
A -- Subcategory --> G(Turtles)
G -- Subcategory --> H(Sea Turtles)
H -- Subcategory --> I(Leatherback Sea Turtles)
I -- Subcategory --> J(Green Sea Turtles)
A -- Subcategory --> K(Squirrels)
K -- Subcategory --> L(Ground Squirrels)
K -- Subcategory --> M(Tree Squirrels)
M -- Subcategory --> N(Red Squirrels)
A -- Subcategory --> O(Mammals)
O -- Subcategory --> P(Carnivores)
P -- Subcategory --> Q(Bears)
Q -- Subcategory --> R(Grizzly Bears)
O -- Subcategory --> S(Monotremes)
S -- Subcategory --> T(Platypuses)
"]
Out[]=
In[]:=
ResourceFunction["MermaidInk"]["graph TD;
Fish -->|Are| Vertebrates;
Vertebrates -->|Are| Animals;
Turtles -->|Are| Vertebrates;
Squirrels -->|Are| Rodents;
Rodents -->|Are| Mammals;
Mammals -->|Are| Animals;"]
Out[]=

Programming languages

In[]:=
Make a mermaid-js diagram for programming language families.
In[]:=
ResourceFunction["MermaidInk"]["
graph LR;
Object-Oriented-- JavaScript -->Prototype-based
Functional--Javascript-->Prototype-Based
Prototype-Based--Livescript-->JavaScript
Procedural--C-->Compiled
Compiled--C++-->Object-Oriented
Functional--ML-->Compiled
Object-Oriented--Ruby-->Interpreted
Interpreted--Python-->Object-Oriented
Scripting--Bash-->Interpreted
Scripting--Perl-->Interpreted
Logic--Prolog-->Compiled
"]
Out[]=