mirror of
https://github.com/open-compass/opencompass.git
synced 2025-05-30 16:03:24 +08:00
[Update] Support new error code for Bailing model (#1702)
* support new error code * fix the lint problems
This commit is contained in:
parent
ff831b153e
commit
05044dfaf2
@ -2,6 +2,7 @@ import concurrent
|
||||
import concurrent.futures
|
||||
import os
|
||||
import socket
|
||||
import time
|
||||
import traceback
|
||||
from typing import Dict, List, Optional, Union
|
||||
|
||||
@ -20,6 +21,8 @@ from .base_api import BaseAPIModel
|
||||
|
||||
PromptType = Union[PromptList, str]
|
||||
|
||||
BAILING_RETRY_DELAY: int = 30
|
||||
|
||||
|
||||
class HTTPAdapterWithSocketOptions(HTTPAdapter):
|
||||
|
||||
@ -200,6 +203,9 @@ class BailingAPI(BaseAPIModel):
|
||||
break # success
|
||||
elif response.status_code == 426:
|
||||
retry_num += 1 # retry
|
||||
elif response.status_code in [429, 500, 504]:
|
||||
time.sleep(BAILING_RETRY_DELAY)
|
||||
retry_num += 1 # retry
|
||||
else:
|
||||
raise ValueError(f'Status code = {response.status_code}')
|
||||
else:
|
||||
|
Loading…
Reference in New Issue
Block a user