Skip to content
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

feat: enable streaming for VertexAIGeminiChatGenerator #1014

Merged
merged 8 commits into from
Aug 27, 2024

Conversation

Amnah199
Copy link
Contributor

Related Issues

Proposed Changes:

Add streaming_callback param to VertexAIGeminiChatGenerator to enable streaming.

How did you test it?

Manually testing as this component has no written tests.

Notes for the reviewer

This feature can also be implemented without using StreamingChunk but I decided to use it for consistency with other implementations we have in Bedrock, OpenAI etc.

Checklist

@github-actions github-actions bot added integration:google-vertex type:documentation Improvements or additions to documentation labels Aug 21, 2024
@Amnah199 Amnah199 marked this pull request as ready for review August 22, 2024 11:20
@Amnah199 Amnah199 requested a review from a team as a code owner August 22, 2024 11:20
@Amnah199 Amnah199 requested review from anakin87 and julian-risch and removed request for a team and anakin87 August 22, 2024 11:20
@Amnah199
Copy link
Contributor Author

@julian-risch I've added you for review since this is similar to the PR #1012.

Copy link
Member

@julian-risch julian-risch left a comment

Choose a reason for hiding this comment

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

Looks very good to me already! We should just add type annotations in two functions. Otherwise it'S ready to be merged. And I am looking forward to tests as tracked by #1019

responses.append(streaming_chunk.content)

combined_response = "".join(responses).lstrip()
return [ChatMessage.from_system(content=combined_response)]
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This will be changed to assistant role in another PR. I am tracking it here.

Copy link
Member

@julian-risch julian-risch left a comment

Choose a reason for hiding this comment

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

LGTM! 👍

@Amnah199 Amnah199 merged commit e2d566a into main Aug 27, 2024
10 checks passed
@Amnah199 Amnah199 deleted the feat-streaming-vertexai-chat-gen branch August 27, 2024 12:57
Amnah199 added a commit that referenced this pull request Oct 2, 2024
* Add streaming_callback in init() and run()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
integration:google-vertex type:documentation Improvements or additions to documentation
Projects
None yet
Development

Successfully merging this pull request may close these issues.

VertexAIGeminiChatGenerator streaming_callback implementation (or streaming response)
2 participants