Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

⬆️ fix(llmkira/openai): add wait_exponential to retry configu… #415

Merged
merged 1 commit into from
Jun 20, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions llmkira/openai/request.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
from loguru import logger
from pydantic import ConfigDict, BaseModel, Field, field_validator, model_validator
from pydantic import SecretStr
from tenacity import retry, stop_after_attempt
from tenacity import retry, stop_after_attempt, wait_exponential

from llmkira.openai._excption import raise_error, NetworkError, UnexpectedFormatError
from .cell import (
Expand Down Expand Up @@ -181,7 +181,11 @@ def check_vision(self):
]
return self

@retry(stop=stop_after_attempt(3), reraise=True)
@retry(
stop=stop_after_attempt(3),
reraise=True,
wait=wait_exponential(multiplier=1, min=4, max=10),
)
async def request(self, session: OpenAICredential) -> OpenAIResult:
"""
:param session: Credential
Expand Down
Loading