Closed traxes9k closed 1 month ago
Hey, thanks for reporting! Dotprompt files are essentially handlebars templates. You can look into the #each
helper for how to unpack an array. https://handlebarsjs.com/guide/builtin-helpers.html#each. You're looking for JSON here, but it could be that you want something else, csv, ordered list, and so on. So how you define the template is really up to you. Let us know if you have more questions.
Thanks @MichaelDoyle ,
As per your excellent suggestion made the following changes to the prompt :
{{role "user"}}
{
"user_input": "{{user_input}}",
"ai_backstory": "{{ai_backstory}}",
"previous_choices":[{{#each previous_choices}}
{
"choice_description":{{this.choice_description}}
"consequence":{{this.consequence}}
}
{{/each}}]
}
Maybe this helps somebody else and thanks for your time.
Describe the bug Input array not unwrapped in Dotprompt request.
To Reproduce [dotprompt]
[INPUT]
[REQUEST TRACE]
Expected behavior Would expect the
previous_choices
array to be unpacked and sent with the request. This feature works for unwrapping outputs.Screenshots![Screenshot 2024-05-21 at 20 46 46](https://github.com/firebase/genkit/assets/69757418/e48cc4d7-8094-4284-9f53-985c6421c9e7)
Runtime (please complete the following information):
** Node version v21.7.2