Skip to content

Asynchronous file upload (google.generativeai.upload_file) and other blocking methods? #564

Open
@zavocc

Description

@zavocc

Description of the feature request:

Currently google.generativeai.upload_file is a blocking function, it would be nice if there are async versions of these methods along with other I/O related methods like get_file and delete_file though upload_file can be made asynchronous if uploading lets say 100mb of file.

What problem are you trying to solve with this feature?

Adding asynchronous versions of upload file methods is good in applications where it is async-driven (e.g. Discord bots, web) which currently using this to utilize multimodal features can potentially block the entire script which is not good for such applications

Any other information you'd like to share?

Right now I'm using something like asyncio.to_thread to make it asynchronous, but offering a native async methods would be nice

Right now there are only two async methods with this SDK are generate_content and send_message
Although it would also be a good idea if adding async variant to SDK as well

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions