-
Notifications
You must be signed in to change notification settings - Fork 122
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
BUG: role with null value added to the history on content blocked due to Safety reasons #197
Comments
…null role added to the history of the ChatSession when content was blocked due to Safety or other reasons. closes [issue google-gemini#197](google-gemini#197 (comment))
…null role added to the history of the ChatSession when content was blocked due to Safety or other reasons. closes issue google-gemini#197
Fixes #197 A content requires a role when it is sent to the model in the history. If the backend happens to respond with a message that has no role, default it to 'model'.
Fixes #197 A content requires a role when it is sent to the model in the history. If the backend happens to respond with a message that has no role, default it to 'model'.
Awesome @natebosch thank you for the update. |
Hi team, The issue is not solve with this fix as the main problem is the lack of answer from the model in the history. You can use this example repo I created and follow the instructions and you will se the chat breaks completely. firebase/flutterfire#13104 The only two solutions I can think of, that I currently use in my own code are:
Hope it helps, thanks for the great job. |
Description of the bug:
When using the chat mode and sending messages instead of streaming (using the method
sendMessage
instead ofsendMessageStream
) , the blocked responses from the ai will be added to the_history
with anull
role. Throwing an exception and breaking thechatSession
as the multi-turn mode will force the conversation to alternate between user and model.This normally throughs this Exception:
Actual vs expected behavior:
If a responses is flagged and blocked, it should not be added to the
history
allowing the developer to handle the error and either retry the generation or add a generic response from the ai to continue the conversation naturally.Any other information you'd like to share?
No response
The text was updated successfully, but these errors were encountered: