Skip to content

Commit

Permalink
Merge branch 'main' of github.com:firebase/functions-samples
Browse files Browse the repository at this point in the history
  • Loading branch information
jhuleatt committed Feb 7, 2025
2 parents 735bbe5 + c8ed5fa commit 0dcd337
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions Node/quickstarts/genkit-helloworld/functions/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -56,7 +56,7 @@ const jokeTeller = ai.defineFlow({
// Send new words of the generative AI response
// to the client as they are generated.
for await (const chunk of stream) {
response.sendChunk(chunk.text);
sendChunk(chunk.text);
}

// Return the full generative AI response
Expand All @@ -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.
Expand Down

0 comments on commit 0dcd337

Please sign in to comment.