docling-project/docling

implement retry strategy for remote calls

Geschlossen

#2.465 geöffnet am 15.10.2025

 (2 Kommentare) (0 Reaktionen) (1 zugewiesene Person)Python (4.140 Forks)batch import
enhancementgood first issue

Repository-Metriken

Stars
 (59.751 Sterne)
PR-Merge-Metriken
 (Durchschn. Merge 7T 5h) (93 gemergte PRs in 30 T)

Beschreibung

Hi, when for example sending images for description to remote API, it would be beneficial to add a retry strategy in the underlying requests calls, i.e.:

import requests

from requests.adapters import HTTPAdapter, Retry

s = requests.Session()

retries = Retry(total=5,
                backoff_factor=0.1,
                status_forcelist=[ 500, 502, 503, 504 ])

s.mount('http://', HTTPAdapter(max_retries=retries))

s.get('http://httpstat.us/500')

This way we could solve various errors that might happen during these calls, such as:

"Requests to the ChatCompletions_Create Operation under Azure OpenAI API have exceeded token rate limit of your current AIServices S0 pricing tier. Please retry after 11 seconds.

Contributor Guide