Skip to content

Commit b23546f

Browse files
fix: handle empty string in ChatSession.send_message (#134)
* fix: handle empty string in ChatSession.send_message * refactor: move empty string handling to content_types.to_content * ValueError --------- Co-authored-by: Mark Daoust <[email protected]>
1 parent 0a9596f commit b23546f

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

google/generativeai/types/content_types.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -190,6 +190,9 @@ def is_content_dict(d):
190190

191191

192192
def to_content(content: ContentType):
193+
if not content:
194+
raise ValueError("content must not be empty")
195+
193196
if isinstance(content, Mapping):
194197
content = _convert_dict(content)
195198

0 commit comments

Comments
 (0)