Skip to content

Conversation

Hamza-nabil
Copy link
Contributor

@Hamza-nabil Hamza-nabil commented Sep 14, 2024

Description of the change

Add support for streaming file uploads in the upload_file function.

The table below outlines the expected behavior for handling IOBase instances compared to Path instances:

Feature For IOBase instance For Path instance
Upload Method MediaIoBaseUpload MediaFileUpload
Default MIME Type 'application/octet-stream' (reference here) MIME type is guessed based on the file extension
Default Display Name None path.name

Motivation

This update addresses #537, which requests the addition of support for uploading files via stream

Type of change

Feature request

Checklist

  • I have performed a self-review of my code.
  • I have added detailed comments to my code where applicable.
  • I have verified that my change does not break existing code.
  • My PR is based on the latest changes of the main branch (if unsure, please run git pull --rebase upstream main).
  • I am familiar with the Google Style Guide for the language I have coded in.
  • I have read through the Contributing Guide and signed the Contributor License Agreement.

Change-Id: I346da140eef00d5fca595255ef8926079cada6a6
Change-Id: Iea071c396c4cfe2b2c8eacae74dd8fb0acbc128f
@MarkDaoust MarkDaoust marked this pull request as ready for review September 27, 2024 18:37
@github-actions github-actions bot added status:awaiting review PR awaiting review from a maintainer component:python sdk Issue/PR related to Python SDK labels Sep 27, 2024
Hamza-nabil and others added 3 commits September 27, 2024 20:51
Change-Id: I572f02ed98b9ca45299b76e7a01695fdcf917e1e
…enerative-ai-python into stream-file-upload

Change-Id: Ib1a9ffcbad13ddecaca2350850101e7c0b74840a
@MarkDaoust
Copy link
Collaborator

LGTM Thank you!

7b2c5ef

Oops, thanks for the fix!

MarkDaoust
MarkDaoust previously approved these changes Sep 27, 2024
Change-Id: I220c05eee73ae76ced25254d67332f70a4069f7e
@MarkDaoust MarkDaoust merged commit b50341e into google-gemini:main Sep 27, 2024
9 checks passed
@github-actions github-actions bot removed the status:awaiting review PR awaiting review from a maintainer label Sep 27, 2024
@Hamza-nabil Hamza-nabil deleted the stream-file-upload branch September 27, 2024 22:55
@Hamza-nabil Hamza-nabil restored the stream-file-upload branch September 27, 2024 22:55
@Hamza-nabil Hamza-nabil deleted the stream-file-upload branch September 27, 2024 22:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component:python sdk Issue/PR related to Python SDK
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants