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

Temp/try merge queue2 #117

Merged
merged 4 commits into from
Oct 29, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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