Skip to content

Enhance generateContentStream with streamCallbacks support. Fixes #322 #401

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

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

cestercian
Copy link

@cestercian cestercian commented Mar 8, 2025

  • Adds streamCallbacks as an optional argument to generateContentStream.
  • 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),
});

@demoncoder-crypto
Copy link

I am working on this issue let me know if its up to expectation

Copy link

@avinesh2101 avinesh2101 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey! This change has already been proposed in [Original PR #371]. Submitting duplicate PRs doesn’t add value and can create unnecessary noise for maintainers. It’s best to check existing PRs before submitting new ones. Maybe consider contributing in other meaningful ways!

@cestercian
Copy link
Author

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.

@Annhiluc Annhiluc added type:feature request New feature request/enhancement status:triaged Issue/PR triaged to the corresponding sub-team p3 labels Mar 27, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
p3 status:triaged Issue/PR triaged to the corresponding sub-team type:feature request New feature request/enhancement
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants