replicate/replicate-python

Retry on all 5xx errors

parikls opened this issue · 5 comments

Sometimes we are observing an JSONDecodeError raised by the library.
This happens when replicate API returns 502 Bad Gateway

httplib log:

https://api.replicate.com/v1/models/beautyyuyanli/multilingual-e5-large/versions/a06276a89f1a902d5fc225a9ca32b6e8e6292b7f3b136518878da97c458e2bad

{
http.fragment: ,
http.method: GET,
http.query: ,
http.response.status_code: 502,
reason: Bad Gateway
}

IMO retryable status codes should be extended to cover all possible 5xx errors

https://github.com/replicate/replicate-python/blob/main/replicate/client.py#L203