genkit icon indicating copy to clipboard operation
genkit copied to clipboard

[Docs] Need to make clear in complexMenuSuggestionFlow it is using beta

Open codercatdev opened this issue 1 month ago • 0 comments

Is your report related to a problem? Please describe. Need to make clear in complexMenuSuggestionFlow it is using beta. I was getting type issues until I found in other places that ai.chat is actually in the beta release. This is really confusing when getting started.

Is your report related to a suggestion/improvement? Please describe. Add comments to say that ai/chat is part of genkit/beta make sure to use this import.

Additional context Debugging example

Image
const PrixFixeMenuSchema = z.object({
  starter: z.string(),
  soup: z.string(),
  main: z.string(),
  dessert: z.string(),
});

export const complexMenuSuggestionFlow = ai.defineFlow(
  {
    name: 'complexMenuSuggestionFlow',
    inputSchema: z.object({ theme: z.string() }),
    outputSchema: PrixFixeMenuSchema,
  },
  async ({ theme }): Promise<z.infer<typeof PrixFixeMenuSchema>> => {
    const chat = ai.chat({ model: googleAI.model('gemini-2.5-flash') });
    await chat.send('What makes a good prix fixe menu?');
    await chat.send(
      'What are some ingredients, seasonings, and cooking techniques that ' + `would work for a ${theme} themed menu?`,
    );
    const { output } = await chat.send({
      prompt: `Based on our discussion, invent a prix fixe menu for a ${theme} ` + 'themed restaurant.',
      output: {
        schema: PrixFixeMenuSchema,
      },
    });
    if (!output) {
      throw new Error('No data generated.');
    }
    return output;
  },
);

codercatdev avatar Nov 12 '25 15:11 codercatdev