From 1716e119003b3516b3d9da8d6902940379a169ff Mon Sep 17 00:00:00 2001 From: lebaudantoine Date: Wed, 9 Jul 2025 19:23:38 +0200 Subject: [PATCH] =?UTF-8?q?=F0=9F=94=A7(summary)=20configure=20OpenAI=20ma?= =?UTF-8?q?x=20retries=20via=20FastAPI=20settings?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Set default OpenAI retries to 0 and add configurable setting to control retry behavior for API requests in summary service. --- src/summary/summary/core/celery_worker.py | 8 ++++++-- src/summary/summary/core/config.py | 1 + 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/src/summary/summary/core/celery_worker.py b/src/summary/summary/core/celery_worker.py index b77931d2..0630b9b0 100644 --- a/src/summary/summary/core/celery_worker.py +++ b/src/summary/summary/core/celery_worker.py @@ -176,7 +176,9 @@ def process_audio_transcribe_summarize(filename: str, email: str, sub: str): logger.debug("Initiating OpenAI client") openai_client = openai.OpenAI( - api_key=settings.openai_api_key, base_url=settings.openai_base_url + api_key=settings.openai_api_key, + base_url=settings.openai_base_url, + max_retries=settings.openai_max_retries, ) try: @@ -257,7 +259,9 @@ def process_audio_transcribe_summarize_v2( logger.debug("Initiating OpenAI client") openai_client = openai.OpenAI( - api_key=settings.openai_api_key, base_url=settings.openai_base_url + api_key=settings.openai_api_key, + base_url=settings.openai_base_url, + max_retries=settings.openai_max_retries, ) try: diff --git a/src/summary/summary/core/config.py b/src/summary/summary/core/config.py index ddcdc032..cf0dddee 100644 --- a/src/summary/summary/core/config.py +++ b/src/summary/summary/core/config.py @@ -33,6 +33,7 @@ class Settings(BaseSettings): openai_base_url: str = "https://api.openai.com/v1" openai_asr_model: str = "whisper-1" openai_llm_model: str = "gpt-4o" + openai_max_retries: int = 0 # Webhook-related settings webhook_max_retries: int = 2