Skip to content

Commit

Permalink
Update retry wait time in summarization.py
Browse files Browse the repository at this point in the history
  • Loading branch information
baptiste-pasquier committed Mar 25, 2024
1 parent 4e9af85 commit 8e0cac1
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions backend/rag_components/summarization.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
from langchain_core.runnables import RunnableLambda, RunnableSequence
from tenacity import (
before_log,
before_sleep_log,
retry,
retry_if_exception_type,
stop_after_delay,
Expand All @@ -22,10 +23,11 @@

@retry(
retry=retry_if_exception_type((openai.RateLimitError, openai.BadRequestError)),
wait=wait_exponential(multiplier=10, min=10, max=160),
stop=stop_after_delay(300),
wait=wait_exponential(multiplier=60, max=180),
stop=stop_after_delay(600),
before=before_log(logger, logging.INFO),
# after=after_log(logger, logging.INFO),
before_sleep=before_sleep_log(logger, logging.INFO),
)
async def aprocess_batch(chain: RunnableSequence, batch: list) -> list:
"""Process a batch of items, applying retries on failure.
Expand Down

0 comments on commit 8e0cac1

Please sign in to comment.