Skip to content

Commit

Permalink
Formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
pamelafox committed Jun 9, 2023
1 parent ff850a4 commit 5e9d379
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions scripts/prepdocs.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ def upload_documents_to_index(docs, search_client, upload_batch_size=50):
f"To Debug: PLEASE CHECK chunk_size and upload_batch_size. \n Error Messages: {list(errors)}"
)


def validate_index(index_name, index_client):
for retry_count in range(5):
stats = index_client.get_index_statistics(index_name)
Expand All @@ -101,10 +102,10 @@ def validate_index(index_name, index_client):
print("Index is empty. Please investigate and re-index.")
else:
print(f"The index contains {num_chunks} chunks.")
average_chunk_size = stats['storage_size']/num_chunks
average_chunk_size = stats["storage_size"] / num_chunks
print(f"The average chunk size of the index is {average_chunk_size} bytes.")
break


def create_and_populate_index(
index_name, index_client, search_client, form_recognizer_client
Expand Down Expand Up @@ -180,9 +181,7 @@ def create_and_populate_index(
if args.tenantid == None
else AzureDeveloperCliCredential(tenant_id=args.tenantid, process_timeout=60)
)
default_creds = (
azd_credential if args.searchkey == None else None
)
default_creds = azd_credential if args.searchkey == None else None
search_creds = (
default_creds if args.searchkey == None else AzureKeyCredential(args.searchkey)
)
Expand Down

0 comments on commit 5e9d379

Please sign in to comment.