From b970fee24db29eff4345d72ffa5accf46c59c2cf Mon Sep 17 00:00:00 2001 From: Jeff <3759507+jhuleatt@users.noreply.github.com> Date: Thu, 6 Feb 2025 16:12:45 -0500 Subject: [PATCH 1/2] remove line that was accidentally commented out (#1190) --- Node/quickstarts/genkit-helloworld/functions/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Node/quickstarts/genkit-helloworld/functions/index.js b/Node/quickstarts/genkit-helloworld/functions/index.js index 3d12cd2c92..b93f2de667 100644 --- a/Node/quickstarts/genkit-helloworld/functions/index.js +++ b/Node/quickstarts/genkit-helloworld/functions/index.js @@ -74,7 +74,7 @@ exports.tellJoke = onCallGenkit({ // [END bind-secrets] // [START auth-policy] // Protect your endpoint with authPolicy. - // authPolicy: (auth) => !!auth?.token.email_verified, + authPolicy: (auth) => !!auth?.token.email_verified, // [END auth-policy] }, // Pass in the genkit flow. From c8ed5fa33b7963fd4b92fcd93296e4021e1f578d Mon Sep 17 00:00:00 2001 From: Daniel Lee Date: Fri, 7 Feb 2025 06:42:31 -0800 Subject: [PATCH 2/2] Desctructure streaming context for more idiomatic flow definition (#1191) --- Node/quickstarts/genkit-helloworld/functions/index.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Node/quickstarts/genkit-helloworld/functions/index.js b/Node/quickstarts/genkit-helloworld/functions/index.js index b93f2de667..a176bea669 100644 --- a/Node/quickstarts/genkit-helloworld/functions/index.js +++ b/Node/quickstarts/genkit-helloworld/functions/index.js @@ -46,7 +46,7 @@ const jokeTeller = ai.defineFlow({ inputSchema: z.string().nullable(), outputSchema: z.string(), streamSchema: z.string(), -}, async (jokeType = "knock-knock", response) => { +}, async (jokeType = "knock-knock", {sendChunk}) => { const prompt = `Tell me a ${jokeType} joke.`; // Call the `generateStream()` method to @@ -56,7 +56,7 @@ const jokeTeller = ai.defineFlow({ // Send new words of the generative AI response // to the client as they're generated. for await (const chunk of stream) { - response.sendChunk(chunk.text); + sendChunk(chunk.text); } // Return the full generative AI response