# Mermaids Unbroken

> Automatic repair of mermaid diagrams

[Mermaid diagrams](https://mermaid.js.org/) are a popular way to create [diagrams](/genaiscript/reference/scripts/diagrams) in markdown. They are used in many projects, [including in GitHub Markdown](https://docs.github.com/en/get-started/writing-on-github/working-with-advanced-formatting/creating-diagrams). Since there are so many examples of mermaid diagrams in the wild,

It is not surprising that LLMs are pretty good at generating them.

## Mermaid diagrams in Markdown

[Section titled “Mermaid diagrams in Markdown”](#mermaid-diagrams-in-markdown)

Mermaid supports a number of diagram types and quite a few options to control the appearance of nodes and edges. You can try out different diagrams in the [Mermaid playground](https://www.mermaidchart.com/play)

Here is a simple example of a flowchart:

````markdown
```mermaid
graph TD
    A[Start] --> B{Is it?}
    B -->|Yes| C[OK]
    B -->|No| D[Not OK]
    C --> E[End]
    D --> E
```
````

This markdown will be rendered as a flowchart in preview mode (and in GitHub!):

![](<data:image/svg+xml,%3csvg aria-roledescription='flowchart-v2' role='graphics-document document' viewBox='0 0 261.59375 439.796875' style='max-width: 261.59375px%3b' class='flowchart' xmlns:xlink='http://www.w3.org/1999/xlink' xmlns='http://www.w3.org/2000/svg' width='100%25' id='mermaid-0'%3e%3cstyle%3e%23mermaid-0%7bfont-family:arial%2csans-serif%3bfont-size:16px%3bfill:%23333%3b%7d%40keyframes edge-animation-frame%7bfrom%7bstroke-dashoffset:0%3b%7d%7d%40keyframes dash%7bto%7bstroke-dashoffset:0%3b%7d%7d%23mermaid-0 .edge-animation-slow%7bstroke-dasharray:9%2c5!important%3bstroke-dashoffset:900%3banimation:dash 50s linear infinite%3bstroke-linecap:round%3b%7d%23mermaid-0 .edge-animation-fast%7bstroke-dasharray:9%2c5!important%3bstroke-dashoffset:900%3banimation:dash 20s linear infinite%3bstroke-linecap:round%3b%7d%23mermaid-0 .error-icon%7bfill:%23552222%3b%7d%23mermaid-0 .error-text%7bfill:%23552222%3bstroke:%23552222%3b%7d%23mermaid-0 .edge-thickness-normal%7bstroke-width:1px%3b%7d%23mermaid-0 .edge-thickness-thick%7bstroke-width:3.5px%3b%7d%23mermaid-0 .edge-pattern-solid%7bstroke-dasharray:0%3b%7d%23mermaid-0 .edge-thickness-invisible%7bstroke-width:0%3bfill:none%3b%7d%23mermaid-0 .edge-pattern-dashed%7bstroke-dasharray:3%3b%7d%23mermaid-0 .edge-pattern-dotted%7bstroke-dasharray:2%3b%7d%23mermaid-0 .marker%7bfill:%23333333%3bstroke:%23333333%3b%7d%23mermaid-0 .marker.cross%7bstroke:%23333333%3b%7d%23mermaid-0 svg%7bfont-family:arial%2csans-serif%3bfont-size:16px%3b%7d%23mermaid-0 p%7bmargin:0%3b%7d%23mermaid-0 .label%7bfont-family:arial%2csans-serif%3bcolor:%23333%3b%7d%23mermaid-0 .cluster-label text%7bfill:%23333%3b%7d%23mermaid-0 .cluster-label span%7bcolor:%23333%3b%7d%23mermaid-0 .cluster-label span p%7bbackground-color:transparent%3b%7d%23mermaid-0 .label text%2c%23mermaid-0 span%7bfill:%23333%3bcolor:%23333%3b%7d%23mermaid-0 .node rect%2c%23mermaid-0 .node circle%2c%23mermaid-0 .node ellipse%2c%23mermaid-0 .node polygon%2c%23mermaid-0 .node path%7bfill:%23ECECFF%3bstroke:%239370DB%3bstroke-width:1px%3b%7d%23mermaid-0 .rough-node .label text%2c%23mermaid-0 .node .label text%2c%23mermaid-0 .image-shape .label%2c%23mermaid-0 .icon-shape .label%7btext-anchor:middle%3b%7d%23mermaid-0 .node .katex path%7bfill:black%3bstroke:black%3bstroke-width:1px%3b%7d%23mermaid-0 .rough-node .label%2c%23mermaid-0 .node .label%2c%23mermaid-0 .image-shape .label%2c%23mermaid-0 .icon-shape .label%7btext-align:center%3b%7d%23mermaid-0 .node.clickable%7bcursor:pointer%3b%7d%23mermaid-0 .root .anchor path%7bfill:%23333333!important%3bstroke-width:0%3bstroke:%23333333%3b%7d%23mermaid-0 .arrowheadPath%7bfill:%23333333%3b%7d%23mermaid-0 .edgePath .path%7bstroke:%23333333%3bstroke-width:2.0px%3b%7d%23mermaid-0 .flowchart-link%7bstroke:%23333333%3bfill:none%3b%7d%23mermaid-0 .edgeLabel%7bbackground-color:rgba(232%2c232%2c232%2c 0.8)%3btext-align:center%3b%7d%23mermaid-0 .edgeLabel p%7bbackground-color:rgba(232%2c232%2c232%2c 0.8)%3b%7d%23mermaid-0 .edgeLabel rect%7bopacity:0.5%3bbackground-color:rgba(232%2c232%2c232%2c 0.8)%3bfill:rgba(232%2c232%2c232%2c 0.8)%3b%7d%23mermaid-0 .labelBkg%7bbackground-color:rgba(232%2c 232%2c 232%2c 0.5)%3b%7d%23mermaid-0 .cluster rect%7bfill:%23ffffde%3bstroke:%23aaaa33%3bstroke-width:1px%3b%7d%23mermaid-0 .cluster text%7bfill:%23333%3b%7d%23mermaid-0 .cluster span%7bcolor:%23333%3b%7d%23mermaid-0 div.mermaidTooltip%7bposition:absolute%3btext-align:center%3bmax-width:200px%3bpadding:2px%3bfont-family:arial%2csans-serif%3bfont-size:12px%3bbackground:hsl(80%2c 100%25%2c 96.2745098039%25)%3bborder:1px solid %23aaaa33%3bborder-radius:2px%3bpointer-events:none%3bz-index:100%3b%7d%23mermaid-0 .flowchartTitleText%7btext-anchor:middle%3bfont-size:18px%3bfill:%23333%3b%7d%23mermaid-0 rect.text%7bfill:none%3bstroke-width:0%3b%7d%23mermaid-0 .icon-shape%2c%23mermaid-0 .image-shape%7bbackground-color:rgba(232%2c232%2c232%2c 0.8)%3btext-align:center%3b%7d%23mermaid-0 .icon-shape p%2c%23mermaid-0 .image-shape p%7bbackground-color:rgba(232%2c232%2c232%2c 0.8)%3bpadding:2px%3b%7d%23mermaid-0 .icon-shape rect%2c%23mermaid-0 .image-shape rect%7bopacity:0.5%3bbackground-color:rgba(232%2c232%2c232%2c 0.8)%3bfill:rgba(232%2c232%2c232%2c 0.8)%3b%7d%23mermaid-0 .label-icon%7bdisplay:inline-block%3bheight:1em%3boverflow:visible%3bvertical-align:-0.125em%3b%7d%23mermaid-0 .node .label-icon path%7bfill:currentColor%3bstroke:revert%3bstroke-width:revert%3b%7d%23mermaid-0 :root%7b--mermaid-font-family:arial%2csans-serif%3b%7d%3c/style%3e%3cg%3e%3cmarker orient='auto' markerHeight='8' markerWidth='8' markerUnits='userSpaceOnUse' refY='5' refX='5' viewBox='0 0 10 10' class='marker flowchart-v2' id='mermaid-0_flowchart-v2-pointEnd'%3e%3cpath style='stroke-width: 1%3b stroke-dasharray: 1%2c 0%3b' class='arrowMarkerPath' d='M 0 0 L 10 5 L 0 10 z'/%3e%3c/marker%3e%3cmarker orient='auto' markerHeight='8' markerWidth='8' markerUnits='userSpaceOnUse' refY='5' refX='4.5' viewBox='0 0 10 10' class='marker flowchart-v2' id='mermaid-0_flowchart-v2-pointStart'%3e%3cpath style='stroke-width: 1%3b stroke-dasharray: 1%2c 0%3b' class='arrowMarkerPath' d='M 0 5 L 10 10 L 10 0 z'/%3e%3c/marker%3e%3cmarker orient='auto' markerHeight='11' markerWidth='11' markerUnits='userSpaceOnUse' refY='5' refX='11' viewBox='0 0 10 10' class='marker flowchart-v2' id='mermaid-0_flowchart-v2-circleEnd'%3e%3ccircle style='stroke-width: 1%3b stroke-dasharray: 1%2c 0%3b' class='arrowMarkerPath' r='5' cy='5' cx='5'/%3e%3c/marker%3e%3cmarker orient='auto' markerHeight='11' markerWidth='11' markerUnits='userSpaceOnUse' refY='5' refX='-1' viewBox='0 0 10 10' class='marker flowchart-v2' id='mermaid-0_flowchart-v2-circleStart'%3e%3ccircle style='stroke-width: 1%3b stroke-dasharray: 1%2c 0%3b' class='arrowMarkerPath' r='5' cy='5' cx='5'/%3e%3c/marker%3e%3cmarker orient='auto' markerHeight='11' markerWidth='11' markerUnits='userSpaceOnUse' refY='5.2' refX='12' viewBox='0 0 11 11' class='marker cross flowchart-v2' id='mermaid-0_flowchart-v2-crossEnd'%3e%3cpath style='stroke-width: 2%3b stroke-dasharray: 1%2c 0%3b' class='arrowMarkerPath' d='M 1%2c1 l 9%2c9 M 10%2c1 l -9%2c9'/%3e%3c/marker%3e%3cmarker orient='auto' markerHeight='11' markerWidth='11' markerUnits='userSpaceOnUse' refY='5.2' refX='-1' viewBox='0 0 11 11' class='marker cross flowchart-v2' id='mermaid-0_flowchart-v2-crossStart'%3e%3cpath style='stroke-width: 2%3b stroke-dasharray: 1%2c 0%3b' class='arrowMarkerPath' d='M 1%2c1 l 9%2c9 M 10%2c1 l -9%2c9'/%3e%3c/marker%3e%3cg class='root'%3e%3cg class='clusters'/%3e%3cg class='edgePaths'%3e%3cpath marker-end='url(%23mermaid-0_flowchart-v2-pointEnd)' style='' class='edge-thickness-normal edge-pattern-solid edge-thickness-normal edge-pattern-solid flowchart-link' id='L_A_B_0' d='M123.461%2c62L123.461%2c66.167C123.461%2c70.333%2c123.461%2c78.667%2c123.531%2c86.417C123.601%2c94.167%2c123.742%2c101.334%2c123.812%2c104.917L123.883%2c108.501'/%3e%3cpath marker-end='url(%23mermaid-0_flowchart-v2-pointEnd)' style='' class='edge-thickness-normal edge-pattern-solid edge-thickness-normal edge-pattern-solid flowchart-link' id='L_B_C_0' d='M103.004%2c179.34L94.097%2c188.916C85.19%2c198.492%2c67.376%2c217.645%2c58.469%2c232.721C49.563%2c247.797%2c49.563%2c258.797%2c49.563%2c264.297L49.563%2c269.797'/%3e%3cpath marker-end='url(%23mermaid-0_flowchart-v2-pointEnd)' style='' class='edge-thickness-normal edge-pattern-solid edge-thickness-normal edge-pattern-solid flowchart-link' id='L_B_D_0' d='M144.918%2c179.34L153.658%2c188.916C162.398%2c198.492%2c179.879%2c217.645%2c188.619%2c232.721C197.359%2c247.797%2c197.359%2c258.797%2c197.359%2c264.297L197.359%2c269.797'/%3e%3cpath marker-end='url(%23mermaid-0_flowchart-v2-pointEnd)' style='' class='edge-thickness-normal edge-pattern-solid edge-thickness-normal edge-pattern-solid flowchart-link' id='L_C_E_0' d='M49.563%2c327.797L49.563%2c331.964C49.563%2c336.13%2c49.563%2c344.464%2c54.939%2c352.413C60.315%2c360.363%2c71.067%2c367.929%2c76.443%2c371.712L81.819%2c375.495'/%3e%3cpath marker-end='url(%23mermaid-0_flowchart-v2-pointEnd)' style='' class='edge-thickness-normal edge-pattern-solid edge-thickness-normal edge-pattern-solid flowchart-link' id='L_D_E_0' d='M197.359%2c327.797L197.359%2c331.964C197.359%2c336.13%2c197.359%2c344.464%2c191.983%2c352.413C186.607%2c360.363%2c175.855%2c367.929%2c170.479%2c371.712L165.103%2c375.495'/%3e%3c/g%3e%3cg class='edgeLabels'%3e%3cg class='edgeLabel'%3e%3cg transform='translate(0%2c 0)' class='label'%3e%3cforeignObject height='0' width='0'%3e%3cdiv style='display: table-cell%3b white-space: nowrap%3b line-height: 1.5%3b max-width: 200px%3b text-align: center%3b' class='labelBkg' xmlns='http://www.w3.org/1999/xhtml'%3e%3cspan class='edgeLabel'%3e%3c/span%3e%3c/div%3e%3c/foreignObject%3e%3c/g%3e%3c/g%3e%3cg transform='translate(49.5625%2c 236.796875)' class='edgeLabel'%3e%3cg transform='translate(-13.0546875%2c -12)' class='label'%3e%3cforeignObject height='24' width='26.109375'%3e%3cdiv style='display: table-cell%3b white-space: nowrap%3b line-height: 1.5%3b max-width: 200px%3b text-align: center%3b' class='labelBkg' xmlns='http://www.w3.org/1999/xhtml'%3e%3cspan class='edgeLabel'%3e%3cp%3eYes%3c/p%3e%3c/span%3e%3c/div%3e%3c/foreignObject%3e%3c/g%3e%3c/g%3e%3cg transform='translate(197.359375%2c 236.796875)' class='edgeLabel'%3e%3cg transform='translate(-10.2265625%2c -12)' class='label'%3e%3cforeignObject height='24' width='20.453125'%3e%3cdiv style='display: table-cell%3b white-space: nowrap%3b line-height: 1.5%3b max-width: 200px%3b text-align: center%3b' class='labelBkg' xmlns='http://www.w3.org/1999/xhtml'%3e%3cspan class='edgeLabel'%3e%3cp%3eNo%3c/p%3e%3c/span%3e%3c/div%3e%3c/foreignObject%3e%3c/g%3e%3c/g%3e%3cg class='edgeLabel'%3e%3cg transform='translate(0%2c 0)' class='label'%3e%3cforeignObject height='0' width='0'%3e%3cdiv style='display: table-cell%3b white-space: nowrap%3b line-height: 1.5%3b max-width: 200px%3b text-align: center%3b' class='labelBkg' xmlns='http://www.w3.org/1999/xhtml'%3e%3cspan class='edgeLabel'%3e%3c/span%3e%3c/div%3e%3c/foreignObject%3e%3c/g%3e%3c/g%3e%3cg class='edgeLabel'%3e%3cg transform='translate(0%2c 0)' class='label'%3e%3cforeignObject height='0' width='0'%3e%3cdiv style='display: table-cell%3b white-space: nowrap%3b line-height: 1.5%3b max-width: 200px%3b text-align: center%3b' class='labelBkg' xmlns='http://www.w3.org/1999/xhtml'%3e%3cspan class='edgeLabel'%3e%3c/span%3e%3c/div%3e%3c/foreignObject%3e%3c/g%3e%3c/g%3e%3c/g%3e%3cg class='nodes'%3e%3cg transform='translate(123.4609375%2c 35)' id='flowchart-A-0' class='node default'%3e%3crect height='54' width='93.796875' y='-27' x='-46.8984375' style='' class='basic label-container'/%3e%3cg transform='translate(-16.8984375%2c -12)' style='' class='label'%3e%3crect/%3e%3cforeignObject height='24' width='33.796875'%3e%3cdiv style='display: table-cell%3b white-space: nowrap%3b line-height: 1.5%3b max-width: 200px%3b text-align: center%3b' xmlns='http://www.w3.org/1999/xhtml'%3e%3cspan class='nodeLabel'%3e%3cp%3eStart%3c/p%3e%3c/span%3e%3c/div%3e%3c/foreignObject%3e%3c/g%3e%3c/g%3e%3cg transform='translate(123.4609375%2c 155.8984375)' id='flowchart-B-1' class='node default'%3e%3cpolygon transform='translate(-43.8984375%2c43.8984375)' class='label-container' points='43.8984375%2c0 87.796875%2c-43.8984375 43.8984375%2c-87.796875 0%2c-43.8984375'/%3e%3cg transform='translate(-16.8984375%2c -12)' style='' class='label'%3e%3crect/%3e%3cforeignObject height='24' width='33.796875'%3e%3cdiv style='display: table-cell%3b white-space: nowrap%3b line-height: 1.5%3b max-width: 200px%3b text-align: center%3b' xmlns='http://www.w3.org/1999/xhtml'%3e%3cspan class='nodeLabel'%3e%3cp%3eIs it%3f%3c/p%3e%3c/span%3e%3c/div%3e%3c/foreignObject%3e%3c/g%3e%3c/g%3e%3cg transform='translate(49.5625%2c 300.796875)' id='flowchart-C-3' class='node default'%3e%3crect height='54' width='83.125' y='-27' x='-41.5625' style='' class='basic label-container'/%3e%3cg transform='translate(-11.5625%2c -12)' style='' class='label'%3e%3crect/%3e%3cforeignObject height='24' width='23.125'%3e%3cdiv style='display: table-cell%3b white-space: nowrap%3b line-height: 1.5%3b max-width: 200px%3b text-align: center%3b' xmlns='http://www.w3.org/1999/xhtml'%3e%3cspan class='nodeLabel'%3e%3cp%3eOK%3c/p%3e%3c/span%3e%3c/div%3e%3c/foreignObject%3e%3c/g%3e%3c/g%3e%3cg transform='translate(197.359375%2c 300.796875)' id='flowchart-D-5' class='node default'%3e%3crect height='54' width='112.46875' y='-27' x='-56.234375' style='' class='basic label-container'/%3e%3cg transform='translate(-26.234375%2c -12)' style='' class='label'%3e%3crect/%3e%3cforeignObject height='24' width='52.46875'%3e%3cdiv style='display: table-cell%3b white-space: nowrap%3b line-height: 1.5%3b max-width: 200px%3b text-align: center%3b' xmlns='http://www.w3.org/1999/xhtml'%3e%3cspan class='nodeLabel'%3e%3cp%3eNot OK%3c/p%3e%3c/span%3e%3c/div%3e%3c/foreignObject%3e%3c/g%3e%3c/g%3e%3cg transform='translate(123.4609375%2c 404.796875)' id='flowchart-E-7' class='node default'%3e%3crect height='54' width='88.46875' y='-27' x='-44.234375' style='' class='basic label-container'/%3e%3cg transform='translate(-14.234375%2c -12)' style='' class='label'%3e%3crect/%3e%3cforeignObject height='24' width='28.46875'%3e%3cdiv style='display: table-cell%3b white-space: nowrap%3b line-height: 1.5%3b max-width: 200px%3b text-align: center%3b' xmlns='http://www.w3.org/1999/xhtml'%3e%3cspan class='nodeLabel'%3e%3cp%3eEnd%3c/p%3e%3c/span%3e%3c/div%3e%3c/foreignObject%3e%3c/g%3e%3c/g%3e%3c/g%3e%3c/g%3e%3c/g%3e%3c/svg%3e>)

## Syntax errors

[Section titled “Syntax errors”](#syntax-errors)

One issue with mermaid is that… syntax matters and LLM sometimes get it wrong. Let’s introduce a syntax error in the example above.

````markdown
```mermaid
graph TD
    A[Start] --> B{Is it?}
    B ->|Yes| C[OK]
    B -->|No| D[Not OK]
    C --> E[End]
    D --> E
```
````

Now mermaid fails to parse and the diagram is not rendered:

```text
Parse error on line 3:
...--> B{Is it?}    B ->|Yes| C[OK]    B
----------------------^
Expecting 'SEMI', 'NEWLINE', 'EOF', 'AMP', 'START_LINK', 'LINK', 'LINK_ID', got 'MINUS'
```

In most cases, the LLM is able to fix the syntax error and generate a valid diagram using the error message.

## Automatic repair

[Section titled “Automatic repair”](#automatic-repair)

We have added a “repairer” in [system.diagrams](/genaiscript/reference/scripts/system#systemdiagrams) system prompt. The repairer looks for `mermaid` code blocks in the output and tries to parse them. If it the diagram has parse errors, the repairer adds a message to the chat to fix those.

![](<data:image/svg+xml,%3csvg aria-roledescription='flowchart-v2' role='graphics-document document' viewBox='0 0 439.4375 406' style='max-width: 439.4375px%3b' class='flowchart' xmlns:xlink='http://www.w3.org/1999/xlink' xmlns='http://www.w3.org/2000/svg' width='100%25' id='mermaid-1'%3e%3cstyle%3e%23mermaid-1%7bfont-family:arial%2csans-serif%3bfont-size:16px%3bfill:%23333%3b%7d%40keyframes edge-animation-frame%7bfrom%7bstroke-dashoffset:0%3b%7d%7d%40keyframes dash%7bto%7bstroke-dashoffset:0%3b%7d%7d%23mermaid-1 .edge-animation-slow%7bstroke-dasharray:9%2c5!important%3bstroke-dashoffset:900%3banimation:dash 50s linear infinite%3bstroke-linecap:round%3b%7d%23mermaid-1 .edge-animation-fast%7bstroke-dasharray:9%2c5!important%3bstroke-dashoffset:900%3banimation:dash 20s linear infinite%3bstroke-linecap:round%3b%7d%23mermaid-1 .error-icon%7bfill:%23552222%3b%7d%23mermaid-1 .error-text%7bfill:%23552222%3bstroke:%23552222%3b%7d%23mermaid-1 .edge-thickness-normal%7bstroke-width:1px%3b%7d%23mermaid-1 .edge-thickness-thick%7bstroke-width:3.5px%3b%7d%23mermaid-1 .edge-pattern-solid%7bstroke-dasharray:0%3b%7d%23mermaid-1 .edge-thickness-invisible%7bstroke-width:0%3bfill:none%3b%7d%23mermaid-1 .edge-pattern-dashed%7bstroke-dasharray:3%3b%7d%23mermaid-1 .edge-pattern-dotted%7bstroke-dasharray:2%3b%7d%23mermaid-1 .marker%7bfill:%23333333%3bstroke:%23333333%3b%7d%23mermaid-1 .marker.cross%7bstroke:%23333333%3b%7d%23mermaid-1 svg%7bfont-family:arial%2csans-serif%3bfont-size:16px%3b%7d%23mermaid-1 p%7bmargin:0%3b%7d%23mermaid-1 .label%7bfont-family:arial%2csans-serif%3bcolor:%23333%3b%7d%23mermaid-1 .cluster-label text%7bfill:%23333%3b%7d%23mermaid-1 .cluster-label span%7bcolor:%23333%3b%7d%23mermaid-1 .cluster-label span p%7bbackground-color:transparent%3b%7d%23mermaid-1 .label text%2c%23mermaid-1 span%7bfill:%23333%3bcolor:%23333%3b%7d%23mermaid-1 .node rect%2c%23mermaid-1 .node circle%2c%23mermaid-1 .node ellipse%2c%23mermaid-1 .node polygon%2c%23mermaid-1 .node path%7bfill:%23ECECFF%3bstroke:%239370DB%3bstroke-width:1px%3b%7d%23mermaid-1 .rough-node .label text%2c%23mermaid-1 .node .label text%2c%23mermaid-1 .image-shape .label%2c%23mermaid-1 .icon-shape .label%7btext-anchor:middle%3b%7d%23mermaid-1 .node .katex path%7bfill:black%3bstroke:black%3bstroke-width:1px%3b%7d%23mermaid-1 .rough-node .label%2c%23mermaid-1 .node .label%2c%23mermaid-1 .image-shape .label%2c%23mermaid-1 .icon-shape .label%7btext-align:center%3b%7d%23mermaid-1 .node.clickable%7bcursor:pointer%3b%7d%23mermaid-1 .root .anchor path%7bfill:%23333333!important%3bstroke-width:0%3bstroke:%23333333%3b%7d%23mermaid-1 .arrowheadPath%7bfill:%23333333%3b%7d%23mermaid-1 .edgePath .path%7bstroke:%23333333%3bstroke-width:2.0px%3b%7d%23mermaid-1 .flowchart-link%7bstroke:%23333333%3bfill:none%3b%7d%23mermaid-1 .edgeLabel%7bbackground-color:rgba(232%2c232%2c232%2c 0.8)%3btext-align:center%3b%7d%23mermaid-1 .edgeLabel p%7bbackground-color:rgba(232%2c232%2c232%2c 0.8)%3b%7d%23mermaid-1 .edgeLabel rect%7bopacity:0.5%3bbackground-color:rgba(232%2c232%2c232%2c 0.8)%3bfill:rgba(232%2c232%2c232%2c 0.8)%3b%7d%23mermaid-1 .labelBkg%7bbackground-color:rgba(232%2c 232%2c 232%2c 0.5)%3b%7d%23mermaid-1 .cluster rect%7bfill:%23ffffde%3bstroke:%23aaaa33%3bstroke-width:1px%3b%7d%23mermaid-1 .cluster text%7bfill:%23333%3b%7d%23mermaid-1 .cluster span%7bcolor:%23333%3b%7d%23mermaid-1 div.mermaidTooltip%7bposition:absolute%3btext-align:center%3bmax-width:200px%3bpadding:2px%3bfont-family:arial%2csans-serif%3bfont-size:12px%3bbackground:hsl(80%2c 100%25%2c 96.2745098039%25)%3bborder:1px solid %23aaaa33%3bborder-radius:2px%3bpointer-events:none%3bz-index:100%3b%7d%23mermaid-1 .flowchartTitleText%7btext-anchor:middle%3bfont-size:18px%3bfill:%23333%3b%7d%23mermaid-1 rect.text%7bfill:none%3bstroke-width:0%3b%7d%23mermaid-1 .icon-shape%2c%23mermaid-1 .image-shape%7bbackground-color:rgba(232%2c232%2c232%2c 0.8)%3btext-align:center%3b%7d%23mermaid-1 .icon-shape p%2c%23mermaid-1 .image-shape p%7bbackground-color:rgba(232%2c232%2c232%2c 0.8)%3bpadding:2px%3b%7d%23mermaid-1 .icon-shape rect%2c%23mermaid-1 .image-shape rect%7bopacity:0.5%3bbackground-color:rgba(232%2c232%2c232%2c 0.8)%3bfill:rgba(232%2c232%2c232%2c 0.8)%3b%7d%23mermaid-1 .label-icon%7bdisplay:inline-block%3bheight:1em%3boverflow:visible%3bvertical-align:-0.125em%3b%7d%23mermaid-1 .node .label-icon path%7bfill:currentColor%3bstroke:revert%3bstroke-width:revert%3b%7d%23mermaid-1 :root%7b--mermaid-font-family:arial%2csans-serif%3b%7d%3c/style%3e%3cg%3e%3cmarker orient='auto' markerHeight='8' markerWidth='8' markerUnits='userSpaceOnUse' refY='5' refX='5' viewBox='0 0 10 10' class='marker flowchart-v2' id='mermaid-1_flowchart-v2-pointEnd'%3e%3cpath style='stroke-width: 1%3b stroke-dasharray: 1%2c 0%3b' class='arrowMarkerPath' d='M 0 0 L 10 5 L 0 10 z'/%3e%3c/marker%3e%3cmarker orient='auto' markerHeight='8' markerWidth='8' markerUnits='userSpaceOnUse' refY='5' refX='4.5' viewBox='0 0 10 10' class='marker flowchart-v2' id='mermaid-1_flowchart-v2-pointStart'%3e%3cpath style='stroke-width: 1%3b stroke-dasharray: 1%2c 0%3b' class='arrowMarkerPath' d='M 0 5 L 10 10 L 10 0 z'/%3e%3c/marker%3e%3cmarker orient='auto' markerHeight='11' markerWidth='11' markerUnits='userSpaceOnUse' refY='5' refX='11' viewBox='0 0 10 10' class='marker flowchart-v2' id='mermaid-1_flowchart-v2-circleEnd'%3e%3ccircle style='stroke-width: 1%3b stroke-dasharray: 1%2c 0%3b' class='arrowMarkerPath' r='5' cy='5' cx='5'/%3e%3c/marker%3e%3cmarker orient='auto' markerHeight='11' markerWidth='11' markerUnits='userSpaceOnUse' refY='5' refX='-1' viewBox='0 0 10 10' class='marker flowchart-v2' id='mermaid-1_flowchart-v2-circleStart'%3e%3ccircle style='stroke-width: 1%3b stroke-dasharray: 1%2c 0%3b' class='arrowMarkerPath' r='5' cy='5' cx='5'/%3e%3c/marker%3e%3cmarker orient='auto' markerHeight='11' markerWidth='11' markerUnits='userSpaceOnUse' refY='5.2' refX='12' viewBox='0 0 11 11' class='marker cross flowchart-v2' id='mermaid-1_flowchart-v2-crossEnd'%3e%3cpath style='stroke-width: 2%3b stroke-dasharray: 1%2c 0%3b' class='arrowMarkerPath' d='M 1%2c1 l 9%2c9 M 10%2c1 l -9%2c9'/%3e%3c/marker%3e%3cmarker orient='auto' markerHeight='11' markerWidth='11' markerUnits='userSpaceOnUse' refY='5.2' refX='-1' viewBox='0 0 11 11' class='marker cross flowchart-v2' id='mermaid-1_flowchart-v2-crossStart'%3e%3cpath style='stroke-width: 2%3b stroke-dasharray: 1%2c 0%3b' class='arrowMarkerPath' d='M 1%2c1 l 9%2c9 M 10%2c1 l -9%2c9'/%3e%3c/marker%3e%3cg class='root'%3e%3cg class='clusters'/%3e%3cg class='edgePaths'%3e%3cpath marker-end='url(%23mermaid-1_flowchart-v2-pointEnd)' style='' class='edge-thickness-normal edge-pattern-solid edge-thickness-normal edge-pattern-solid flowchart-link' id='L_Start_GenDiag_0' d='M213.719%2c62L213.719%2c66.167C213.719%2c70.333%2c213.719%2c78.667%2c213.719%2c86.333C213.719%2c94%2c213.719%2c101%2c213.719%2c104.5L213.719%2c108'/%3e%3cpath marker-end='url(%23mermaid-1_flowchart-v2-pointEnd)' style='' class='edge-thickness-normal edge-pattern-solid edge-thickness-normal edge-pattern-solid flowchart-link' id='L_GenDiag_Check_0' d='M168.156%2c163.496L159.63%2c168.08C151.104%2c172.664%2c134.052%2c181.832%2c125.526%2c189.916C117%2c198%2c117%2c205%2c117%2c208.5L117%2c212'/%3e%3cpath marker-end='url(%23mermaid-1_flowchart-v2-pointEnd)' style='' class='edge-thickness-normal edge-pattern-solid edge-thickness-normal edge-pattern-solid flowchart-link' id='L_Check_Display_0' d='M107.87%2c270L105.785%2c276.167C103.7%2c282.333%2c99.53%2c294.667%2c97.445%2c306.333C95.359%2c318%2c95.359%2c329%2c95.359%2c334.5L95.359%2c340'/%3e%3cpath marker-end='url(%23mermaid-1_flowchart-v2-pointEnd)' style='' class='edge-thickness-normal edge-pattern-solid edge-thickness-normal edge-pattern-solid flowchart-link' id='L_Check_Detect_0' d='M166.933%2c270L178.337%2c276.167C189.742%2c282.333%2c212.551%2c294.667%2c232.718%2c306.632C252.886%2c318.598%2c270.413%2c330.195%2c279.176%2c335.994L287.939%2c341.793'/%3e%3cpath marker-end='url(%23mermaid-1_flowchart-v2-pointEnd)' style='' class='edge-thickness-normal edge-pattern-solid edge-thickness-normal edge-pattern-solid flowchart-link' id='L_Detect_GenDiag_0' d='M338.454%2c344L339.91%2c337.833C341.366%2c331.667%2c344.279%2c319.333%2c345.735%2c302.5C347.191%2c285.667%2c347.191%2c264.333%2c347.191%2c245C347.191%2c225.667%2c347.191%2c208.333%2c333.161%2c194.2C319.13%2c180.068%2c291.069%2c169.135%2c277.039%2c163.669L263.008%2c158.203'/%3e%3c/g%3e%3cg class='edgeLabels'%3e%3cg class='edgeLabel'%3e%3cg transform='translate(0%2c 0)' class='label'%3e%3cforeignObject height='0' width='0'%3e%3cdiv style='display: table-cell%3b white-space: nowrap%3b line-height: 1.5%3b max-width: 200px%3b text-align: center%3b' class='labelBkg' xmlns='http://www.w3.org/1999/xhtml'%3e%3cspan class='edgeLabel'%3e%3c/span%3e%3c/div%3e%3c/foreignObject%3e%3c/g%3e%3c/g%3e%3cg class='edgeLabel'%3e%3cg transform='translate(0%2c 0)' class='label'%3e%3cforeignObject height='0' width='0'%3e%3cdiv style='display: table-cell%3b white-space: nowrap%3b line-height: 1.5%3b max-width: 200px%3b text-align: center%3b' class='labelBkg' xmlns='http://www.w3.org/1999/xhtml'%3e%3cspan class='edgeLabel'%3e%3c/span%3e%3c/div%3e%3c/foreignObject%3e%3c/g%3e%3c/g%3e%3cg transform='translate(95.359375%2c 307)' class='edgeLabel'%3e%3cg transform='translate(-13.0546875%2c -12)' class='label'%3e%3cforeignObject height='24' width='26.109375'%3e%3cdiv style='display: table-cell%3b white-space: nowrap%3b line-height: 1.5%3b max-width: 200px%3b text-align: center%3b' class='labelBkg' xmlns='http://www.w3.org/1999/xhtml'%3e%3cspan class='edgeLabel'%3e%3cp%3eYes%3c/p%3e%3c/span%3e%3c/div%3e%3c/foreignObject%3e%3c/g%3e%3c/g%3e%3cg transform='translate(235.359375%2c 307)' class='edgeLabel'%3e%3cg transform='translate(-10.2265625%2c -12)' class='label'%3e%3cforeignObject height='24' width='20.453125'%3e%3cdiv style='display: table-cell%3b white-space: nowrap%3b line-height: 1.5%3b max-width: 200px%3b text-align: center%3b' class='labelBkg' xmlns='http://www.w3.org/1999/xhtml'%3e%3cspan class='edgeLabel'%3e%3cp%3eNo%3c/p%3e%3c/span%3e%3c/div%3e%3c/foreignObject%3e%3c/g%3e%3c/g%3e%3cg class='edgeLabel'%3e%3cg transform='translate(0%2c 0)' class='label'%3e%3cforeignObject height='0' width='0'%3e%3cdiv style='display: table-cell%3b white-space: nowrap%3b line-height: 1.5%3b max-width: 200px%3b text-align: center%3b' class='labelBkg' xmlns='http://www.w3.org/1999/xhtml'%3e%3cspan class='edgeLabel'%3e%3c/span%3e%3c/div%3e%3c/foreignObject%3e%3c/g%3e%3c/g%3e%3c/g%3e%3cg class='nodes'%3e%3cg transform='translate(213.71875%2c 35)' id='flowchart-Start-0' class='node default'%3e%3crect height='54' width='238.78125' y='-27' x='-119.390625' style='' class='basic label-container'/%3e%3cg transform='translate(-89.390625%2c -12)' style='' class='label'%3e%3crect/%3e%3cforeignObject height='24' width='178.78125'%3e%3cdiv style='display: table-cell%3b white-space: nowrap%3b line-height: 1.5%3b max-width: 200px%3b text-align: center%3b' xmlns='http://www.w3.org/1999/xhtml'%3e%3cspan class='nodeLabel'%3e%3cp%3euser: generate a diagram%3c/p%3e%3c/span%3e%3c/div%3e%3c/foreignObject%3e%3c/g%3e%3c/g%3e%3cg transform='translate(213.71875%2c 139)' id='flowchart-GenDiag-1' class='node default'%3e%3crect height='54' width='91.125' y='-27' x='-45.5625' style='' class='basic label-container'/%3e%3cg transform='translate(-15.5625%2c -12)' style='' class='label'%3e%3crect/%3e%3cforeignObject height='24' width='31.125'%3e%3cdiv style='display: table-cell%3b white-space: nowrap%3b line-height: 1.5%3b max-width: 200px%3b text-align: center%3b' xmlns='http://www.w3.org/1999/xhtml'%3e%3cspan class='nodeLabel'%3e%3cp%3eLLM%3c/p%3e%3c/span%3e%3c/div%3e%3c/foreignObject%3e%3c/g%3e%3c/g%3e%3cg transform='translate(117%2c 243)' id='flowchart-Check-3' class='node default'%3e%3crect height='54' width='189.171875' y='-27' x='-94.5859375' ry='5' rx='5' style='' class='basic label-container'/%3e%3cg transform='translate(-79.5859375%2c -12)' style='' class='label'%3e%3crect/%3e%3cforeignObject height='24' width='159.171875'%3e%3cdiv style='display: table-cell%3b white-space: nowrap%3b line-height: 1.5%3b max-width: 200px%3b text-align: center%3b' xmlns='http://www.w3.org/1999/xhtml'%3e%3cspan class='nodeLabel'%3e%3cp%3emermaid syntax valid%3f%3c/p%3e%3c/span%3e%3c/div%3e%3c/foreignObject%3e%3c/g%3e%3c/g%3e%3cg transform='translate(95.359375%2c 371)' id='flowchart-Display-5' class='node default'%3e%3crect height='54' width='174.71875' y='-27' x='-87.359375' style='' class='basic label-container'/%3e%3cg transform='translate(-57.359375%2c -12)' style='' class='label'%3e%3crect/%3e%3cforeignObject height='24' width='114.71875'%3e%3cdiv style='display: table-cell%3b white-space: nowrap%3b line-height: 1.5%3b max-width: 200px%3b text-align: center%3b' xmlns='http://www.w3.org/1999/xhtml'%3e%3cspan class='nodeLabel'%3e%3cp%3eDisplay diagram%3c/p%3e%3c/span%3e%3c/div%3e%3c/foreignObject%3e%3c/g%3e%3c/g%3e%3cg transform='translate(332.078125%2c 371)' id='flowchart-Detect-7' class='node default'%3e%3crect height='54' width='198.71875' y='-27' x='-99.359375' style='' class='basic label-container'/%3e%3cg transform='translate(-69.359375%2c -12)' style='' class='label'%3e%3crect/%3e%3cforeignObject height='24' width='138.71875'%3e%3cdiv style='display: table-cell%3b white-space: nowrap%3b line-height: 1.5%3b max-width: 200px%3b text-align: center%3b' xmlns='http://www.w3.org/1999/xhtml'%3e%3cspan class='nodeLabel'%3e%3cp%3euser: fix parse error%3c/p%3e%3c/span%3e%3c/div%3e%3c/foreignObject%3e%3c/g%3e%3c/g%3e%3c/g%3e%3c/g%3e%3c/g%3e%3c/svg%3e>)

Here is a trace of a simple script that generates a diagram from any code.

mermaid.genai.mjs

```js
def("CODE", env.files);
$`Generate a class diagram using mermaid of the code symbols in the CODE.`;
```

We run the [cli](/genaiscript/reference/cli) with the `mermaid.genai.mjs` script and the [runpromptcontext.ts file](https://github.com/microsoft/genaiscript/tree/main/packages/core/src/runpromptcontext.ts).

```sh
genaiscript run mermaid packages/core/src/runpromptcontext.ts
```

### First attempt

[Section titled “First attempt”](#first-attempt)

The script generates a prompt with the code and the instructions to generate a diagram.

````text
┌─💬 github:gpt-4.1 ✉ 2 ~↑9.2kt
┌─📙 system
│## Safety: Jailbreak
│... (18 lines)
│Use clear, concise node and relationship labels.
│Implement appropriate styling and colors to enhance readability.
┌─👤 user
│<CODE lang="ts" file="packages/core/src/runpromptcontext.ts">
│import debug from "debug"
│const dbg = debug("genaiscript:prompt:context")
│// cspell: disable
│import {
│    PromptNode,
│... (1202 lines)
│        env,
│    })
│    return ctx
│}
│</CODE>
│Generate a class diagram using mermaid of the code symbols in the CODE.


```mermaid
classDiagram
    %% Main context classes and interfaces
    class ChatTurnGenerationContext {
        <<interface>>
        +node: PromptNode
...
    %% Highlights to show this is a function producing a context with many callable methods.
    class createChatGenerationContext,createChatTurnGenerationContext highlightFunction;
    classDef highlightFunction fill:#f5f,stroke:#333,stroke-width:1.5px;
```
This diagram summarizes the main types, classes, and their relationships from `runpromptcontext.ts`. The context factories (`createChatGenerationContext`, `createChatTurnGenerationContext`) produce context "objects" rich in methods. Some utilities and dependencies are shown for structure clarity.


└─🏁  github:gpt-4.1 ✉ 2 7418ms ⇅ 9.7kt ↑8.8kt ↓892t 2.47¢
````

### Syntax error detected, repairer activated

[Section titled “Syntax error detected, repairer activated”](#syntax-error-detected-repairer-activated)

The mermaid diagrem generated has a syntax error.

```text
Parse error on line 107:
...hatGenerationContext,createChatTurnGener
-----------------------^
Expecting 'NEWLINE', 'EOF', 'SQS', 'STR', 'DOT', 'GENERICTYPE', 'LABEL', 'STRUCT_START', 'STRUCT_STOP', 'STYLE_SEPARATOR', 'ANNOTATION_END', 'ALPHA', 'AGGREGATION', 'EXTENSION', 'COMPOSITION', 'DEPE…
```

The repairer enters the game and responds to the assistant with a message to fix the error. The entire chat conversation is sent back to the LLM , including the error message.

````text
┌─💬 github:gpt-4.1 ✉ 4 ~↑10.5kt
┌─📙 system
│...
┌─👤 user
│...
│Generate a class diagram using mermaid of the code symbols in the CODE.
┌─🤖 assistant
│```mermaid
│...
│```
┌─👤 user
│I found syntax errors in the mermaid diagram. Please repair the parse error:
│Parse error on line 107:
│...hatGenerationContext,createChatTurnGener
│-----------------------^
│Expecting 'NEWLINE', 'EOF', 'SQS', 'STR', 'DOT', 'GENERICTYPE', 'LABEL', 'STRUCT_START', 'STRUCT_STOP', 'STYLE_SEPARATOR', 'ANNOTATION_END', 'ALPHA', 'AGGREGATION', 'EXTENSION', 'COMPOSITION', 'DEPE…
````

### The LLM repairs the diagram

[Section titled “The LLM repairs the diagram”](#the-llm-repairs-the-diagram)

In this case, the LLM is able to repair the diagram and generate a valid mermaid diagram.

````text
```mermaid
classDiagram
    %% Core Context Interfaces and Classes
    class ChatTurnGenerationContext {
        <<interface>>
...
    %% Factory highlighting (removed previous classDef/annotations for compatibility)
```
This diagram removes invalid classDef and annotation syntax and corrects relationship/arrows for Mermaid compatibility.


└─🏁  github:gpt-4.1 ✉ 4 3741ms ⇅ 10.3kt ↑9.9kt ↓457t 2.34¢
````

### The repaired diagram

[Section titled “The repaired diagram”](#the-repaired-diagram)

Finally, the repaired diagram is returned to the user:

![](<data:image/svg+xml,%3csvg aria-roledescription='class' role='graphics-document document' viewBox='0 0 1890.1796875 1141.5706787109375' style='max-width: 1890.1796875px%3b' class='classDiagram' xmlns:xlink='http://www.w3.org/1999/xlink' xmlns='http://www.w3.org/2000/svg' width='100%25' id='mermaid-2'%3e%3cstyle%3e%23mermaid-2%7bfont-family:arial%2csans-serif%3bfont-size:16px%3bfill:%23333%3b%7d%40keyframes edge-animation-frame%7bfrom%7bstroke-dashoffset:0%3b%7d%7d%40keyframes dash%7bto%7bstroke-dashoffset:0%3b%7d%7d%23mermaid-2 .edge-animation-slow%7bstroke-dasharray:9%2c5!important%3bstroke-dashoffset:900%3banimation:dash 50s linear infinite%3bstroke-linecap:round%3b%7d%23mermaid-2 .edge-animation-fast%7bstroke-dasharray:9%2c5!important%3bstroke-dashoffset:900%3banimation:dash 20s linear infinite%3bstroke-linecap:round%3b%7d%23mermaid-2 .error-icon%7bfill:%23552222%3b%7d%23mermaid-2 .error-text%7bfill:%23552222%3bstroke:%23552222%3b%7d%23mermaid-2 .edge-thickness-normal%7bstroke-width:1px%3b%7d%23mermaid-2 .edge-thickness-thick%7bstroke-width:3.5px%3b%7d%23mermaid-2 .edge-pattern-solid%7bstroke-dasharray:0%3b%7d%23mermaid-2 .edge-thickness-invisible%7bstroke-width:0%3bfill:none%3b%7d%23mermaid-2 .edge-pattern-dashed%7bstroke-dasharray:3%3b%7d%23mermaid-2 .edge-pattern-dotted%7bstroke-dasharray:2%3b%7d%23mermaid-2 .marker%7bfill:%23333333%3bstroke:%23333333%3b%7d%23mermaid-2 .marker.cross%7bstroke:%23333333%3b%7d%23mermaid-2 svg%7bfont-family:arial%2csans-serif%3bfont-size:16px%3b%7d%23mermaid-2 p%7bmargin:0%3b%7d%23mermaid-2 g.classGroup text%7bfill:%239370DB%3bstroke:none%3bfont-family:arial%2csans-serif%3bfont-size:10px%3b%7d%23mermaid-2 g.classGroup text .title%7bfont-weight:bolder%3b%7d%23mermaid-2 .nodeLabel%2c%23mermaid-2 .edgeLabel%7bcolor:%23131300%3b%7d%23mermaid-2 .edgeLabel .label rect%7bfill:%23ECECFF%3b%7d%23mermaid-2 .label text%7bfill:%23131300%3b%7d%23mermaid-2 .labelBkg%7bbackground:%23ECECFF%3b%7d%23mermaid-2 .edgeLabel .label span%7bbackground:%23ECECFF%3b%7d%23mermaid-2 .classTitle%7bfont-weight:bolder%3b%7d%23mermaid-2 .node rect%2c%23mermaid-2 .node circle%2c%23mermaid-2 .node ellipse%2c%23mermaid-2 .node polygon%2c%23mermaid-2 .node path%7bfill:%23ECECFF%3bstroke:%239370DB%3bstroke-width:1px%3b%7d%23mermaid-2 .divider%7bstroke:%239370DB%3bstroke-width:1%3b%7d%23mermaid-2 g.clickable%7bcursor:pointer%3b%7d%23mermaid-2 g.classGroup rect%7bfill:%23ECECFF%3bstroke:%239370DB%3b%7d%23mermaid-2 g.classGroup line%7bstroke:%239370DB%3bstroke-width:1%3b%7d%23mermaid-2 .classLabel .box%7bstroke:none%3bstroke-width:0%3bfill:%23ECECFF%3bopacity:0.5%3b%7d%23mermaid-2 .classLabel .label%7bfill:%239370DB%3bfont-size:10px%3b%7d%23mermaid-2 .relation%7bstroke:%23333333%3bstroke-width:1%3bfill:none%3b%7d%23mermaid-2 .dashed-line%7bstroke-dasharray:3%3b%7d%23mermaid-2 .dotted-line%7bstroke-dasharray:1 2%3b%7d%23mermaid-2 %23compositionStart%2c%23mermaid-2 .composition%7bfill:%23333333!important%3bstroke:%23333333!important%3bstroke-width:1%3b%7d%23mermaid-2 %23compositionEnd%2c%23mermaid-2 .composition%7bfill:%23333333!important%3bstroke:%23333333!important%3bstroke-width:1%3b%7d%23mermaid-2 %23dependencyStart%2c%23mermaid-2 .dependency%7bfill:%23333333!important%3bstroke:%23333333!important%3bstroke-width:1%3b%7d%23mermaid-2 %23dependencyStart%2c%23mermaid-2 .dependency%7bfill:%23333333!important%3bstroke:%23333333!important%3bstroke-width:1%3b%7d%23mermaid-2 %23extensionStart%2c%23mermaid-2 .extension%7bfill:transparent!important%3bstroke:%23333333!important%3bstroke-width:1%3b%7d%23mermaid-2 %23extensionEnd%2c%23mermaid-2 .extension%7bfill:transparent!important%3bstroke:%23333333!important%3bstroke-width:1%3b%7d%23mermaid-2 %23aggregationStart%2c%23mermaid-2 .aggregation%7bfill:transparent!important%3bstroke:%23333333!important%3bstroke-width:1%3b%7d%23mermaid-2 %23aggregationEnd%2c%23mermaid-2 .aggregation%7bfill:transparent!important%3bstroke:%23333333!important%3bstroke-width:1%3b%7d%23mermaid-2 %23lollipopStart%2c%23mermaid-2 .lollipop%7bfill:%23ECECFF!important%3bstroke:%23333333!important%3bstroke-width:1%3b%7d%23mermaid-2 %23lollipopEnd%2c%23mermaid-2 .lollipop%7bfill:%23ECECFF!important%3bstroke:%23333333!important%3bstroke-width:1%3b%7d%23mermaid-2 .edgeTerminals%7bfont-size:11px%3bline-height:initial%3b%7d%23mermaid-2 .classTitleText%7btext-anchor:middle%3bfont-size:18px%3bfill:%23333%3b%7d%23mermaid-2 .label-icon%7bdisplay:inline-block%3bheight:1em%3boverflow:visible%3bvertical-align:-0.125em%3b%7d%23mermaid-2 .node .label-icon path%7bfill:currentColor%3bstroke:revert%3bstroke-width:revert%3b%7d%23mermaid-2 :root%7b--mermaid-font-family:arial%2csans-serif%3b%7d%3c/style%3e%3cg%3e%3cdefs%3e%3cmarker orient='auto' markerHeight='240' markerWidth='190' refY='7' refX='18' class='marker aggregation class' id='mermaid-2_class-aggregationStart'%3e%3cpath d='M 18%2c7 L9%2c13 L1%2c7 L9%2c1 Z'/%3e%3c/marker%3e%3c/defs%3e%3cdefs%3e%3cmarker orient='auto' markerHeight='28' markerWidth='20' refY='7' refX='1' class='marker aggregation class' id='mermaid-2_class-aggregationEnd'%3e%3cpath d='M 18%2c7 L9%2c13 L1%2c7 L9%2c1 Z'/%3e%3c/marker%3e%3c/defs%3e%3cdefs%3e%3cmarker orient='auto' markerHeight='240' markerWidth='190' refY='7' refX='18' class='marker extension class' id='mermaid-2_class-extensionStart'%3e%3cpath d='M 1%2c7 L18%2c13 V 1 Z'/%3e%3c/marker%3e%3c/defs%3e%3cdefs%3e%3cmarker orient='auto' markerHeight='28' markerWidth='20' refY='7' refX='1' class='marker extension class' id='mermaid-2_class-extensionEnd'%3e%3cpath d='M 1%2c1 V 13 L18%2c7 Z'/%3e%3c/marker%3e%3c/defs%3e%3cdefs%3e%3cmarker orient='auto' markerHeight='240' markerWidth='190' refY='7' refX='18' class='marker composition class' id='mermaid-2_class-compositionStart'%3e%3cpath d='M 18%2c7 L9%2c13 L1%2c7 L9%2c1 Z'/%3e%3c/marker%3e%3c/defs%3e%3cdefs%3e%3cmarker orient='auto' markerHeight='28' markerWidth='20' refY='7' refX='1' class='marker composition class' id='mermaid-2_class-compositionEnd'%3e%3cpath d='M 18%2c7 L9%2c13 L1%2c7 L9%2c1 Z'/%3e%3c/marker%3e%3c/defs%3e%3cdefs%3e%3cmarker orient='auto' markerHeight='240' markerWidth='190' refY='7' refX='6' class='marker dependency class' id='mermaid-2_class-dependencyStart'%3e%3cpath d='M 5%2c7 L9%2c13 L1%2c7 L9%2c1 Z'/%3e%3c/marker%3e%3c/defs%3e%3cdefs%3e%3cmarker orient='auto' markerHeight='28' markerWidth='20' refY='7' refX='13' class='marker dependency class' id='mermaid-2_class-dependencyEnd'%3e%3cpath d='M 18%2c7 L9%2c13 L14%2c7 L9%2c1 Z'/%3e%3c/marker%3e%3c/defs%3e%3cdefs%3e%3cmarker orient='auto' markerHeight='240' markerWidth='190' refY='7' refX='13' class='marker lollipop class' id='mermaid-2_class-lollipopStart'%3e%3ccircle r='6' cy='7' cx='7' fill='transparent' stroke='black'/%3e%3c/marker%3e%3c/defs%3e%3cdefs%3e%3cmarker orient='auto' markerHeight='240' markerWidth='190' refY='7' refX='1' class='marker lollipop class' id='mermaid-2_class-lollipopEnd'%3e%3ccircle r='6' cy='7' cx='7' fill='transparent' stroke='black'/%3e%3c/marker%3e%3c/defs%3e%3cg class='root'%3e%3cg class='clusters'/%3e%3cg class='edgePaths'%3e%3cpath marker-end='url(%23mermaid-2_class-extensionEnd)' style='' class='edge-thickness-normal edge-pattern-dashed relation' id='id_RunPromptContextNode_ChatGenerationContext_1' d='M190.805%2c346.805L177.302%2c353.837C163.799%2c360.87%2c136.794%2c374.935%2c123.292%2c408.134C109.789%2c441.333%2c109.789%2c493.667%2c109.789%2c519.833L109.789%2c546'/%3e%3cpath marker-end='url(%23mermaid-2_class-dependencyEnd)' style='' class='edge-thickness-normal edge-pattern-solid relation' id='id_RunPromptContextNode_PromptNode_2' d='M282.941%2c352L279.847%2c358.167C276.753%2c364.333%2c270.564%2c376.667%2c267.469%2c421C264.375%2c465.333%2c264.375%2c541.667%2c264.375%2c618C264.375%2c694.333%2c264.375%2c770.667%2c267.667%2c814.15C270.959%2c857.633%2c277.543%2c868.266%2c280.835%2c873.582L284.127%2c878.899'/%3e%3cpath marker-end='url(%23mermaid-2_class-dependencyEnd)' style='' class='edge-thickness-normal edge-pattern-solid relation' id='id_ChatTurnGenerationContext_PromptNode_3' d='M544.537%2c806.608L537.43%2c813.34C530.323%2c820.072%2c516.109%2c833.536%2c498.598%2c845.955C481.086%2c858.374%2c460.278%2c869.748%2c449.874%2c875.435L439.47%2c881.122'/%3e%3cpath marker-end='url(%23mermaid-2_class-dependencyEnd)' style='' class='edge-thickness-normal edge-pattern-solid relation' id='id_ChatTurnGenerationContext_PromptGenerationConsole_4' d='M646.128%2c810L642.996%2c816.167C639.863%2c822.333%2c633.599%2c834.667%2c630.466%2c849C627.334%2c863.333%2c627.334%2c879.667%2c627.334%2c887.833L627.334%2c896'/%3e%3cpath marker-end='url(%23mermaid-2_class-dependencyEnd)' style='' class='edge-thickness-normal edge-pattern-solid relation' id='id_createChatTurnGenerationContext_ChatTurnGenerationContext_5' d='M986.74%2c343L986.74%2c350.667C986.74%2c358.333%2c986.74%2c373.667%2c980.14%2c387.551C973.54%2c401.436%2c960.339%2c413.871%2c953.739%2c420.089L947.139%2c426.307'/%3e%3cpath marker-end='url(%23mermaid-2_class-dependencyEnd)' style='' class='edge-thickness-normal edge-pattern-solid relation' id='id_createChatGenerationContext_RunPromptContextNode_6' d='M1107.602%2c103.938L976.18%2c115.115C844.758%2c126.292%2c581.914%2c148.646%2c450.492%2c164.99C319.07%2c181.333%2c319.07%2c191.667%2c319.07%2c196.833L319.07%2c202'/%3e%3cpath marker-start='url(%23mermaid-2_class-aggregationStart)' style='' class='edge-thickness-normal edge-pattern-solid relation' id='id_RunPromptContextNode_ChatTurnGenerationContext_7' d='M396.283%2c365.348L399.849%2c369.29C403.415%2c373.232%2c410.547%2c381.116%2c435.256%2c399.911C459.965%2c418.706%2c502.251%2c448.412%2c523.394%2c463.265L544.537%2c478.118'/%3e%3cpath marker-end='url(%23mermaid-2_class-dependencyEnd)' style='' class='edge-thickness-normal edge-pattern-solid relation' id='id_RunPromptContextNode_Project_8' d='M447.336%2c330.928L471.712%2c340.607C496.089%2c350.285%2c544.841%2c369.643%2c657.856%2c414.529C770.871%2c459.415%2c948.148%2c529.83%2c1036.787%2c565.037L1125.426%2c600.245'/%3e%3cpath marker-end='url(%23mermaid-2_class-dependencyEnd)' style='' class='edge-thickness-normal edge-pattern-solid relation' id='id_RunPromptContextNode_ExpansionVariables_9' d='M447.336%2c316.43L489.921%2c328.525C532.507%2c340.62%2c617.677%2c364.81%2c752.054%2c409.545C886.431%2c454.281%2c1070.015%2c519.561%2c1161.807%2c552.202L1253.599%2c584.842'/%3e%3cpath marker-start='url(%23mermaid-2_class-aggregationStart)' style='' class='edge-thickness-normal edge-pattern-solid relation' id='PromptNode-cyclic-special-1' d='M302.6%2c1021.322L302.239%2c1022.602C301.877%2c1023.882%2c301.154%2c1026.441%2c300.793%2c1031.887C300.432%2c1037.333%2c300.432%2c1045.667%2c300.432%2c1049.833L300.432%2c1054'/%3e%3cpath style='' class='edge-thickness-normal edge-pattern-solid relation' id='PromptNode-cyclic-special-mid' d='M300.432%2c1054.1L300.432%2c1060.267C300.432%2c1066.433%2c300.432%2c1078.767%2c304.428%2c1091.1C308.423%2c1103.433%2c316.415%2c1115.767%2c320.411%2c1121.933L324.407%2c1128.1'/%3e%3cpath style='' class='edge-thickness-normal edge-pattern-solid relation' id='PromptNode-cyclic-special-2' d='M324.472%2c1128.1L328.468%2c1121.933C332.464%2c1115.767%2c340.455%2c1103.433%2c344.451%2c1091.092C348.447%2c1078.75%2c348.447%2c1066.4%2c348.447%2c1056.05C348.447%2c1045.7%2c348.447%2c1037.35%2c347.27%2c1029.008C346.094%2c1020.667%2c343.74%2c1012.333%2c342.563%2c1008.167L341.386%2c1004'/%3e%3cpath marker-end='url(%23mermaid-2_class-dependencyEnd)' style='' class='edge-thickness-normal edge-pattern-solid relation' id='id_ChatTurnGenerationContext_PromptTemplateString_11' d='M865.318%2c810L869.226%2c816.167C873.133%2c822.333%2c880.948%2c834.667%2c884.856%2c849C888.764%2c863.333%2c888.764%2c879.667%2c888.764%2c887.833L888.764%2c896'/%3e%3cpath marker-end='url(%23mermaid-2_class-dependencyEnd)' style='' class='edge-thickness-normal edge-pattern-solid relation' id='id_createChatGenerationContext_Project_12' d='M1472.177%2c134L1469.954%2c140.167C1467.731%2c146.333%2c1463.284%2c158.667%2c1461.061%2c183C1458.838%2c207.333%2c1458.838%2c243.667%2c1458.838%2c280C1458.838%2c316.333%2c1458.838%2c352.667%2c1418.024%2c403.206C1377.21%2c453.746%2c1295.581%2c518.492%2c1254.767%2c550.865L1213.953%2c583.238'/%3e%3cpath marker-end='url(%23mermaid-2_class-dependencyEnd)' style='' class='edge-thickness-normal edge-pattern-solid relation' id='id_createChatGenerationContext_ExpansionVariables_13' d='M1550.557%2c134L1556.006%2c140.167C1561.455%2c146.333%2c1572.352%2c158.667%2c1577.801%2c183C1583.25%2c207.333%2c1583.25%2c243.667%2c1583.25%2c280C1583.25%2c316.333%2c1583.25%2c352.667%2c1551.794%2c401.304C1520.338%2c449.942%2c1457.426%2c510.884%2c1425.969%2c541.354L1394.513%2c571.825'/%3e%3c/g%3e%3cg class='edgeLabels'%3e%3cg class='edgeLabel'%3e%3cg transform='translate(0%2c -12)' class='label'%3e%3cforeignObject height='24' width='0'%3e%3cdiv class='labelBkg' xmlns='http://www.w3.org/1999/xhtml' style='display: table-cell%3b white-space: nowrap%3b line-height: 1.5%3b max-width: 200px%3b text-align: center%3b'%3e%3cspan class='edgeLabel' style='%3bdisplay: inline-block'%3e%3c/span%3e%3c/div%3e%3c/foreignObject%3e%3c/g%3e%3c/g%3e%3cg transform='translate(264.375%2c 618)' class='edgeLabel'%3e%3cg transform='translate(-17.796875%2c -12)' class='label'%3e%3cforeignObject height='24' width='35.59375'%3e%3cdiv class='labelBkg' xmlns='http://www.w3.org/1999/xhtml' style='display: table-cell%3b white-space: nowrap%3b line-height: 1.5%3b max-width: 200px%3b text-align: center%3b'%3e%3cspan class='edgeLabel' style='%3bdisplay: inline-block'%3e%3cp%3enode%3c/p%3e%3c/span%3e%3c/div%3e%3c/foreignObject%3e%3c/g%3e%3c/g%3e%3cg transform='translate(501.89453125%2c 847)' class='edgeLabel'%3e%3cg transform='translate(-17.796875%2c -12)' class='label'%3e%3cforeignObject height='24' width='35.59375'%3e%3cdiv class='labelBkg' xmlns='http://www.w3.org/1999/xhtml' style='display: table-cell%3b white-space: nowrap%3b line-height: 1.5%3b max-width: 200px%3b text-align: center%3b'%3e%3cspan class='edgeLabel' style='%3bdisplay: inline-block'%3e%3cp%3enode%3c/p%3e%3c/span%3e%3c/div%3e%3c/foreignObject%3e%3c/g%3e%3c/g%3e%3cg transform='translate(627.333984375%2c 847)' class='edgeLabel'%3e%3cg transform='translate(-27.578125%2c -12)' class='label'%3e%3cforeignObject height='24' width='55.15625'%3e%3cdiv class='labelBkg' xmlns='http://www.w3.org/1999/xhtml' style='display: table-cell%3b white-space: nowrap%3b line-height: 1.5%3b max-width: 200px%3b text-align: center%3b'%3e%3cspan class='edgeLabel' style='%3bdisplay: inline-block'%3e%3cp%3econsole%3c/p%3e%3c/span%3e%3c/div%3e%3c/foreignObject%3e%3c/g%3e%3c/g%3e%3cg transform='translate(986.740234375%2c 389)' class='edgeLabel'%3e%3cg transform='translate(-24.8984375%2c -12)' class='label'%3e%3cforeignObject height='24' width='49.796875'%3e%3cdiv class='labelBkg' xmlns='http://www.w3.org/1999/xhtml' style='display: table-cell%3b white-space: nowrap%3b line-height: 1.5%3b max-width: 200px%3b text-align: center%3b'%3e%3cspan class='edgeLabel' style='%3bdisplay: inline-block'%3e%3cp%3ereturns%3c/p%3e%3c/span%3e%3c/div%3e%3c/foreignObject%3e%3c/g%3e%3c/g%3e%3cg transform='translate(319.0703125%2c 171)' class='edgeLabel'%3e%3cg transform='translate(-24.8984375%2c -12)' class='label'%3e%3cforeignObject height='24' width='49.796875'%3e%3cdiv class='labelBkg' xmlns='http://www.w3.org/1999/xhtml' style='display: table-cell%3b white-space: nowrap%3b line-height: 1.5%3b max-width: 200px%3b text-align: center%3b'%3e%3cspan class='edgeLabel' style='%3bdisplay: inline-block'%3e%3cp%3ereturns%3c/p%3e%3c/span%3e%3c/div%3e%3c/foreignObject%3e%3c/g%3e%3c/g%3e%3cg transform='translate(417.6796875%2c 389)' class='edgeLabel'%3e%3cg transform='translate(-34.6953125%2c -12)' class='label'%3e%3cforeignObject height='24' width='69.390625'%3e%3cdiv class='labelBkg' xmlns='http://www.w3.org/1999/xhtml' style='display: table-cell%3b white-space: nowrap%3b line-height: 1.5%3b max-width: 200px%3b text-align: center%3b'%3e%3cspan class='edgeLabel' style='%3bdisplay: inline-block'%3e%3cp%3edelegates%3c/p%3e%3c/span%3e%3c/div%3e%3c/foreignObject%3e%3c/g%3e%3c/g%3e%3cg transform='translate(593.59375%2c 389)' class='edgeLabel'%3e%3cg transform='translate(-8.890625%2c -12)' class='label'%3e%3cforeignObject height='24' width='17.78125'%3e%3cdiv class='labelBkg' xmlns='http://www.w3.org/1999/xhtml' style='display: table-cell%3b white-space: nowrap%3b line-height: 1.5%3b max-width: 200px%3b text-align: center%3b'%3e%3cspan class='edgeLabel' style='%3bdisplay: inline-block'%3e%3cp%3eprj%3c/p%3e%3c/span%3e%3c/div%3e%3c/foreignObject%3e%3c/g%3e%3c/g%3e%3cg transform='translate(702.84765625%2c 389)' class='edgeLabel'%3e%3cg transform='translate(-12.8984375%2c -12)' class='label'%3e%3cforeignObject height='24' width='25.796875'%3e%3cdiv class='labelBkg' xmlns='http://www.w3.org/1999/xhtml' style='display: table-cell%3b white-space: nowrap%3b line-height: 1.5%3b max-width: 200px%3b text-align: center%3b'%3e%3cspan class='edgeLabel' style='%3bdisplay: inline-block'%3e%3cp%3eenv%3c/p%3e%3c/span%3e%3c/div%3e%3c/foreignObject%3e%3c/g%3e%3c/g%3e%3cg class='edgeLabel'%3e%3cg transform='translate(0%2c -12)' class='label'%3e%3cforeignObject height='24' width='0'%3e%3cdiv class='labelBkg' xmlns='http://www.w3.org/1999/xhtml' style='display: table-cell%3b white-space: nowrap%3b line-height: 1.5%3b max-width: 200px%3b text-align: center%3b'%3e%3cspan class='edgeLabel' style='%3bdisplay: inline-block'%3e%3c/span%3e%3c/div%3e%3c/foreignObject%3e%3c/g%3e%3c/g%3e%3cg transform='translate(300.431640625%2c 1091.1000000014901)' class='edgeLabel'%3e%3cg transform='translate(-28.015625%2c -12)' class='label'%3e%3cforeignObject height='24' width='56.03125'%3e%3cdiv class='labelBkg' xmlns='http://www.w3.org/1999/xhtml' style='display: table-cell%3b white-space: nowrap%3b line-height: 1.5%3b max-width: 200px%3b text-align: center%3b'%3e%3cspan class='edgeLabel' style='%3bdisplay: inline-block'%3e%3cp%3echildren%3c/p%3e%3c/span%3e%3c/div%3e%3c/foreignObject%3e%3c/g%3e%3c/g%3e%3cg class='edgeLabel'%3e%3cg transform='translate(0%2c -12)' class='label'%3e%3cforeignObject height='24' width='0'%3e%3cdiv class='labelBkg' xmlns='http://www.w3.org/1999/xhtml' style='display: table-cell%3b white-space: nowrap%3b line-height: 1.5%3b max-width: 200px%3b text-align: center%3b'%3e%3cspan class='edgeLabel' style='%3bdisplay: inline-block'%3e%3c/span%3e%3c/div%3e%3c/foreignObject%3e%3c/g%3e%3c/g%3e%3cg class='edgeLabel'%3e%3cg transform='translate(0%2c -12)' class='label'%3e%3cforeignObject height='24' width='0'%3e%3cdiv class='labelBkg' xmlns='http://www.w3.org/1999/xhtml' style='display: table-cell%3b white-space: nowrap%3b line-height: 1.5%3b max-width: 200px%3b text-align: center%3b'%3e%3cspan class='edgeLabel' style='%3bdisplay: inline-block'%3e%3c/span%3e%3c/div%3e%3c/foreignObject%3e%3c/g%3e%3c/g%3e%3cg class='edgeLabel'%3e%3cg transform='translate(0%2c -12)' class='label'%3e%3cforeignObject height='24' width='0'%3e%3cdiv class='labelBkg' xmlns='http://www.w3.org/1999/xhtml' style='display: table-cell%3b white-space: nowrap%3b line-height: 1.5%3b max-width: 200px%3b text-align: center%3b'%3e%3cspan class='edgeLabel' style='%3bdisplay: inline-block'%3e%3c/span%3e%3c/div%3e%3c/foreignObject%3e%3c/g%3e%3c/g%3e%3cg class='edgeLabel'%3e%3cg transform='translate(0%2c -12)' class='label'%3e%3cforeignObject height='24' width='0'%3e%3cdiv class='labelBkg' xmlns='http://www.w3.org/1999/xhtml' style='display: table-cell%3b white-space: nowrap%3b line-height: 1.5%3b max-width: 200px%3b text-align: center%3b'%3e%3cspan class='edgeLabel' style='%3bdisplay: inline-block'%3e%3c/span%3e%3c/div%3e%3c/foreignObject%3e%3c/g%3e%3c/g%3e%3cg transform='translate(289.2751903706805%2c 1017.962737802446)' class='edgeTerminals'%3e%3cg transform='translate(0%2c 0)' class='inner'%3e%3cforeignObject style='width: 9px%3b height: 12px%3b'%3e%3cdiv xmlns='http://www.w3.org/1999/xhtml' style='display: inline-block%3b padding-right: 1px%3b white-space: nowrap%3b'%3e%3cspan style='%3bdisplay: inline-block' class='edgeLabel'%3e1%3c/span%3e%3c/div%3e%3c/foreignObject%3e%3c/g%3e%3c/g%3e%3cg transform='translate(285.4316403125%2c 1071.599999732888)' class='edgeTerminals'%3e%3cg transform='translate(0%2c 0)' class='inner'%3e%3cforeignObject style='width: 9px%3b height: 12px%3b'%3e%3cdiv xmlns='http://www.w3.org/1999/xhtml' style='display: inline-block%3b padding-right: 1px%3b white-space: nowrap%3b'%3e%3cspan style='%3bdisplay: inline-block' class='edgeLabel'%3e1%3c/span%3e%3c/div%3e%3c/foreignObject%3e%3c/g%3e%3c/g%3e%3cg transform='translate(346.576562957671%2c 1121.5707032699825)' class='edgeTerminals'%3e%3cg transform='translate(0%2c 0)' class='inner'%3e%3cforeignObject style='width: 9px%3b height: 12px%3b'%3e%3cdiv xmlns='http://www.w3.org/1999/xhtml' style='display: inline-block%3b padding-right: 1px%3b white-space: nowrap%3b'%3e%3cspan style='%3bdisplay: inline-block' class='edgeLabel'%3e1%3c/span%3e%3c/div%3e%3c/foreignObject%3e%3c/g%3e%3c/g%3e%3cg transform='translate(311.74468542541894%2c 1032.862203986815)' class='edgeTerminals'%3e%3cg transform='translate(0%2c 0)' class='inner'/%3e%3cforeignObject style='width: 9px%3b height: 12px%3b'%3e%3cdiv xmlns='http://www.w3.org/1999/xhtml' style='display: inline-block%3b padding-right: 1px%3b white-space: nowrap%3b'%3e%3cspan style='%3bdisplay: inline-block' class='edgeLabel'%3e*%3c/span%3e%3c/div%3e%3c/foreignObject%3e%3c/g%3e%3cg transform='translate(322.4788194834791%2c 1100.2567478633919)' class='edgeTerminals'%3e%3cg transform='translate(0%2c 0)' class='inner'/%3e%3cforeignObject style='width: 9px%3b height: 12px%3b'%3e%3cdiv xmlns='http://www.w3.org/1999/xhtml' style='display: inline-block%3b padding-right: 1px%3b white-space: nowrap%3b'%3e%3cspan style='%3bdisplay: inline-block' class='edgeLabel'%3e*%3c/span%3e%3c/div%3e%3c/foreignObject%3e%3c/g%3e%3cg transform='translate(325.22969686926143%2c 1019.0592037495476)' class='edgeTerminals'%3e%3cg transform='translate(0%2c 0)' class='inner'/%3e%3cforeignObject style='width: 9px%3b height: 12px%3b'%3e%3cdiv xmlns='http://www.w3.org/1999/xhtml' style='display: inline-block%3b padding-right: 1px%3b white-space: nowrap%3b'%3e%3cspan style='%3bdisplay: inline-block' class='edgeLabel'%3e*%3c/span%3e%3c/div%3e%3c/foreignObject%3e%3c/g%3e%3c/g%3e%3cg class='nodes'%3e%3cg transform='translate(743.654296875%2c 618)' id='classId-ChatTurnGenerationContext-0' class='node default'%3e%3cg class='basic label-container'%3e%3cpath style='' fill='%23ECECFF' stroke-width='0' stroke='none' d='M-199.1171875 -192 L199.1171875 -192 L199.1171875 192 L-199.1171875 192'/%3e%3cpath style='' fill='none' stroke-width='1.3' stroke='%239370DB' d='M-199.1171875 -192 C-69.01213201149409 -192%2c 61.09292347701182 -192%2c 199.1171875 -192 M-199.1171875 -192 C-44.60237606629039 -192%2c 109.91243536741922 -192%2c 199.1171875 -192 M199.1171875 -192 C199.1171875 -42.25796412294079%2c 199.1171875 107.48407175411842%2c 199.1171875 192 M199.1171875 -192 C199.1171875 -68.2655885279386%2c 199.1171875 55.46882294412279%2c 199.1171875 192 M199.1171875 192 C68.85842891508005 192%2c -61.40032966983989 192%2c -199.1171875 192 M199.1171875 192 C41.11912429874553 192%2c -116.87893890250893 192%2c -199.1171875 192 M-199.1171875 192 C-199.1171875 55.1567593470927%2c -199.1171875 -81.6864813058146%2c -199.1171875 -192 M-199.1171875 192 C-199.1171875 87.08264984780594%2c -199.1171875 -17.83470030438812%2c -199.1171875 -192'/%3e%3c/g%3e%3cg transform='translate(-39.5859375%2c -168)' class='annotation-group text'%3e%3cg transform='translate(0%2c-12)' style='' class='label'%3e%3cforeignObject height='24' width='79.171875'%3e%3cdiv style='display: table-cell%3b white-space: nowrap%3b line-height: 1.5%3b max-width: 129px%3b text-align: center%3b' xmlns='http://www.w3.org/1999/xhtml'%3e%3cspan style='' class='nodeLabel markdown-node-label'%3e%3cp%3e%c2%abinterface%c2%bb%3c/p%3e%3c/span%3e%3c/div%3e%3c/foreignObject%3e%3c/g%3e%3c/g%3e%3cg transform='translate(-106.96875%2c -144)' class='label-group text'%3e%3cg transform='translate(0%2c-12)' style='font-weight: bolder' class='label'%3e%3cforeignObject height='24' width='213.9375'%3e%3cdiv style='display: table-cell%3b white-space: nowrap%3b line-height: 1.5%3b max-width: 251px%3b text-align: center%3b' xmlns='http://www.w3.org/1999/xhtml'%3e%3cspan style='' class='nodeLabel markdown-node-label'%3e%3cp%3eChatTurnGenerationContext%3c/p%3e%3c/span%3e%3c/div%3e%3c/foreignObject%3e%3c/g%3e%3c/g%3e%3cg transform='translate(-187.1171875%2c -96)' class='members-group text'%3e%3cg transform='translate(0%2c-12)' style='' class='label'%3e%3cforeignObject height='24' width='139.203125'%3e%3cdiv style='display: table-cell%3b white-space: nowrap%3b line-height: 1.5%3b max-width: 194px%3b text-align: center%3b' xmlns='http://www.w3.org/1999/xhtml'%3e%3cspan style='' class='nodeLabel markdown-node-label'%3e%3cp%3e%2bPromptNode node%3c/p%3e%3c/span%3e%3c/div%3e%3c/foreignObject%3e%3c/g%3e%3cg transform='translate(0%2c12)' style='' class='label'%3e%3cforeignObject height='24' width='267.265625'%3e%3cdiv style='display: table-cell%3b white-space: nowrap%3b line-height: 1.5%3b max-width: 322px%3b text-align: center%3b' xmlns='http://www.w3.org/1999/xhtml'%3e%3cspan style='' class='nodeLabel markdown-node-label'%3e%3cp%3e%2bconsole : PromptGenerationConsole%3c/p%3e%3c/span%3e%3c/div%3e%3c/foreignObject%3e%3c/g%3e%3c/g%3e%3cg transform='translate(-187.1171875%2c -24)' class='methods-group text'%3e%3cg transform='translate(0%2c-12)' style='' class='label'%3e%3cforeignObject height='24' width='83.125'%3e%3cdiv style='display: table-cell%3b white-space: nowrap%3b line-height: 1.5%3b max-width: 138px%3b text-align: center%3b' xmlns='http://www.w3.org/1999/xhtml'%3e%3cspan style='' class='nodeLabel markdown-node-label'%3e%3cp%3e%2bwriteText()%3c/p%3e%3c/span%3e%3c/div%3e%3c/foreignObject%3e%3c/g%3e%3cg transform='translate(0%2c12)' style='' class='label'%3e%3cforeignObject height='24' width='83.140625'%3e%3cdiv style='display: table-cell%3b white-space: nowrap%3b line-height: 1.5%3b max-width: 138px%3b text-align: center%3b' xmlns='http://www.w3.org/1999/xhtml'%3e%3cspan style='' class='nodeLabel markdown-node-label'%3e%3cp%3e%2bassistant()%3c/p%3e%3c/span%3e%3c/div%3e%3c/foreignObject%3e%3c/g%3e%3cg transform='translate(0%2c36)' style='' class='label'%3e%3cforeignObject height='24' width='28.90625'%3e%3cdiv style='display: table-cell%3b white-space: nowrap%3b line-height: 1.5%3b max-width: 83px%3b text-align: center%3b' xmlns='http://www.w3.org/1999/xhtml'%3e%3cspan style='' class='nodeLabel markdown-node-label'%3e%3cp%3e%2b%24()%3c/p%3e%3c/span%3e%3c/div%3e%3c/foreignObject%3e%3c/g%3e%3cg transform='translate(0%2c60)' style='' class='label'%3e%3cforeignObject height='24' width='42.25'%3e%3cdiv style='display: table-cell%3b white-space: nowrap%3b line-height: 1.5%3b max-width: 97px%3b text-align: center%3b' xmlns='http://www.w3.org/1999/xhtml'%3e%3cspan style='' class='nodeLabel markdown-node-label'%3e%3cp%3e%2bdef()%3c/p%3e%3c/span%3e%3c/div%3e%3c/foreignObject%3e%3c/g%3e%3cg transform='translate(0%2c84)' style='' class='label'%3e%3cforeignObject height='24' width='94.71875'%3e%3cdiv style='display: table-cell%3b white-space: nowrap%3b line-height: 1.5%3b max-width: 149px%3b text-align: center%3b' xmlns='http://www.w3.org/1999/xhtml'%3e%3cspan style='' class='nodeLabel markdown-node-label'%3e%3cp%3e%2bdefImages()%3c/p%3e%3c/span%3e%3c/div%3e%3c/foreignObject%3e%3c/g%3e%3cg transform='translate(0%2c108)' style='' class='label'%3e%3cforeignObject height='24' width='76.046875'%3e%3cdiv style='display: table-cell%3b white-space: nowrap%3b line-height: 1.5%3b max-width: 130px%3b text-align: center%3b' xmlns='http://www.w3.org/1999/xhtml'%3e%3cspan style='' class='nodeLabel markdown-node-label'%3e%3cp%3e%2bdefData()%3c/p%3e%3c/span%3e%3c/div%3e%3c/foreignObject%3e%3c/g%3e%3cg transform='translate(0%2c132)' style='' class='label'%3e%3cforeignObject height='24' width='65.953125'%3e%3cdiv style='display: table-cell%3b white-space: nowrap%3b line-height: 1.5%3b max-width: 120px%3b text-align: center%3b' xmlns='http://www.w3.org/1999/xhtml'%3e%3cspan style='' class='nodeLabel markdown-node-label'%3e%3cp%3e%2bdefDiff()%3c/p%3e%3c/span%3e%3c/div%3e%3c/foreignObject%3e%3c/g%3e%3cg transform='translate(0%2c156)' style='' class='label'%3e%3cforeignObject height='24' width='59.140625'%3e%3cdiv style='display: table-cell%3b white-space: nowrap%3b line-height: 1.5%3b max-width: 114px%3b text-align: center%3b' xmlns='http://www.w3.org/1999/xhtml'%3e%3cspan style='' class='nodeLabel markdown-node-label'%3e%3cp%3e%2bfence()%3c/p%3e%3c/span%3e%3c/div%3e%3c/foreignObject%3e%3c/g%3e%3cg transform='translate(0%2c180)' style='' class='label'%3e%3cforeignObject height='24' width='129.375'%3e%3cdiv style='display: table-cell%3b white-space: nowrap%3b line-height: 1.5%3b max-width: 184px%3b text-align: center%3b' xmlns='http://www.w3.org/1999/xhtml'%3e%3cspan style='' class='nodeLabel markdown-node-label'%3e%3cp%3e%2bimportTemplate()%3c/p%3e%3c/span%3e%3c/div%3e%3c/foreignObject%3e%3c/g%3e%3c/g%3e%3cg style='' class='divider'%3e%3cpath style='' fill='none' stroke-width='1.3' stroke='%239370DB' d='M-199.1171875 -120 C-86.79879465485205 -120%2c 25.51959819029591 -120%2c 199.1171875 -120 M-199.1171875 -120 C-97.18325582752203 -120%2c 4.750675844955936 -120%2c 199.1171875 -120'/%3e%3c/g%3e%3cg style='' class='divider'%3e%3cpath style='' fill='none' stroke-width='1.3' stroke='%239370DB' d='M-199.1171875 -48 C-82.04738580013053 -48%2c 35.022415899738945 -48%2c 199.1171875 -48 M-199.1171875 -48 C-59.53581780464725 -48%2c 80.0455518907055 -48%2c 199.1171875 -48'/%3e%3c/g%3e%3c/g%3e%3cg transform='translate(319.0703125%2c 280)' id='classId-RunPromptContextNode-1' class='node default'%3e%3cg class='basic label-container'%3e%3cpath style='' fill='%23ECECFF' stroke-width='0' stroke='none' d='M-128.265625 -72 L128.265625 -72 L128.265625 72 L-128.265625 72'/%3e%3cpath style='' fill='none' stroke-width='1.3' stroke='%239370DB' d='M-128.265625 -72 C-74.81253649970083 -72%2c -21.359447999401638 -72%2c 128.265625 -72 M-128.265625 -72 C-48.07047793383103 -72%2c 32.12466913233794 -72%2c 128.265625 -72 M128.265625 -72 C128.265625 -21.92820352945776%2c 128.265625 28.143592941084478%2c 128.265625 72 M128.265625 -72 C128.265625 -40.80403468984234%2c 128.265625 -9.608069379684672%2c 128.265625 72 M128.265625 72 C53.18361527440304 72%2c -21.898394451193923 72%2c -128.265625 72 M128.265625 72 C51.406594569023554 72%2c -25.452435861952893 72%2c -128.265625 72 M-128.265625 72 C-128.265625 20.00689968780837%2c -128.265625 -31.986200624383258%2c -128.265625 -72 M-128.265625 72 C-128.265625 34.167284696255535%2c -128.265625 -3.665430607488929%2c -128.265625 -72'/%3e%3c/g%3e%3cg transform='translate(-39.5859375%2c -48)' class='annotation-group text'%3e%3cg transform='translate(0%2c-12)' style='' class='label'%3e%3cforeignObject height='24' width='79.171875'%3e%3cdiv style='display: table-cell%3b white-space: nowrap%3b line-height: 1.5%3b max-width: 129px%3b text-align: center%3b' xmlns='http://www.w3.org/1999/xhtml'%3e%3cspan style='' class='nodeLabel markdown-node-label'%3e%3cp%3e%c2%abinterface%c2%bb%3c/p%3e%3c/span%3e%3c/div%3e%3c/foreignObject%3e%3c/g%3e%3c/g%3e%3cg transform='translate(-93.328125%2c -24)' class='label-group text'%3e%3cg transform='translate(0%2c-12)' style='font-weight: bolder' class='label'%3e%3cforeignObject height='24' width='186.65625'%3e%3cdiv style='display: table-cell%3b white-space: nowrap%3b line-height: 1.5%3b max-width: 224px%3b text-align: center%3b' xmlns='http://www.w3.org/1999/xhtml'%3e%3cspan style='' class='nodeLabel markdown-node-label'%3e%3cp%3eRunPromptContextNode%3c/p%3e%3c/span%3e%3c/div%3e%3c/foreignObject%3e%3c/g%3e%3c/g%3e%3cg transform='translate(-116.265625%2c 24)' class='members-group text'%3e%3cg transform='translate(0%2c-12)' style='' class='label'%3e%3cforeignObject height='24' width='139.203125'%3e%3cdiv style='display: table-cell%3b white-space: nowrap%3b line-height: 1.5%3b max-width: 194px%3b text-align: center%3b' xmlns='http://www.w3.org/1999/xhtml'%3e%3cspan style='' class='nodeLabel markdown-node-label'%3e%3cp%3e%2bPromptNode node%3c/p%3e%3c/span%3e%3c/div%3e%3c/foreignObject%3e%3c/g%3e%3c/g%3e%3cg transform='translate(-116.265625%2c 72)' class='methods-group text'/%3e%3cg style='' class='divider'%3e%3cpath style='' fill='none' stroke-width='1.3' stroke='%239370DB' d='M-128.265625 0 C-47.399483073000255 0%2c 33.46665885399949 0%2c 128.265625 0 M-128.265625 0 C-68.64866738660555 0%2c -9.03170977321112 0%2c 128.265625 0'/%3e%3c/g%3e%3cg style='' class='divider'%3e%3cpath style='' fill='none' stroke-width='1.3' stroke='%239370DB' d='M-128.265625 48 C-73.82760570255755 48%2c -19.389586405115097 48%2c 128.265625 48 M-128.265625 48 C-40.134007567222156 48%2c 47.99760986555569 48%2c 128.265625 48'/%3e%3c/g%3e%3c/g%3e%3cg transform='translate(109.7890625%2c 618)' id='classId-ChatGenerationContext-2' class='node default'%3e%3cg class='basic label-container'%3e%3cpath style='' fill='%23ECECFF' stroke-width='0' stroke='none' d='M-101.7890625 -54 L101.7890625 -54 L101.7890625 54 L-101.7890625 54'/%3e%3cpath style='' fill='none' stroke-width='1.3' stroke='%239370DB' d='M-101.7890625 -54 C-55.582068913132865 -54%2c -9.37507532626573 -54%2c 101.7890625 -54 M-101.7890625 -54 C-53.92031758814705 -54%2c -6.0515726762941 -54%2c 101.7890625 -54 M101.7890625 -54 C101.7890625 -24.624863303208183%2c 101.7890625 4.750273393583633%2c 101.7890625 54 M101.7890625 -54 C101.7890625 -18.253000607479507%2c 101.7890625 17.493998785040986%2c 101.7890625 54 M101.7890625 54 C42.72216090621688 54%2c -16.344740687566244 54%2c -101.7890625 54 M101.7890625 54 C24.325641854743125 54%2c -53.13777879051375 54%2c -101.7890625 54 M-101.7890625 54 C-101.7890625 22.418406428557002%2c -101.7890625 -9.163187142885995%2c -101.7890625 -54 M-101.7890625 54 C-101.7890625 23.856460502579267%2c -101.7890625 -6.287078994841465%2c -101.7890625 -54'/%3e%3c/g%3e%3cg transform='translate(-39.5859375%2c -30)' class='annotation-group text'%3e%3cg transform='translate(0%2c-12)' style='' class='label'%3e%3cforeignObject height='24' width='79.171875'%3e%3cdiv style='display: table-cell%3b white-space: nowrap%3b line-height: 1.5%3b max-width: 129px%3b text-align: center%3b' xmlns='http://www.w3.org/1999/xhtml'%3e%3cspan style='' class='nodeLabel markdown-node-label'%3e%3cp%3e%c2%abinterface%c2%bb%3c/p%3e%3c/span%3e%3c/div%3e%3c/foreignObject%3e%3c/g%3e%3c/g%3e%3cg transform='translate(-89.7890625%2c -6)' class='label-group text'%3e%3cg transform='translate(0%2c-12)' style='font-weight: bolder' class='label'%3e%3cforeignObject height='24' width='179.578125'%3e%3cdiv style='display: table-cell%3b white-space: nowrap%3b line-height: 1.5%3b max-width: 219px%3b text-align: center%3b' xmlns='http://www.w3.org/1999/xhtml'%3e%3cspan style='' class='nodeLabel markdown-node-label'%3e%3cp%3eChatGenerationContext%3c/p%3e%3c/span%3e%3c/div%3e%3c/foreignObject%3e%3c/g%3e%3c/g%3e%3cg transform='translate(-89.7890625%2c 42)' class='members-group text'/%3e%3cg transform='translate(-89.7890625%2c 72)' class='methods-group text'/%3e%3cg style='' class='divider'%3e%3cpath style='' fill='none' stroke-width='1.3' stroke='%239370DB' d='M-101.7890625 18 C-52.47257055071932 18%2c -3.1560786014386366 18%2c 101.7890625 18 M-101.7890625 18 C-41.4036848769614 18%2c 18.9816927460772 18%2c 101.7890625 18'/%3e%3c/g%3e%3cg style='' class='divider'%3e%3cpath style='' fill='none' stroke-width='1.3' stroke='%239370DB' d='M-101.7890625 36 C-37.593503756752256 36%2c 26.60205498649549 36%2c 101.7890625 36 M-101.7890625 36 C-23.450324176339763 36%2c 54.888414147320475 36%2c 101.7890625 36'/%3e%3c/g%3e%3c/g%3e%3cg transform='translate(324.439453125%2c 944)' id='classId-PromptNode-3' class='node default'%3e%3cg class='basic label-container'%3e%3cpath style='' fill='%23ECECFF' stroke-width='0' stroke='none' d='M-124.7109375 -60 L124.7109375 -60 L124.7109375 60 L-124.7109375 60'/%3e%3cpath style='' fill='none' stroke-width='1.3' stroke='%239370DB' d='M-124.7109375 -60 C-47.16730770020111 -60%2c 30.376322099597786 -60%2c 124.7109375 -60 M-124.7109375 -60 C-35.63684930325489 -60%2c 53.43723889349022 -60%2c 124.7109375 -60 M124.7109375 -60 C124.7109375 -25.531528008178398%2c 124.7109375 8.936943983643204%2c 124.7109375 60 M124.7109375 -60 C124.7109375 -17.99100828856043%2c 124.7109375 24.01798342287914%2c 124.7109375 60 M124.7109375 60 C53.574958462166165 60%2c -17.56102057566767 60%2c -124.7109375 60 M124.7109375 60 C56.61879850156592 60%2c -11.473340496868161 60%2c -124.7109375 60 M-124.7109375 60 C-124.7109375 18.570355168626918%2c -124.7109375 -22.859289662746164%2c -124.7109375 -60 M-124.7109375 60 C-124.7109375 30.2366518976359%2c -124.7109375 0.47330379527180355%2c -124.7109375 -60'/%3e%3c/g%3e%3cg transform='translate(0%2c -36)' class='annotation-group text'/%3e%3cg transform='translate(-48%2c -36)' class='label-group text'%3e%3cg transform='translate(0%2c-12)' style='font-weight: bolder' class='label'%3e%3cforeignObject height='24' width='96'%3e%3cdiv style='display: table-cell%3b white-space: nowrap%3b line-height: 1.5%3b max-width: 140px%3b text-align: center%3b' xmlns='http://www.w3.org/1999/xhtml'%3e%3cspan style='' class='nodeLabel markdown-node-label'%3e%3cp%3ePromptNode%3c/p%3e%3c/span%3e%3c/div%3e%3c/foreignObject%3e%3c/g%3e%3c/g%3e%3cg transform='translate(-112.7109375%2c 12)' class='members-group text'%3e%3cg transform='translate(0%2c-12)' style='' class='label'%3e%3cforeignObject height='24' width='177.421875'%3e%3cdiv style='display: table-cell%3b white-space: nowrap%3b line-height: 1.5%3b max-width: 232px%3b text-align: center%3b' xmlns='http://www.w3.org/1999/xhtml'%3e%3cspan style='' class='nodeLabel markdown-node-label'%3e%3cp%3e%2bchildren : PromptNode%5b%5d%3c/p%3e%3c/span%3e%3c/div%3e%3c/foreignObject%3e%3c/g%3e%3c/g%3e%3cg transform='translate(-112.7109375%2c 60)' class='methods-group text'/%3e%3cg style='' class='divider'%3e%3cpath style='' fill='none' stroke-width='1.3' stroke='%239370DB' d='M-124.7109375 -12 C-35.641385183895395 -12%2c 53.42816713220921 -12%2c 124.7109375 -12 M-124.7109375 -12 C-60.037319023025006 -12%2c 4.636299453949988 -12%2c 124.7109375 -12'/%3e%3c/g%3e%3cg style='' class='divider'%3e%3cpath style='' fill='none' stroke-width='1.3' stroke='%239370DB' d='M-124.7109375 36 C-57.5307590421161 36%2c 9.649419415767795 36%2c 124.7109375 36 M-124.7109375 36 C-54.30332302154585 36%2c 16.1042914569083 36%2c 124.7109375 36'/%3e%3c/g%3e%3c/g%3e%3cg transform='translate(986.740234375%2c 280)' id='classId-createChatTurnGenerationContext-4' class='node default'%3e%3cg class='basic label-container'%3e%3cpath style='' fill='%23ECECFF' stroke-width='0' stroke='none' d='M-437.09765625 -63 L437.09765625 -63 L437.09765625 63 L-437.09765625 63'/%3e%3cpath style='' fill='none' stroke-width='1.3' stroke='%239370DB' d='M-437.09765625 -63 C-109.24422411935262 -63%2c 218.60920801129475 -63%2c 437.09765625 -63 M-437.09765625 -63 C-150.0409358699634 -63%2c 137.01578451007322 -63%2c 437.09765625 -63 M437.09765625 -63 C437.09765625 -31.171875900265686%2c 437.09765625 0.656248199468628%2c 437.09765625 63 M437.09765625 -63 C437.09765625 -34.743290093482116%2c 437.09765625 -6.48658018696424%2c 437.09765625 63 M437.09765625 63 C96.6830263162405 63%2c -243.731603617519 63%2c -437.09765625 63 M437.09765625 63 C131.45097728369467 63%2c -174.19570168261066 63%2c -437.09765625 63 M-437.09765625 63 C-437.09765625 13.66244198541451%2c -437.09765625 -35.67511602917098%2c -437.09765625 -63 M-437.09765625 63 C-437.09765625 35.042105853384214%2c -437.09765625 7.0842117067684285%2c -437.09765625 -63'/%3e%3c/g%3e%3cg transform='translate(0%2c -39)' class='annotation-group text'/%3e%3cg transform='translate(-130.5390625%2c -39)' class='label-group text'%3e%3cg transform='translate(0%2c-12)' style='font-weight: bolder' class='label'%3e%3cforeignObject height='24' width='261.078125'%3e%3cdiv style='display: table-cell%3b white-space: nowrap%3b line-height: 1.5%3b max-width: 295px%3b text-align: center%3b' xmlns='http://www.w3.org/1999/xhtml'%3e%3cspan style='' class='nodeLabel markdown-node-label'%3e%3cp%3ecreateChatTurnGenerationContext%3c/p%3e%3c/span%3e%3c/div%3e%3c/foreignObject%3e%3c/g%3e%3c/g%3e%3cg transform='translate(-425.09765625%2c 9)' class='members-group text'/%3e%3cg transform='translate(-425.09765625%2c 39)' class='methods-group text'%3e%3cg transform='translate(0%2c-12)' style='' class='label'%3e%3cforeignObject height='24' width='719.65625'%3e%3cdiv style='display: table-cell%3b white-space: nowrap%3b line-height: 1.5%3b max-width: 775px%3b text-align: center%3b' xmlns='http://www.w3.org/1999/xhtml'%3e%3cspan style='' class='nodeLabel markdown-node-label'%3e%3cp%3e%2bcreateChatTurnGenerationContext(options%2c trace%2c cancellationToken) : : ChatTurnGenerationContext%3c/p%3e%3c/span%3e%3c/div%3e%3c/foreignObject%3e%3c/g%3e%3c/g%3e%3cg style='' class='divider'%3e%3cpath style='' fill='none' stroke-width='1.3' stroke='%239370DB' d='M-437.09765625 -15 C-220.48025428897876 -15%2c -3.862852327957512 -15%2c 437.09765625 -15 M-437.09765625 -15 C-245.06157847813418 -15%2c -53.02550070626836 -15%2c 437.09765625 -15'/%3e%3c/g%3e%3cg style='' class='divider'%3e%3cpath style='' fill='none' stroke-width='1.3' stroke='%239370DB' d='M-437.09765625 9 C-221.13867450690373 9%2c -5.179692763807452 9%2c 437.09765625 9 M-437.09765625 9 C-222.3668817205731 9%2c -7.636107191146209 9%2c 437.09765625 9'/%3e%3c/g%3e%3c/g%3e%3cg transform='translate(1494.890625%2c 71)' id='classId-createChatGenerationContext-5' class='node default'%3e%3cg class='basic label-container'%3e%3cpath style='' fill='%23ECECFF' stroke-width='0' stroke='none' d='M-387.2890625 -63 L387.2890625 -63 L387.2890625 63 L-387.2890625 63'/%3e%3cpath style='' fill='none' stroke-width='1.3' stroke='%239370DB' d='M-387.2890625 -63 C-178.2066426032331 -63%2c 30.875777293533815 -63%2c 387.2890625 -63 M-387.2890625 -63 C-213.71817795470608 -63%2c -40.14729340941216 -63%2c 387.2890625 -63 M387.2890625 -63 C387.2890625 -15.84620121024031%2c 387.2890625 31.30759757951938%2c 387.2890625 63 M387.2890625 -63 C387.2890625 -19.348528454441535%2c 387.2890625 24.30294309111693%2c 387.2890625 63 M387.2890625 63 C131.08995636891166 63%2c -125.10914976217668 63%2c -387.2890625 63 M387.2890625 63 C208.11101248423847 63%2c 28.932962468476944 63%2c -387.2890625 63 M-387.2890625 63 C-387.2890625 22.5101032089306%2c -387.2890625 -17.979793582138797%2c -387.2890625 -63 M-387.2890625 63 C-387.2890625 18.553593217697056%2c -387.2890625 -25.892813564605888%2c -387.2890625 -63'/%3e%3c/g%3e%3cg transform='translate(0%2c -39)' class='annotation-group text'/%3e%3cg transform='translate(-113.359375%2c -39)' class='label-group text'%3e%3cg transform='translate(0%2c-12)' style='font-weight: bolder' class='label'%3e%3cforeignObject height='24' width='226.71875'%3e%3cdiv style='display: table-cell%3b white-space: nowrap%3b line-height: 1.5%3b max-width: 263px%3b text-align: center%3b' xmlns='http://www.w3.org/1999/xhtml'%3e%3cspan style='' class='nodeLabel markdown-node-label'%3e%3cp%3ecreateChatGenerationContext%3c/p%3e%3c/span%3e%3c/div%3e%3c/foreignObject%3e%3c/g%3e%3c/g%3e%3cg transform='translate(-375.2890625%2c 9)' class='members-group text'/%3e%3cg transform='translate(-375.2890625%2c 39)' class='methods-group text'%3e%3cg transform='translate(0%2c-12)' style='' class='label'%3e%3cforeignObject height='24' width='637.21875'%3e%3cdiv style='display: table-cell%3b white-space: nowrap%3b line-height: 1.5%3b max-width: 692px%3b text-align: center%3b' xmlns='http://www.w3.org/1999/xhtml'%3e%3cspan style='' class='nodeLabel markdown-node-label'%3e%3cp%3e%2bcreateChatGenerationContext(options%2c trace%2c projectOptions) : : RunPromptContextNode%3c/p%3e%3c/span%3e%3c/div%3e%3c/foreignObject%3e%3c/g%3e%3c/g%3e%3cg style='' class='divider'%3e%3cpath style='' fill='none' stroke-width='1.3' stroke='%239370DB' d='M-387.2890625 -15 C-160.15293734581928 -15%2c 66.98318780836144 -15%2c 387.2890625 -15 M-387.2890625 -15 C-167.65836572953663 -15%2c 51.97233104092675 -15%2c 387.2890625 -15'/%3e%3c/g%3e%3cg style='' class='divider'%3e%3cpath style='' fill='none' stroke-width='1.3' stroke='%239370DB' d='M-387.2890625 9 C-171.7536864696526 9%2c 43.781689560694815 9%2c 387.2890625 9 M-387.2890625 9 C-224.1817689484386 9%2c -61.074475396877176 9%2c 387.2890625 9'/%3e%3c/g%3e%3c/g%3e%3cg transform='translate(1170.126953125%2c 618)' id='classId-Project-6' class='node default'%3e%3cg class='basic label-container'%3e%3cpath style='' fill='%23ECECFF' stroke-width='0' stroke='none' d='M-39.125 -42 L39.125 -42 L39.125 42 L-39.125 42'/%3e%3cpath style='' fill='none' stroke-width='1.3' stroke='%239370DB' d='M-39.125 -42 C-21.904587227467335 -42%2c -4.68417445493467 -42%2c 39.125 -42 M-39.125 -42 C-16.6046375717006 -42%2c 5.9157248565988 -42%2c 39.125 -42 M39.125 -42 C39.125 -11.23531432507147%2c 39.125 19.52937134985706%2c 39.125 42 M39.125 -42 C39.125 -11.508905253585663%2c 39.125 18.982189492828674%2c 39.125 42 M39.125 42 C8.815566660780789 42%2c -21.493866678438422 42%2c -39.125 42 M39.125 42 C11.487721713623593 42%2c -16.149556572752815 42%2c -39.125 42 M-39.125 42 C-39.125 9.607491393296897%2c -39.125 -22.785017213406206%2c -39.125 -42 M-39.125 42 C-39.125 13.768909285192557%2c -39.125 -14.462181429614887%2c -39.125 -42'/%3e%3c/g%3e%3cg transform='translate(0%2c -18)' class='annotation-group text'/%3e%3cg transform='translate(-27.125%2c -18)' class='label-group text'%3e%3cg transform='translate(0%2c-12)' style='font-weight: bolder' class='label'%3e%3cforeignObject height='24' width='54.25'%3e%3cdiv style='display: table-cell%3b white-space: nowrap%3b line-height: 1.5%3b max-width: 100px%3b text-align: center%3b' xmlns='http://www.w3.org/1999/xhtml'%3e%3cspan style='' class='nodeLabel markdown-node-label'%3e%3cp%3eProject%3c/p%3e%3c/span%3e%3c/div%3e%3c/foreignObject%3e%3c/g%3e%3c/g%3e%3cg transform='translate(-27.125%2c 30)' class='members-group text'/%3e%3cg transform='translate(-27.125%2c 60)' class='methods-group text'/%3e%3cg style='' class='divider'%3e%3cpath style='' fill='none' stroke-width='1.3' stroke='%239370DB' d='M-39.125 6 C-15.670055390623041 6%2c 7.784889218753918 6%2c 39.125 6 M-39.125 6 C-8.483006460401068 6%2c 22.158987079197864 6%2c 39.125 6'/%3e%3c/g%3e%3cg style='' class='divider'%3e%3cpath style='' fill='none' stroke-width='1.3' stroke='%239370DB' d='M-39.125 24 C-20.420539917391114 24%2c -1.716079834782228 24%2c 39.125 24 M-39.125 24 C-13.73092322285433 24%2c 11.663153554291341 24%2c 39.125 24'/%3e%3c/g%3e%3c/g%3e%3cg transform='translate(1346.845703125%2c 618)' id='classId-ExpansionVariables-7' class='node default'%3e%3cg class='basic label-container'%3e%3cpath style='' fill='%23ECECFF' stroke-width='0' stroke='none' d='M-87.59375 -42 L87.59375 -42 L87.59375 42 L-87.59375 42'/%3e%3cpath style='' fill='none' stroke-width='1.3' stroke='%239370DB' d='M-87.59375 -42 C-17.653650460959128 -42%2c 52.286449078081745 -42%2c 87.59375 -42 M-87.59375 -42 C-51.133673480161804 -42%2c -14.673596960323607 -42%2c 87.59375 -42 M87.59375 -42 C87.59375 -13.101197645626598%2c 87.59375 15.797604708746803%2c 87.59375 42 M87.59375 -42 C87.59375 -23.000758122948767%2c 87.59375 -4.001516245897534%2c 87.59375 42 M87.59375 42 C25.586749494577433 42%2c -36.420251010845135 42%2c -87.59375 42 M87.59375 42 C37.4024963863637 42%2c -12.788757227272598 42%2c -87.59375 42 M-87.59375 42 C-87.59375 24.06937754117695%2c -87.59375 6.138755082353903%2c -87.59375 -42 M-87.59375 42 C-87.59375 16.303672656756692%2c -87.59375 -9.392654686486615%2c -87.59375 -42'/%3e%3c/g%3e%3cg transform='translate(0%2c -18)' class='annotation-group text'/%3e%3cg transform='translate(-75.59375%2c -18)' class='label-group text'%3e%3cg transform='translate(0%2c-12)' style='font-weight: bolder' class='label'%3e%3cforeignObject height='24' width='151.1875'%3e%3cdiv style='display: table-cell%3b white-space: nowrap%3b line-height: 1.5%3b max-width: 190px%3b text-align: center%3b' xmlns='http://www.w3.org/1999/xhtml'%3e%3cspan style='' class='nodeLabel markdown-node-label'%3e%3cp%3eExpansionVariables%3c/p%3e%3c/span%3e%3c/div%3e%3c/foreignObject%3e%3c/g%3e%3c/g%3e%3cg transform='translate(-75.59375%2c 30)' class='members-group text'/%3e%3cg transform='translate(-75.59375%2c 60)' class='methods-group text'/%3e%3cg style='' class='divider'%3e%3cpath style='' fill='none' stroke-width='1.3' stroke='%239370DB' d='M-87.59375 6 C-24.871320742359245 6%2c 37.85110851528151 6%2c 87.59375 6 M-87.59375 6 C-32.36302407517563 6%2c 22.86770184964874 6%2c 87.59375 6'/%3e%3c/g%3e%3cg style='' class='divider'%3e%3cpath style='' fill='none' stroke-width='1.3' stroke='%239370DB' d='M-87.59375 24 C-27.768117989108504 24%2c 32.05751402178299 24%2c 87.59375 24 M-87.59375 24 C-35.509471250575714 24%2c 16.57480749884857 24%2c 87.59375 24'/%3e%3c/g%3e%3c/g%3e%3cg transform='translate(627.333984375%2c 944)' id='classId-PromptGenerationConsole-8' class='node default'%3e%3cg class='basic label-container'%3e%3cpath style='' fill='%23ECECFF' stroke-width='0' stroke='none' d='M-113.7890625 -42 L113.7890625 -42 L113.7890625 42 L-113.7890625 42'/%3e%3cpath style='' fill='none' stroke-width='1.3' stroke='%239370DB' d='M-113.7890625 -42 C-36.00266123152801 -42%2c 41.78374003694398 -42%2c 113.7890625 -42 M-113.7890625 -42 C-59.86574603872174 -42%2c -5.942429577443477 -42%2c 113.7890625 -42 M113.7890625 -42 C113.7890625 -15.349786549701541%2c 113.7890625 11.300426900596918%2c 113.7890625 42 M113.7890625 -42 C113.7890625 -20.64183036457177%2c 113.7890625 0.7163392708564587%2c 113.7890625 42 M113.7890625 42 C28.816285670009407 42%2c -56.15649115998119 42%2c -113.7890625 42 M113.7890625 42 C58.688558718428 42%2c 3.588054936855997 42%2c -113.7890625 42 M-113.7890625 42 C-113.7890625 12.246680514947588%2c -113.7890625 -17.506638970104824%2c -113.7890625 -42 M-113.7890625 42 C-113.7890625 23.16834623266142%2c -113.7890625 4.336692465322841%2c -113.7890625 -42'/%3e%3c/g%3e%3cg transform='translate(0%2c -18)' class='annotation-group text'/%3e%3cg transform='translate(-101.7890625%2c -18)' class='label-group text'%3e%3cg transform='translate(0%2c-12)' style='font-weight: bolder' class='label'%3e%3cforeignObject height='24' width='203.578125'%3e%3cdiv style='display: table-cell%3b white-space: nowrap%3b line-height: 1.5%3b max-width: 240px%3b text-align: center%3b' xmlns='http://www.w3.org/1999/xhtml'%3e%3cspan style='' class='nodeLabel markdown-node-label'%3e%3cp%3ePromptGenerationConsole%3c/p%3e%3c/span%3e%3c/div%3e%3c/foreignObject%3e%3c/g%3e%3c/g%3e%3cg transform='translate(-101.7890625%2c 30)' class='members-group text'/%3e%3cg transform='translate(-101.7890625%2c 60)' class='methods-group text'/%3e%3cg style='' class='divider'%3e%3cpath style='' fill='none' stroke-width='1.3' stroke='%239370DB' d='M-113.7890625 6 C-25.998910786684817 6%2c 61.791240926630365 6%2c 113.7890625 6 M-113.7890625 6 C-25.204555050131944 6%2c 63.37995239973611 6%2c 113.7890625 6'/%3e%3c/g%3e%3cg style='' class='divider'%3e%3cpath style='' fill='none' stroke-width='1.3' stroke='%239370DB' d='M-113.7890625 24 C-22.88367825446973 24%2c 68.02170599106054 24%2c 113.7890625 24 M-113.7890625 24 C-66.95576661692866 24%2c -20.122470733857313 24%2c 113.7890625 24'/%3e%3c/g%3e%3c/g%3e%3cg transform='translate(888.763671875%2c 944)' id='classId-PromptTemplateString-9' class='node default'%3e%3cg class='basic label-container'%3e%3cpath style='' fill='%23ECECFF' stroke-width='0' stroke='none' d='M-97.640625 -42 L97.640625 -42 L97.640625 42 L-97.640625 42'/%3e%3cpath style='' fill='none' stroke-width='1.3' stroke='%239370DB' d='M-97.640625 -42 C-55.504741913418094 -42%2c -13.368858826836188 -42%2c 97.640625 -42 M-97.640625 -42 C-23.87128214614181 -42%2c 49.89806070771638 -42%2c 97.640625 -42 M97.640625 -42 C97.640625 -15.353062391636154%2c 97.640625 11.293875216727692%2c 97.640625 42 M97.640625 -42 C97.640625 -21.185462224338835%2c 97.640625 -0.3709244486776697%2c 97.640625 42 M97.640625 42 C52.61371849600995 42%2c 7.5868119920199035 42%2c -97.640625 42 M97.640625 42 C56.64325999026417 42%2c 15.64589498052834 42%2c -97.640625 42 M-97.640625 42 C-97.640625 9.879766027441597%2c -97.640625 -22.240467945116805%2c -97.640625 -42 M-97.640625 42 C-97.640625 16.885335425404783%2c -97.640625 -8.229329149190434%2c -97.640625 -42'/%3e%3c/g%3e%3cg transform='translate(0%2c -18)' class='annotation-group text'/%3e%3cg transform='translate(-85.640625%2c -18)' class='label-group text'%3e%3cg transform='translate(0%2c-12)' style='font-weight: bolder' class='label'%3e%3cforeignObject height='24' width='171.28125'%3e%3cdiv style='display: table-cell%3b white-space: nowrap%3b line-height: 1.5%3b max-width: 208px%3b text-align: center%3b' xmlns='http://www.w3.org/1999/xhtml'%3e%3cspan style='' class='nodeLabel markdown-node-label'%3e%3cp%3ePromptTemplateString%3c/p%3e%3c/span%3e%3c/div%3e%3c/foreignObject%3e%3c/g%3e%3c/g%3e%3cg transform='translate(-85.640625%2c 30)' class='members-group text'/%3e%3cg transform='translate(-85.640625%2c 60)' class='methods-group text'/%3e%3cg style='' class='divider'%3e%3cpath style='' fill='none' stroke-width='1.3' stroke='%239370DB' d='M-97.640625 6 C-47.434715622866605 6%2c 2.7711937542667897 6%2c 97.640625 6 M-97.640625 6 C-38.17789135515505 6%2c 21.284842289689905 6%2c 97.640625 6'/%3e%3c/g%3e%3cg style='' class='divider'%3e%3cpath style='' fill='none' stroke-width='1.3' stroke='%239370DB' d='M-97.640625 24 C-26.4902039504789 24%2c 44.6602170990422 24%2c 97.640625 24 M-97.640625 24 C-32.524308458142556 24%2c 32.59200808371489 24%2c 97.640625 24'/%3e%3c/g%3e%3c/g%3e%3cg transform='translate(300.431640625%2c 1054.050000000745)' id='PromptNode---PromptNode---1' class='label edgeLabel'%3e%3crect height='0.1' width='0.1'/%3e%3cg transform='translate(0%2c 0)' style='' class='label'%3e%3crect/%3e%3cforeignObject height='0' width='0'%3e%3cdiv style='display: table-cell%3b white-space: nowrap%3b line-height: 1.5%3b max-width: 10px%3b text-align: center%3b' xmlns='http://www.w3.org/1999/xhtml'%3e%3cspan class='nodeLabel'%3e%3c/span%3e%3c/div%3e%3c/foreignObject%3e%3c/g%3e%3c/g%3e%3cg transform='translate(324.439453125%2c 1128.1500000022352)' id='PromptNode---PromptNode---2' class='label edgeLabel'%3e%3crect height='0.1' width='0.1'/%3e%3cg transform='translate(0%2c 0)' style='' class='label'%3e%3crect/%3e%3cforeignObject height='0' width='0'%3e%3cdiv style='display: table-cell%3b white-space: nowrap%3b line-height: 1.5%3b max-width: 10px%3b text-align: center%3b' xmlns='http://www.w3.org/1999/xhtml'%3e%3cspan class='nodeLabel'%3e%3c/span%3e%3c/div%3e%3c/foreignObject%3e%3c/g%3e%3c/g%3e%3c/g%3e%3c/g%3e%3c/g%3e%3c/svg%3e>)

## Can I parse mermaid diagrams myselft?

[Section titled “Can I parse mermaid diagrams myselft?”](#can-i-parse-mermaid-diagrams-myselft)

Yes, you can use `parsers.mermaid` to parse mermaid diagrams in your scripts programmatically.