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 b1cad95
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion 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),
wait=wait_exponential(multiplier=30, max=120),
stop=stop_after_delay(300),
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 b1cad95

Please sign in to comment.