From 7ee1591a7ae8fb162591b31485862fbdca5397cd Mon Sep 17 00:00:00 2001 From: Alex Patterson Date: Wed, 12 Nov 2025 15:20:31 +0000 Subject: [PATCH] docs(doc-snippets): clarify ai.chat is provided by genkit/beta --- js/doc-snippets/src/flows/index.ts | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/js/doc-snippets/src/flows/index.ts b/js/doc-snippets/src/flows/index.ts index 05271e8dce..56dfa4f06f 100644 --- a/js/doc-snippets/src/flows/index.ts +++ b/js/doc-snippets/src/flows/index.ts @@ -18,6 +18,13 @@ import { googleAI } from '@genkit-ai/googleai'; import { z } from 'genkit'; import { genkit } from 'genkit/beta'; +// NOTE: The chat / studio style APIs (for example `ai.chat`) are provided +// in the beta package `genkit/beta`. If you try to use `ai.chat` while +// importing `genkit` from the stable package, you'll run into confusing +// type errors because the chat APIs aren't exposed there. The snippets in +// this file use `genkit/beta` on purpose so `ai.chat` and related features +// are available. + const ai = genkit({ plugins: [googleAI()], }); @@ -121,6 +128,14 @@ const PrixFixeMenuSchema = z.object({ dessert: z.string(), }); +// IMPORTANT: This flow uses `ai.chat(...)` which is only available when +// `genkit` is imported from `genkit/beta` (see the note above). If you +// copied this example into your project and saw type errors around +// `ai.chat`, make sure your import looks like: +// +// import { genkit } from 'genkit/beta'; +// +// instead of `import { genkit } from 'genkit'`. export const complexMenuSuggestionFlow = ai.defineFlow( { name: 'complexMenuSuggestionFlow',