in google/generativeai/types/content_types.py [0:0]
def to_content(content: ContentType):
if not content:
raise ValueError(
"Invalid input: 'content' argument must not be empty. Please provide a non-empty value."
)
if isinstance(content, Mapping):
content = _convert_dict(content)
if isinstance(content, protos.Content):
return content
elif isinstance(content, Iterable) and not isinstance(content, str):
return protos.Content(parts=[to_part(part) for part in content])
else:
# Maybe this is a Part?
return protos.Content(parts=[to_part(content)])