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

fix(generative-ai-dart) & fix(firebase_vertexai): null role on ChatSession history #198

Closed
wants to merge 2 commits into from

Conversation

Flucadetena
Copy link
Contributor

Fixes and closes issue #197

I extended the existing condition to take into account blocked Content with null role and avoid adding it to the history.

There is a preexisting "TODO" asking if the role should be appended before adding the content to the history. I did not changed or remove the comment, although in my tests a could not reproduce a case where the role was not user or model unless the responses had been blocked for Safety or other reasons.

When blocked the text part is empty and would not make sense to add it to the history. So no sure the appending the role is needed.

With the check the model keeps working fine and the developer can handle the Exception as it pleases, either retrying the generation or adding a default answer by the model so the user can rephrase and retry.

Happy to give more information or make any changes. Hope it helps, thanks for the great work.

…null role added to the history of the ChatSession when content was blocked due to Safety or other reasons.

closes issue google-gemini#197
@natebosch
Copy link
Collaborator

Thanks for the PR!

I landed an alternate version that defaults the role instead of omitting the content.
#205

@natebosch natebosch closed this Sep 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants