Automatised code generation from diagrams using Large Language Models:
- The basis for the code is a combination of diagrams with nodes described with natural language snippets and test data
- Automatised code generation is realised in interaction with large language models
In a nutshell:
-
Diagram structure is being parsed.
-
A conversation with the language model is used to generate the necessary code snippets.
-
Data snippets are used to stabilise the code, by looping over the errors and asking the language model to improve.
We choose as simple task the transformation of any latine characters into their next character in the alphabet. Other characters are just simply filtered out.
examples:
abc -> bcd
z -> a
nmkza rfa -> omlab sgb
The task above has been implemented in lucidchart into the following subdiagrams:
ls resources/FullDemo.p* resources/FullDemo.pdf resources/FullDemo.jpg
Notice that Transliteration is the entry point.
-
Parse the diagram and create a computerised version:
julia build.jl --path-lucidchart-csv resources/FullDemoWithTest.csv --brain-entry transliteration --path-model resources/FullDemoWithTest.dat
-
run or and generate code (if files not available in
/snippets
):julia run.jl --path-model resources/FullDemoWithTest.dat --text "abcdz hgq"
Test Data is used to finetune the generated code and make sure it works as expected.
See Test Data in:
resources/FUllDemoWithTestData.csv
.