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: handle empty string in ChatSession.send_message #134

Merged
merged 3 commits into from
Dec 19, 2023
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
fix: handle empty string in ChatSession.send_message
Hamza-nabil authored Dec 17, 2023
commit 5af8d7602e654e9226c96a40e1db249082ce1384
2 changes: 2 additions & 0 deletions google/generativeai/generative_models.py
Original file line number Diff line number Diff line change
@@ -346,6 +346,8 @@ def send_message(
stream: bool = False,
**kwargs,
) -> generation_types.GenerateContentResponse:
if not contents:
raise TypeError("contents must not be empty")
content = content_types.to_content(content)
if not content.role:
content.role = self._USER_ROLE