From 5e9d3793a2de27ff1bd34ce49997cf2c728a4f50 Mon Sep 17 00:00:00 2001 From: Pamela Fox Date: Fri, 9 Jun 2023 17:07:18 +0000 Subject: [PATCH] Formatting --- scripts/prepdocs.py | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/scripts/prepdocs.py b/scripts/prepdocs.py index 949d3fd933..76ada6ace5 100644 --- a/scripts/prepdocs.py +++ b/scripts/prepdocs.py @@ -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) @@ -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 @@ -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) )