-
Notifications
You must be signed in to change notification settings - Fork 126
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: Add chatrole tests and meta for GeminiChatGenerators #1090
Conversation
integrations/google_ai/src/haystack_integrations/components/generators/google_ai/chat/gemini.py
Outdated
Show resolved
Hide resolved
integrations/google_ai/src/haystack_integrations/components/generators/google_ai/chat/gemini.py
Show resolved
Hide resolved
integrations/google_ai/src/haystack_integrations/components/generators/google_ai/chat/gemini.py
Show resolved
Hide resolved
integrations/google_ai/src/haystack_integrations/components/generators/google_ai/chat/gemini.py
Show resolved
Hide resolved
|
||
combined_response = "".join(responses).lstrip() | ||
return [ChatMessage.from_assistant(content=combined_response)] | ||
streaming_callback(StreamingChunk(content=content, meta=metadata)) |
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.
Is the indentation correct here? We're calling streaming_callback
once per candidate
. Shouldn't it be called once per part
? What if there are multiple parts
per candidate
?
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.
You have a valid point. I looked into this, but it's difficult to find any chunk that contains multiple Parts
, so for now, it produces the same result. In other generators, the entire chunk is passed to the callback function, as shown here. Because of this, I'm not entirely certain, but we can do it your way.
@anakin87 would you have an input here?
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.
Sorry. @vblagoje knows better.
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.
@silvanocerza I updated based on your suggestion for now which makes more sense, also this PR is blocking my other PR. So I'll just go ahead
Related Issues
Proposed Changes:
ChatRole
of messages.How did you test it?
VertexChatGenerator
with examplesNotes for the reviewer
There might be some room for improvement as I wasn't sure what is the general protocol for meta in
ChatMessages
.Checklist
fix:
,feat:
,build:
,chore:
,ci:
,docs:
,style:
,refactor:
,perf:
,test:
.