diff --git a/sdk/translation/azure-ai-translation-document/samples/async_samples/sample_authentication_async.py b/sdk/translation/azure-ai-translation-document/samples/async_samples/sample_authentication_async.py index df9964f79d4a..b516ba16ea8d 100644 --- a/sdk/translation/azure-ai-translation-document/samples/async_samples/sample_authentication_async.py +++ b/sdk/translation/azure-ai-translation-document/samples/async_samples/sample_authentication_async.py @@ -53,7 +53,7 @@ async def sample_authentication_api_key_async(): result = await document_translation_client.get_document_formats() -def sample_authentication_with_azure_active_directory_async(): +async def sample_authentication_with_azure_active_directory_async(): # [START create_dt_client_with_aad_async] """DefaultAzureCredential will use the values from these environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, AZURE_CLIENT_SECRET @@ -69,7 +69,7 @@ def sample_authentication_with_azure_active_directory_async(): # make calls with authenticated client async with document_translation_client: - result = document_translation_client.get_document_formats() + result = await document_translation_client.get_document_formats() async def main(): diff --git a/sdk/translation/azure-ai-translation-document/samples/async_samples/sample_check_document_statuses_async.py b/sdk/translation/azure-ai-translation-document/samples/async_samples/sample_check_document_statuses_async.py index 9f6493edf1db..0f92be1c64af 100644 --- a/sdk/translation/azure-ai-translation-document/samples/async_samples/sample_check_document_statuses_async.py +++ b/sdk/translation/azure-ai-translation-document/samples/async_samples/sample_check_document_statuses_async.py @@ -58,8 +58,8 @@ async def sample_document_status_checks_async(): )) completed_docs.append(document.id) if document.status == "Failed": - print("Document ID: {}, Error Code: {}, Message: {}".format( - document.id, document.error.code, document.error.message + print("Document at {} failed translation. Error Code: {}, Message: {}".format( + document.source_document_url, document.error.code, document.error.message )) completed_docs.append(document.id) if document.status == "Running": diff --git a/sdk/translation/azure-ai-translation-document/samples/async_samples/sample_list_document_statuses_with_filters_async.py b/sdk/translation/azure-ai-translation-document/samples/async_samples/sample_list_document_statuses_with_filters_async.py index 4cc2abcc4189..377fa3c0fa63 100644 --- a/sdk/translation/azure-ai-translation-document/samples/async_samples/sample_list_document_statuses_with_filters_async.py +++ b/sdk/translation/azure-ai-translation-document/samples/async_samples/sample_list_document_statuses_with_filters_async.py @@ -29,7 +29,7 @@ async def sample_list_document_statuses_with_filters_async(): # import libraries from azure.core.credentials import AzureKeyCredential - from azure.ai.translation.document import ( + from azure.ai.translation.document.aio import ( DocumentTranslationClient, ) from datetime import datetime diff --git a/sdk/translation/azure-ai-translation-document/samples/async_samples/sample_translate_multiple_inputs_async.py b/sdk/translation/azure-ai-translation-document/samples/async_samples/sample_translate_multiple_inputs_async.py index 804c7bb722d6..2b84399764c5 100644 --- a/sdk/translation/azure-ai-translation-document/samples/async_samples/sample_translate_multiple_inputs_async.py +++ b/sdk/translation/azure-ai-translation-document/samples/async_samples/sample_translate_multiple_inputs_async.py @@ -97,7 +97,7 @@ async def sample_multiple_translation_async(): if document.status == "Succeeded": print("Source document location: {}".format(document.source_document_url)) print("Translated document location: {}".format(document.translated_document_url)) - print("Translated to language: {}\n".format(document.translate_to)) + print("Translated to language: {}\n".format(document.translated_to)) else: print("Error Code: {}, Message: {}\n".format(document.error.code, document.error.message)) diff --git a/sdk/translation/azure-ai-translation-document/samples/sample_check_document_statuses.py b/sdk/translation/azure-ai-translation-document/samples/sample_check_document_statuses.py index 9e111fa0142e..13b3a0c5ead1 100644 --- a/sdk/translation/azure-ai-translation-document/samples/sample_check_document_statuses.py +++ b/sdk/translation/azure-ai-translation-document/samples/sample_check_document_statuses.py @@ -56,8 +56,8 @@ def sample_document_status_checks(): )) completed_docs.append(document.id) if document.status == "Failed": - print("Document ID: {}, Error Code: {}, Message: {}".format( - document.id, document.error.code, document.error.message + print("Document at {} failed translation. Error Code: {}, Message: {}".format( + document.source_document_url, document.error.code, document.error.message )) completed_docs.append(document.id) if document.status == "Running": @@ -65,7 +65,7 @@ def sample_document_status_checks(): document.id, document.translation_progress * 100 )) - print("\nTranslation completed.") + print("\nTranslation completed.") # [END list_all_document_statuses] diff --git a/sdk/translation/azure-ai-translation-document/samples/sample_translate_multiple_inputs.py b/sdk/translation/azure-ai-translation-document/samples/sample_translate_multiple_inputs.py index 17a915dd58c2..8a0d3169c4e4 100644 --- a/sdk/translation/azure-ai-translation-document/samples/sample_translate_multiple_inputs.py +++ b/sdk/translation/azure-ai-translation-document/samples/sample_translate_multiple_inputs.py @@ -94,7 +94,7 @@ def sample_multiple_translation(): if document.status == "Succeeded": print("Source document location: {}".format(document.source_document_url)) print("Translated document location: {}".format(document.translated_document_url)) - print("Translated to language: {}\n".format(document.translate_to)) + print("Translated to language: {}\n".format(document.translated_to)) else: print("Error Code: {}, Message: {}\n".format(document.error.code, document.error.message))