Skip to content

Conversation

@newokaerinasai
Copy link
Contributor

This PR

Adds retries for downloads, which is supposed to fix some issues with large files.

@newokaerinasai newokaerinasai changed the base branch from main to next December 15, 2025 18:56
@timofeev1995 timofeev1995 requested review from timofeev1995 and removed request for sadreamer December 16, 2025 09:52
DOWNLOAD_BLOCK_SIZE = 10 * 1024 * 1024 # 10 MB
DISABLE_TQDM = False
MAX_DOWNLOAD_RETRIES = 5 # Maximum retries for download failures
DOWNLOAD_RETRY_DELAY = 1.0 # Initial retry delay in seconds

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd name DOWNLOAD_INITIAL_RETRY_DELAY according to the comment for consistency

try:
# If this is a retry, close the previous response and create a new one with Range header
if bytes_downloaded > 0:
if 'response' in locals():

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we do
response = None above the with tqdm to avoid using "locals" doing if response is None instead?

@newokaerinasai newokaerinasai marked this pull request as ready for review December 16, 2025 11:45
@cursor
Copy link

cursor bot commented Dec 16, 2025

You have run out of free Bugbot PR reviews for this billing cycle. This will reset on January 7.

To receive reviews on all of your PRs, visit the Cursor dashboard to activate Pro and start your 14-day free trial.

@newokaerinasai newokaerinasai merged commit 0940fef into next Dec 16, 2025
9 checks passed
stainless-app bot added a commit that referenced this pull request Dec 16, 2025
* feat(api): api update

* chore(internal): add missing files argument to base client

* feat(api): api update

* Add progress bar for Fine-tuning API (#197)

Add progress bar for FT

* Add download retries (#198)

* add download retries

* feat(files): add support for string alternative to file upload type

* release: 2.0.0-alpha.11

---------

Co-authored-by: stainless-app[bot] <142633134+stainless-app[bot]@users.noreply.github.com>
Co-authored-by: Artem Chumachenko <[email protected]>
Co-authored-by: Ruslan Khaidurov <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants