Browse Source

feat: add retry mechanism for zhipuai (#5926)

tags/0.6.13
orangeclk 1 year ago
parent
commit
f8aaa57f31
No account linked to committer's email address

+ 3
- 0
api/core/model_runtime/model_providers/zhipuai/zhipuai_sdk/core/_http_client.py View File

import httpx import httpx
import pydantic import pydantic
from httpx import URL, Timeout from httpx import URL, Timeout
from tenacity import retry
from tenacity.stop import stop_after_attempt


from . import _errors from . import _errors
from ._base_type import NOT_GIVEN, Body, Data, Headers, NotGiven, Query, RequestFiles, ResponseT from ._base_type import NOT_GIVEN, Body, Data, Headers, NotGiven, Query, RequestFiles, ResponseT
def __exit__(self, exc_type, exc_val, exc_tb): def __exit__(self, exc_type, exc_val, exc_tb):
self.close() self.close()


@retry(stop=stop_after_attempt(ZHIPUAI_DEFAULT_MAX_RETRIES))
def request( def request(
self, self,
*, *,

Loading…
Cancel
Save