-
Notifications
You must be signed in to change notification settings - Fork 3.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add a sample for streaming callables #1185
base: main
Are you sure you want to change the base?
Conversation
Node/quickstarts/callable-functions-streaming/functions/index.js
Outdated
Show resolved
Hide resolved
let channelData; | ||
try { | ||
// tell the client app we're starting | ||
response.sendChunk({status: "fetching channel info", channelInfo}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@egilmorez Here's an example that sends multiple updates to the client via sendChunk
as it makes calls to the Youtube API. I think this might be a better generic example for streaming callables, since an LLM-y example might be better served by the onCallGenkit
trigger. What do you think?
response.sendChunk({ | ||
status: `found ${videos.length} videos`, | ||
channelInfo, | ||
}); | ||
|
||
return channelInfo; | ||
}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
TODO snippet tag this
(channelInfo.channelDescription = channel.snippet.description), | ||
(channelInfo.subscriberCount = channel.statistics.subscriberCount), | ||
// send latest data to the client app | ||
response.sendChunk({status: "found channel info", channelInfo}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
TODO snippet tag this
No description provided.