generative-ai-js
generative-ai-js copied to clipboard
Enhance generateContentStream with streamCallbacks support. Fixes #322
- Adds
streamCallbacksas an optional argument togenerateContentStream. - Enables users to receive text responses via callbacks without handling Node.js streams.
- Includes test cases for the new functionality.
Example Usage:
await model.generateContentStream("Tell me a joke", {}, {
onData: (chunk: string) => process.stdout.write(chunk),
onDone: (fullText: string) => console.log("\nFinal output:", fullText),
});
I am working on this issue let me know if its up to expectation
Hey @avinesh2101 .Thanks for pointing that out. I didn’t realize this change had already been proposed in PR #371. I’ll make sure to check existing PRs more carefully next time. Appreciate the guidance! I’d love to contribute in other ways—if there are any areas that need help, I’d be happy to take a look.