mirror of
https://github.com/langgenius/dify.git
synced 2024-11-16 11:42:29 +08:00
feat: add retry mechanism for zhipuai (#5926)
This commit is contained in:
parent
cabcf94be3
commit
f8aaa57f31
|
@ -7,6 +7,8 @@ from typing import Any, Union, cast
|
||||||
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
|
||||||
|
@ -221,6 +223,7 @@ class HttpClient:
|
||||||
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…
Reference in New Issue
Block a user