-
Notifications
You must be signed in to change notification settings - Fork 4.1k
Description
Is there an existing issue for this?
- I have searched the existing issues.
Which plugins are affected?
Other
Which platforms are affected?
No response
Description
This issue is caused by generative-ai-dart. When a response from the model is blocked due to Safety reasons, the response is added to the history with a null role. This throws an exception and breaks the ChatSession as multi-turn forces you to alternate between user and model roles.
As a null role was added, the history breaks and no further messages can be sent.
This seems to happen only using the method sendMessage and not the sendMessageStream.
There is an already a closed issue in the package and a pull request awaiting review in case someone need to use it temporarily.
Reproducing the issue
Create a new chat instance and force a message to be blocked for safety reasons. Then try to send a new message as a user or model.
Firebase Core version
3.1.1
Flutter Version
3.19.6
Relevant Log Output
No response
Flutter dependencies
No response
Additional context and comments
No response