I run a small indie consulting firm that specializes in building LLM-based solutions. Recently, I worked on an LLM solution where we had to generate JSON-based workflow configurations for a low code product. Think of it like AWS Step Functions where you write your business workflow in a JSON configuration file. In this post, I will share lessons learned while building this solution.
Below is an example workflow configuration. It is a simplified example. In their case, a step can have close to 50 fields.
{
"name" : "Name of the workflow",
"description" : "Description of the workflow",
"steps" : {
"step_1" : {
"async" : false,
"sql_query_name" : "Name of the query to execute",
"transform_request" : "Can be a Go template",
"transform_response" : "Can be a Go template",
"steps" : {
"step_1_1" : {
},
"step_1_2" : {
}
}
},
"step_2" : {
"async" : true,
"function_to_execute" : "Name of the query to execute",
"transform_request" : "Can be a Go template",
"transform_response" : "Can be a Go template",
"steps" : {
"step_2_1" : {
},
"step_2_2" : {
}
}
}
}
}
Important points to note in the above JSON configuration:
- The workflow configuration is recursive. A step can have steps, and those steps can have further steps, and so on.
- Step names follow a pattern
^[a-z]+(_[a-z]+)*$. - Certain JSON attributes require us to generate valid Go templates. These Go templates use some reusable library functions.