-
Notifications
You must be signed in to change notification settings - Fork 94
Open
Labels
priority: p2Moderately-important priority. Fix may not be included in next release.Moderately-important priority. Fix may not be included in next release.status:awaiting user responsestatus:staletype: bugError or flaw in code with unintended results or allowing sub-optimal usage patterns.Error or flaw in code with unintended results or allowing sub-optimal usage patterns.
Description
Environment details
- Programming language: Java
- OS: Windows 11
- Language runtime version: 21
- Package version: 1.30.0
- Model: gemini-2.5-flash
Steps to reproduce
- Trigger a response with finishReason
SAFETYwhile using thecom.google.genai.Chat - The
com.google.genai.ChatBase.validateHistorywill fail withjava.util.NoSuchElementException: No value presentas the role of the response is empty. There is no chance for the custom logic to handle the response.
java.util.NoSuchElementException: No value present
java.base/java.util.Optional.get (Optional.java:143)
com.google.genai.ChatBase.validateHistory (ChatBase.java:130)
com.google.genai.ChatBase.recordHistory (ChatBase.java:55)
com.google.genai.ChatBase.updateHistoryNonStreaming (ChatBase.java:258)
com.google.genai.Chat.privateSendMessage (Chat.java:149)
com.google.genai.Chat.sendMessage (Chat.java:104)
Metadata
Metadata
Assignees
Labels
priority: p2Moderately-important priority. Fix may not be included in next release.Moderately-important priority. Fix may not be included in next release.status:awaiting user responsestatus:staletype: bugError or flaw in code with unintended results or allowing sub-optimal usage patterns.Error or flaw in code with unintended results or allowing sub-optimal usage patterns.