jkomoros / prompt-garden

A framework for gardening LLM prompts
Apache License 2.0
9 stars 0 forks source link

Allow computed objects and arrays without using `object` or `array` #42

Closed jkomoros closed 1 year ago

jkomoros commented 1 year ago

If you want to have an object or array with computed sub-properties, you have to wrap it in either a type:object or type:array. This is annoying, easy to get wrong, and adds an unnessecary level of extra indirection during authoring.

As a pre-processing step before the seed packet has nested seeds unrolled, process the object. Iterate through them, and if we find any with a SeedReference or SeedData property, then replace the parent with a type:object wrapper (and do the same for arrays, too). This should be a pretty simple transformation and handle most cases fine.

(Once we make it so seed references have a seed, not id property, it will make this behavior even more resilient... as long as your sub-objects don't have a type or seed property then it will work as you think.)

jkomoros commented 1 year ago

This is done as of cb74ab6