-
Notifications
You must be signed in to change notification settings - Fork 310
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add support for resumable uploads for File API #275
Conversation
google/generativeai/client.py
Outdated
@@ -59,6 +59,8 @@ def create_file( | |||
mime_type: str | None = None, | |||
name: str | None = None, | |||
display_name: str | None = None, | |||
resumable: bool | None = None, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are we exposing too many details here?
Do we need the resumable
arg, could it just be resumable=chunk_size is not None
?
Is there a reasonable default policy we could implement like "if the file is over (2x)MB use resumable with chunk size (x)MB"?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, fair point. After some exploration, how about let's start simple and just allow users to set resumable as a boolean flag? The chunk size needs to be a multiple of a certain size and is unfriendly for developers.
Add support for resumable uploads by following the MediaFileUpload class in Python:
https://googleapis.github.io/google-api-python-client/docs/epy/googleapiclient.http.MediaFileUpload-class.html
Add some pydocs to clarify what the parameters specified are. Confirmed this is working locally: