Closed MarkDaoust closed 1 month ago
model = genai.GenerativeModel(model_name, system_instruction="Talk in rhymes")
model.count_tokens("")
I think this would still raise the following :
Hmmm... It goes through to_contentS first, that catches None:
But to should it let ""
through?
Updated title.
It goes through to_contentS first, that catches None
I don't think it will(tested it locally):
""
is not None.
It will go to to_content
method and would raise the error. Even if we change to_contents
to handle ""
, something like:
def to_contents(contents: ContentsType) -> list[glm.Content]:
if not contents:
return []
The request goes through but the API raises error as contents
is a required field for the GenerateContentRequest
Fixes: https://github.com/google-gemini/generative-ai-python/issues/326