diff --git a/src/canopy/knowledge_base/record_encoder/openai.py b/src/canopy/knowledge_base/record_encoder/openai.py index 3a1ec728..ce18a3f8 100644 --- a/src/canopy/knowledge_base/record_encoder/openai.py +++ b/src/canopy/knowledge_base/record_encoder/openai.py @@ -23,6 +23,7 @@ def __init__(self, super().__init__(dense_encoder=encoder, batch_size=batch_size, **kwargs) @retry( + reraise=True, wait=wait_random_exponential(min=1, max=10), stop=stop_after_attempt(3), retry=retry_if_exception_type(OPEN_AI_TRANSIENT_EXCEPTIONS), diff --git a/src/canopy/llm/openai.py b/src/canopy/llm/openai.py index 812fc5e0..4cb3d43f 100644 --- a/src/canopy/llm/openai.py +++ b/src/canopy/llm/openai.py @@ -30,6 +30,7 @@ def available_models(self): return [k["id"] for k in openai.Model.list().data] @retry( + reraise=True, wait=wait_random_exponential(min=1, max=10), stop=stop_after_attempt(3), retry=retry_if_exception_type(OPEN_AI_TRANSIENT_EXCEPTIONS), @@ -66,6 +67,7 @@ def streaming_iterator(response): return ChatResponse(**response) @retry( + reraise=True, wait=wait_random_exponential(min=1, max=10), stop=stop_after_attempt(3), retry=retry_if_exception_type( diff --git a/src/canopy_cli/cli.py b/src/canopy_cli/cli.py index b3ba714d..7fcf8757 100644 --- a/src/canopy_cli/cli.py +++ b/src/canopy_cli/cli.py @@ -64,7 +64,7 @@ def check_service_health(url: str): raise CLIError(msg) -@retry(wait=wait_fixed(5), stop=stop_after_attempt(6)) +@retry(reraise=True, wait=wait_fixed(5), stop=stop_after_attempt(6)) def wait_for_service(chat_service_url: str): check_service_health(chat_service_url) @@ -193,7 +193,7 @@ def new(index_name: str, config: Optional[str]): help=( """ \b - Upload local data files containing documents to the Canopy service. + Upload local data files to the Canopy service. Load all the documents from data file or a directory containing multiple data files. The allowed formats are .jsonl and .parquet. @@ -297,6 +297,7 @@ def upsert(index_name: str, raise CLIError(msg) pbar.update(len(batch)) + pbar.close() if failed_docs: msg = (