Skip to content
This repository has been archived by the owner on Nov 13, 2024. It is now read-only.

Commit

Permalink
Merge remote-tracking branch 'origin/bugfix/try_error' into temp/try_…
Browse files Browse the repository at this point in the history
…merge_queue2
  • Loading branch information
igiloh-pinecone committed Oct 29, 2023
2 parents c9455ec + dac99ab commit 30f16bc
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 2 deletions.
1 change: 1 addition & 0 deletions src/canopy/knowledge_base/record_encoder/openai.py
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand Down
2 changes: 2 additions & 0 deletions src/canopy/llm/openai.py
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand Down Expand Up @@ -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(
Expand Down
5 changes: 3 additions & 2 deletions src/canopy_cli/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down Expand Up @@ -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.
Expand Down Expand Up @@ -297,6 +297,7 @@ def upsert(index_name: str,
raise CLIError(msg)

pbar.update(len(batch))
pbar.close()

if failed_docs:
msg = (
Expand Down

0 comments on commit 30f16bc

Please sign in to comment.