Skip to content

Commit

Permalink
Sophiech/add error log (microsoft#808)
Browse files Browse the repository at this point in the history
Co-authored-by: Sophie Chen <[email protected]>
  • Loading branch information
SophieGarden and Sophie Chen authored Apr 22, 2024
1 parent fb0929c commit eb34987
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions scripts/data_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -752,11 +752,12 @@ def chunk_content(
for chunk, chunk_size, doc in chunked_context:
if chunk_size >= min_chunk_size:
if add_embeddings:
for _ in range(RETRY_COUNT):
for i in range(RETRY_COUNT):
try:
doc.contentVector = get_embedding(chunk, azure_credential=azure_credential, embedding_model_endpoint=embedding_endpoint)
break
except:
except Exception as e:
print(f"Error getting embedding for chunk with error={e}, retrying, current at {i + 1} retry, {RETRY_COUNT - (i + 1)} retries left")
time.sleep(30)
if doc.contentVector is None:
raise Exception(f"Error getting embedding for chunk={chunk}")
Expand Down

0 comments on commit eb34987

Please sign in to comment.