Skip to content

TypeError Could not create Blob, expected Blob, dict or an Image type(PIL.Image.Image or IPython.display.Image) #380

Open
@petrgazarov

Description

@petrgazarov

Description of the bug:

Getting this error sometimes. What does it mean? If I rerun the script, it is not raised every time, but only sometimes.

REQUEST_TIMEOUT = 90
    
# model is `gemini-1.5-flash`    
client = genai.GenerativeModel(model, system_instruction=system_instruction)
    
google_completion = await asyncio.wait_for(
    client.generate_content_async(
        messages,
        safety_settings={
            HarmCategory.HARM_CATEGORY_HARASSMENT: HarmBlockThreshold.BLOCK_NONE,
            HarmCategory.HARM_CATEGORY_HATE_SPEECH: HarmBlockThreshold.BLOCK_NONE,
            HarmCategory.HARM_CATEGORY_SEXUALLY_EXPLICIT: HarmBlockThreshold.BLOCK_NONE,
            HarmCategory.HARM_CATEGORY_DANGEROUS_CONTENT: HarmBlockThreshold.BLOCK_NONE,
        },
    ),
    REQUEST_TIMEOUT,
)

Actual vs expected behavior:

Actual:

TypeError Could not create `Blob`, expected `Blob`, `dict` or an `Image` type(`PIL.Image.Image` or `IPython.display.Image`).
Got a: <class 'NoneType'>
Value: None

Expected there to be no error

Any other information you'd like to share?

No response

Metadata

Metadata

Assignees

Labels

component:python sdkIssue/PR related to Python SDKstatus:triagedIssue/PR triaged to the corresponding sub-teamtype:bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions