[Docs] Align the dotprompt example with the sample flow
I was trying to convert the sample flow to use dotprompt and I (newbie Node dev) had trouble doing this. I thought it might be nice to use the same example with the same inputs for our first dotprompt sample, to eliminate things that could go wrong.
I also found it confusing that the dotPrompt example hardcodes values in the generate function while the sample flow relies on inputs coming from the devui/app. I think you might want to consider only hardcoding inputs when we are executing flows on the command line.
const menuSuggestionPrompt = await prompt(menuSuggestion);
const llmResponse = await menuSuggestionPrompt.generate({input});
console.log(llmResponse.text());
Requested changes:
- Update
resultto bellmResponseto keep in line with sample flow - Use the menu suggestion prompt text in the dotprompt file.
- [maybe?] tell users to replace everything in the async (input) => {} function, or figure out some way to be clear how you can make this work.
- [maybe?] Explain what
inputobject is.
Additional context This might be resolved with a better example in the future.
Sorry just to clarify, can you link which dotPrompt example you're talking about?
Sure! https://firebase.google.com/docs/genkit/dotprompt the dot prompt example.
@mjchristy on point 2:
Use the menu suggestion prompt text in the dotprompt file.
If I'm not mistaken, you're referring to the following sample (taken from here):
---
model: vertexai/gemini-1.0-pro
input:
schema:
theme: string
output:
format: json
schema:
name: string
price: integer
ingredients(array): string
---
Generate a menu item that could be found at a {{theme}} themed restaurant.
and by "prompt text" you mean the theme parameter in the input schema, which is banana in the sample?
const createMenuPrompt = await prompt('create_menu');
const menu = await createMenuPrompt.generate({
input: {
theme: 'banana',
},
});
console.log(menu.output());
I looked up for the sample you pasted but couldn't find it in this page.