From fbd02ca09fdc01aa1a171aa9be74c89a459ccf36 Mon Sep 17 00:00:00 2001 From: Krista Pratico Date: Thu, 20 Oct 2022 11:46:58 -0700 Subject: [PATCH 1/4] fix how we passed in summaryAspects --- .../samples/sample_conv_summarization.py | 4 +- ...tiontest_conversational_summarization.json | 94 +++++++++---------- ...synctest_conversational_summarization.json | 94 +++++++++---------- .../tests/test_conv_summarization.py | 2 +- .../tests/test_conv_summarization_async.py | 2 +- 5 files changed, 94 insertions(+), 102 deletions(-) diff --git a/sdk/cognitivelanguage/azure-ai-language-conversations/samples/sample_conv_summarization.py b/sdk/cognitivelanguage/azure-ai-language-conversations/samples/sample_conv_summarization.py index 4af6641b6e0c..6f7972b8fb4f 100644 --- a/sdk/cognitivelanguage/azure-ai-language-conversations/samples/sample_conv_summarization.py +++ b/sdk/cognitivelanguage/azure-ai-language-conversations/samples/sample_conv_summarization.py @@ -32,7 +32,7 @@ def sample_conv_summarization(): endpoint = os.environ["AZURE_CONVERSATIONS_ENDPOINT"] key = os.environ["AZURE_CONVERSATIONS_KEY"] - # analyze quey + # analyze query client = ConversationAnalysisClient(endpoint, AzureKeyCredential(key)) with client: poller = client.begin_conversation_analysis( @@ -72,7 +72,7 @@ def sample_conv_summarization(): "taskName": "analyze 1", "kind": "ConversationalSummarizationTask", "parameters": { - "summaryAspects": ["Issue, Resolution"] + "summaryAspects": ["issue", "resolution"] } } ] diff --git a/sdk/cognitivelanguage/azure-ai-language-conversations/tests/recordings/test_conv_summarization.pyTestConversationalSummarizationtest_conversational_summarization.json b/sdk/cognitivelanguage/azure-ai-language-conversations/tests/recordings/test_conv_summarization.pyTestConversationalSummarizationtest_conversational_summarization.json index 3a55ce312e08..9374ff33c708 100644 --- a/sdk/cognitivelanguage/azure-ai-language-conversations/tests/recordings/test_conv_summarization.pyTestConversationalSummarizationtest_conversational_summarization.json +++ b/sdk/cognitivelanguage/azure-ai-language-conversations/tests/recordings/test_conv_summarization.pyTestConversationalSummarizationtest_conversational_summarization.json @@ -7,7 +7,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "Content-Length": "692", + "Content-Length": "694", "Content-Type": "application/json", "Ocp-Apim-Subscription-Key": "0000000000000000", "User-Agent": "azsdk-python-ai-language-conversations/1.1.0b3 Python/3.10.0 (Windows-10-10.0.22621-SP0)" @@ -49,7 +49,8 @@ "kind": "ConversationalSummarizationTask", "parameters": { "summaryAspects": [ - "Issue, Resolution" + "Issue", + "Resolution" ] } } @@ -57,18 +58,18 @@ }, "StatusCode": 202, "ResponseHeaders": { - "apim-request-id": "3f5270da-dc02-43b5-bc36-7e6644bdd1f2", + "apim-request-id": "e478e1ac-86a5-4933-b74c-5d63cc4f4e46", "Content-Length": "0", - "Date": "Mon, 17 Oct 2022 22:09:58 GMT", - "operation-location": "https://test-resource.api.cognitive.microsoft.com/language/analyze-conversations/jobs/2b72ef0f-d157-4f53-ad76-bcd05260cd0d?api-version=2022-10-01-preview", + "Date": "Thu, 20 Oct 2022 18:36:22 GMT", + "operation-location": "https://test-resource.api.cognitive.microsoft.com/language/analyze-conversations/jobs/0b58ae79-d45d-4dcf-9dbc-b527faf39ac5?api-version=2022-10-01-preview", "Strict-Transport-Security": "max-age=31536000; includeSubDomains; preload", "X-Content-Type-Options": "nosniff", - "x-envoy-upstream-service-time": "130" + "x-envoy-upstream-service-time": "293" }, "ResponseBody": null }, { - "RequestUri": "https://test-resource.api.cognitive.microsoft.com/language/analyze-conversations/jobs/2b72ef0f-d157-4f53-ad76-bcd05260cd0d?api-version=2022-10-01-preview", + "RequestUri": "https://test-resource.api.cognitive.microsoft.com/language/analyze-conversations/jobs/0b58ae79-d45d-4dcf-9dbc-b527faf39ac5?api-version=2022-10-01-preview", "RequestMethod": "GET", "RequestHeaders": { "Accept": "*/*", @@ -80,20 +81,20 @@ "RequestBody": null, "StatusCode": 200, "ResponseHeaders": { - "apim-request-id": "c67b4ae9-1818-4816-bba6-f3d51561763e", - "Content-Length": "330", + "apim-request-id": "426e5a8c-127b-442e-aec2-f1b566254997", + "Content-Length": "327", "Content-Type": "application/json; charset=utf-8", - "Date": "Mon, 17 Oct 2022 22:09:58 GMT", + "Date": "Thu, 20 Oct 2022 18:36:22 GMT", "Strict-Transport-Security": "max-age=31536000; includeSubDomains; preload", "X-Content-Type-Options": "nosniff", - "x-envoy-upstream-service-time": "8" + "x-envoy-upstream-service-time": "77" }, "ResponseBody": { - "jobId": "2b72ef0f-d157-4f53-ad76-bcd05260cd0d", - "lastUpdatedDateTime": "2022-10-17T22:09:59Z", - "createdDateTime": "2022-10-17T22:09:59Z", - "expirationDateTime": "2022-10-18T22:09:59Z", - "status": "notStarted", + "jobId": "0b58ae79-d45d-4dcf-9dbc-b527faf39ac5", + "lastUpdatedDateTime": "2022-10-20T18:36:22Z", + "createdDateTime": "2022-10-20T18:36:21Z", + "expirationDateTime": "2022-10-21T18:36:21Z", + "status": "running", "errors": [], "displayName": "Analyze conversations from xxx", "tasks": { @@ -106,7 +107,7 @@ } }, { - "RequestUri": "https://test-resource.api.cognitive.microsoft.com/language/analyze-conversations/jobs/2b72ef0f-d157-4f53-ad76-bcd05260cd0d?api-version=2022-10-01-preview", + "RequestUri": "https://test-resource.api.cognitive.microsoft.com/language/analyze-conversations/jobs/0b58ae79-d45d-4dcf-9dbc-b527faf39ac5?api-version=2022-10-01-preview", "RequestMethod": "GET", "RequestHeaders": { "Accept": "*/*", @@ -118,19 +119,19 @@ "RequestBody": null, "StatusCode": 200, "ResponseHeaders": { - "apim-request-id": "bba29e4f-29ec-4047-9963-98a34531598c", - "Content-Length": "807", + "apim-request-id": "7ab0f9f3-ddca-4c14-bcae-eb06f07934bc", + "Content-Length": "914", "Content-Type": "application/json; charset=utf-8", - "Date": "Mon, 17 Oct 2022 22:10:04 GMT", + "Date": "Thu, 20 Oct 2022 18:36:27 GMT", "Strict-Transport-Security": "max-age=31536000; includeSubDomains; preload", "X-Content-Type-Options": "nosniff", - "x-envoy-upstream-service-time": "31" + "x-envoy-upstream-service-time": "154" }, "ResponseBody": { - "jobId": "2b72ef0f-d157-4f53-ad76-bcd05260cd0d", - "lastUpdatedDateTime": "2022-10-17T22:10:00Z", - "createdDateTime": "2022-10-17T22:09:59Z", - "expirationDateTime": "2022-10-18T22:09:59Z", + "jobId": "0b58ae79-d45d-4dcf-9dbc-b527faf39ac5", + "lastUpdatedDateTime": "2022-10-20T18:36:25Z", + "createdDateTime": "2022-10-20T18:36:21Z", + "expirationDateTime": "2022-10-21T18:36:21Z", "status": "succeeded", "errors": [], "displayName": "Analyze conversations from xxx", @@ -143,36 +144,31 @@ { "kind": "conversationalSummarizationResults", "taskName": "analyze 1", - "lastUpdateDateTime": "2022-10-17T22:10:00.8411219Z", + "lastUpdateDateTime": "2022-10-20T18:36:25.082891Z", "status": "succeeded", "results": { "conversations": [ { - "summaries": [ + "summaries": [], + "id": "conversation1", + "warnings": [ + { + "code": "GenerationFailure", + "message": "Insufficient content to generate summary." + }, + { + "code": "GenerationFailure", + "message": "No relevant summary could be generated." + }, { - "aspect": "chapterTitle", - "text": "How to Upgrade Office", - "contexts": [ - { - "conversationItemId": "1", - "offset": 0, - "length": 26 - }, - { - "conversationItemId": "2", - "offset": 0, - "length": 65 - }, - { - "conversationItemId": "3", - "offset": 0, - "length": 74 - } - ] + "code": "GenerationFailure", + "message": "Insufficient content to generate summary." + }, + { + "code": "GenerationFailure", + "message": "No relevant summary could be generated." } - ], - "id": "conversation1", - "warnings": [] + ] } ], "errors": [], diff --git a/sdk/cognitivelanguage/azure-ai-language-conversations/tests/recordings/test_conv_summarization_async.pyTestConversationalSummarizationAsynctest_conversational_summarization.json b/sdk/cognitivelanguage/azure-ai-language-conversations/tests/recordings/test_conv_summarization_async.pyTestConversationalSummarizationAsynctest_conversational_summarization.json index 22ee40f6e5f1..d309724919b5 100644 --- a/sdk/cognitivelanguage/azure-ai-language-conversations/tests/recordings/test_conv_summarization_async.pyTestConversationalSummarizationAsynctest_conversational_summarization.json +++ b/sdk/cognitivelanguage/azure-ai-language-conversations/tests/recordings/test_conv_summarization_async.pyTestConversationalSummarizationAsynctest_conversational_summarization.json @@ -6,7 +6,7 @@ "RequestHeaders": { "Accept": "application/json", "Accept-Encoding": "gzip, deflate", - "Content-Length": "692", + "Content-Length": "694", "Content-Type": "application/json", "Ocp-Apim-Subscription-Key": "0000000000000000", "User-Agent": "azsdk-python-ai-language-conversations/1.1.0b3 Python/3.10.0 (Windows-10-10.0.22621-SP0)" @@ -48,7 +48,8 @@ "kind": "ConversationalSummarizationTask", "parameters": { "summaryAspects": [ - "Issue, Resolution" + "Issue", + "Resolution" ] } } @@ -56,18 +57,18 @@ }, "StatusCode": 202, "ResponseHeaders": { - "apim-request-id": "1a7d6c01-5e86-4cf1-8729-981ec07d1c2f", + "apim-request-id": "a08dbe88-1f66-40ee-8b30-2979bd3dc9df", "Content-Length": "0", - "Date": "Mon, 17 Oct 2022 22:10:04 GMT", - "operation-location": "https://test-resource.api.cognitive.microsoft.com/language/analyze-conversations/jobs/e3e2175e-8ff4-44bd-844c-69938cfafbb6?api-version=2022-10-01-preview", + "Date": "Thu, 20 Oct 2022 18:38:43 GMT", + "operation-location": "https://test-resource.api.cognitive.microsoft.com/language/analyze-conversations/jobs/24820f41-5551-46ee-b60c-52bf3677fa33?api-version=2022-10-01-preview", "Strict-Transport-Security": "max-age=31536000; includeSubDomains; preload", "X-Content-Type-Options": "nosniff", - "x-envoy-upstream-service-time": "106" + "x-envoy-upstream-service-time": "283" }, "ResponseBody": null }, { - "RequestUri": "https://test-resource.api.cognitive.microsoft.com/language/analyze-conversations/jobs/e3e2175e-8ff4-44bd-844c-69938cfafbb6?api-version=2022-10-01-preview", + "RequestUri": "https://test-resource.api.cognitive.microsoft.com/language/analyze-conversations/jobs/24820f41-5551-46ee-b60c-52bf3677fa33?api-version=2022-10-01-preview", "RequestMethod": "GET", "RequestHeaders": { "Accept": "*/*", @@ -78,20 +79,20 @@ "RequestBody": null, "StatusCode": 200, "ResponseHeaders": { - "apim-request-id": "62bff25e-a45d-420a-80b6-d3a171eb5a22", - "Content-Length": "330", + "apim-request-id": "51c64d4d-a54e-407e-bf69-627974880b48", + "Content-Length": "327", "Content-Type": "application/json; charset=utf-8", - "Date": "Mon, 17 Oct 2022 22:10:04 GMT", + "Date": "Thu, 20 Oct 2022 18:38:43 GMT", "Strict-Transport-Security": "max-age=31536000; includeSubDomains; preload", "X-Content-Type-Options": "nosniff", - "x-envoy-upstream-service-time": "8" + "x-envoy-upstream-service-time": "129" }, "ResponseBody": { - "jobId": "e3e2175e-8ff4-44bd-844c-69938cfafbb6", - "lastUpdatedDateTime": "2022-10-17T22:10:05Z", - "createdDateTime": "2022-10-17T22:10:04Z", - "expirationDateTime": "2022-10-18T22:10:04Z", - "status": "notStarted", + "jobId": "24820f41-5551-46ee-b60c-52bf3677fa33", + "lastUpdatedDateTime": "2022-10-20T18:38:44Z", + "createdDateTime": "2022-10-20T18:38:43Z", + "expirationDateTime": "2022-10-21T18:38:43Z", + "status": "running", "errors": [], "displayName": "Analyze conversations from xxx", "tasks": { @@ -104,7 +105,7 @@ } }, { - "RequestUri": "https://test-resource.api.cognitive.microsoft.com/language/analyze-conversations/jobs/e3e2175e-8ff4-44bd-844c-69938cfafbb6?api-version=2022-10-01-preview", + "RequestUri": "https://test-resource.api.cognitive.microsoft.com/language/analyze-conversations/jobs/24820f41-5551-46ee-b60c-52bf3677fa33?api-version=2022-10-01-preview", "RequestMethod": "GET", "RequestHeaders": { "Accept": "*/*", @@ -115,19 +116,19 @@ "RequestBody": null, "StatusCode": 200, "ResponseHeaders": { - "apim-request-id": "4c140fb4-1634-4d32-9e42-651eaa54ce85", - "Content-Length": "807", + "apim-request-id": "0969c98f-ed79-490e-95c3-d8572685354d", + "Content-Length": "915", "Content-Type": "application/json; charset=utf-8", - "Date": "Mon, 17 Oct 2022 22:10:10 GMT", + "Date": "Thu, 20 Oct 2022 18:38:49 GMT", "Strict-Transport-Security": "max-age=31536000; includeSubDomains; preload", "X-Content-Type-Options": "nosniff", - "x-envoy-upstream-service-time": "125" + "x-envoy-upstream-service-time": "140" }, "ResponseBody": { - "jobId": "e3e2175e-8ff4-44bd-844c-69938cfafbb6", - "lastUpdatedDateTime": "2022-10-17T22:10:06Z", - "createdDateTime": "2022-10-17T22:10:04Z", - "expirationDateTime": "2022-10-18T22:10:04Z", + "jobId": "24820f41-5551-46ee-b60c-52bf3677fa33", + "lastUpdatedDateTime": "2022-10-20T18:38:46Z", + "createdDateTime": "2022-10-20T18:38:43Z", + "expirationDateTime": "2022-10-21T18:38:43Z", "status": "succeeded", "errors": [], "displayName": "Analyze conversations from xxx", @@ -140,36 +141,31 @@ { "kind": "conversationalSummarizationResults", "taskName": "analyze 1", - "lastUpdateDateTime": "2022-10-17T22:10:06.6652137Z", + "lastUpdateDateTime": "2022-10-20T18:38:46.9365153Z", "status": "succeeded", "results": { "conversations": [ { - "summaries": [ + "summaries": [], + "id": "conversation1", + "warnings": [ + { + "code": "GenerationFailure", + "message": "Insufficient content to generate summary." + }, + { + "code": "GenerationFailure", + "message": "No relevant summary could be generated." + }, { - "aspect": "chapterTitle", - "text": "How to Upgrade Office", - "contexts": [ - { - "conversationItemId": "1", - "offset": 0, - "length": 26 - }, - { - "conversationItemId": "2", - "offset": 0, - "length": 65 - }, - { - "conversationItemId": "3", - "offset": 0, - "length": 74 - } - ] + "code": "GenerationFailure", + "message": "Insufficient content to generate summary." + }, + { + "code": "GenerationFailure", + "message": "No relevant summary could be generated." } - ], - "id": "conversation1", - "warnings": [] + ] } ], "errors": [], diff --git a/sdk/cognitivelanguage/azure-ai-language-conversations/tests/test_conv_summarization.py b/sdk/cognitivelanguage/azure-ai-language-conversations/tests/test_conv_summarization.py index c0cee5c7f3de..468f7fe01684 100644 --- a/sdk/cognitivelanguage/azure-ai-language-conversations/tests/test_conv_summarization.py +++ b/sdk/cognitivelanguage/azure-ai-language-conversations/tests/test_conv_summarization.py @@ -62,7 +62,7 @@ def test_conversational_summarization(self, recorded_test, conversation_creds): "taskName": "analyze 1", "kind": "ConversationalSummarizationTask", "parameters": { - "summaryAspects": ["Issue, Resolution"] + "summaryAspects": ["Issue", "Resolution"] } } ] diff --git a/sdk/cognitivelanguage/azure-ai-language-conversations/tests/test_conv_summarization_async.py b/sdk/cognitivelanguage/azure-ai-language-conversations/tests/test_conv_summarization_async.py index ffb7e28bc9dc..51139587652c 100644 --- a/sdk/cognitivelanguage/azure-ai-language-conversations/tests/test_conv_summarization_async.py +++ b/sdk/cognitivelanguage/azure-ai-language-conversations/tests/test_conv_summarization_async.py @@ -65,7 +65,7 @@ async def test_conversational_summarization(self, recorded_test, conversation_cr "taskName": "analyze 1", "kind": "ConversationalSummarizationTask", "parameters": { - "summaryAspects": ["Issue, Resolution"] + "summaryAspects": ["Issue", "Resolution"] } } ] From 5fd03095c9b6fd2c9f6523d50f861c5da1e1e395 Mon Sep 17 00:00:00 2001 From: Krista Pratico Date: Thu, 20 Oct 2022 12:33:36 -0700 Subject: [PATCH 2/4] skip tests and samples due to service regression --- scripts/devops_tasks/test_run_samples.py | 2 ++ .../tests/test_conv_summarization.py | 8 +++++++- .../tests/test_conv_summarization_async.py | 6 +++++- 3 files changed, 14 insertions(+), 2 deletions(-) diff --git a/scripts/devops_tasks/test_run_samples.py b/scripts/devops_tasks/test_run_samples.py index 1f1d36e1c90e..666cda2c4d15 100644 --- a/scripts/devops_tasks/test_run_samples.py +++ b/scripts/devops_tasks/test_run_samples.py @@ -136,6 +136,8 @@ "azure-ai-language-conversations": [ "sample_import_train_deploy_project_async.py", "sample_import_train_deploy_project.py", + "sample_conv_summarization.py", + "sample_conv_summarization_async.py" ], "azure-ai-textanalytics": [ "sample_analyze_healthcare_entities_with_cancellation.py", diff --git a/sdk/cognitivelanguage/azure-ai-language-conversations/tests/test_conv_summarization.py b/sdk/cognitivelanguage/azure-ai-language-conversations/tests/test_conv_summarization.py index 468f7fe01684..9a9a4143af08 100644 --- a/sdk/cognitivelanguage/azure-ai-language-conversations/tests/test_conv_summarization.py +++ b/sdk/cognitivelanguage/azure-ai-language-conversations/tests/test_conv_summarization.py @@ -3,6 +3,7 @@ # Copyright (c) Microsoft Corporation. # Licensed under the MIT License. # ------------------------------------ +import pytest from azure.ai.language.conversations import ConversationAnalysisClient from azure.core.credentials import AzureKeyCredential from devtools_testutils import AzureRecordedTestCase @@ -18,6 +19,7 @@ def test_polling_interval(self, conversation_creds): client = ConversationAnalysisClient(conversation_creds["endpoint"], AzureKeyCredential(conversation_creds["key"]), polling_interval=1) assert client._config.polling_interval == 1 + @pytest.mark.skip("Returning warnings instead of issue/resolutions in 2022-10-01-preview") def test_conversational_summarization(self, recorded_test, conversation_creds): # analyze query client = ConversationAnalysisClient( @@ -82,4 +84,8 @@ def test_conversational_summarization(self, recorded_test, conversation_creds): # assert - conv result conversation_result = task_result["results"]["conversations"][0] summaries = conversation_result["summaries"] - assert summaries is not None + assert summaries + for summary in summaries: + assert summary["aspect"] in ["issue", "resolution"] + assert summary["text"] + diff --git a/sdk/cognitivelanguage/azure-ai-language-conversations/tests/test_conv_summarization_async.py b/sdk/cognitivelanguage/azure-ai-language-conversations/tests/test_conv_summarization_async.py index 51139587652c..5b28767f5b1d 100644 --- a/sdk/cognitivelanguage/azure-ai-language-conversations/tests/test_conv_summarization_async.py +++ b/sdk/cognitivelanguage/azure-ai-language-conversations/tests/test_conv_summarization_async.py @@ -20,6 +20,7 @@ def test_polling_interval(self, conversation_creds): client = ConversationAnalysisClient(conversation_creds["endpoint"], AzureKeyCredential(conversation_creds["key"]), polling_interval=1) assert client._config.polling_interval == 1 + @pytest.mark.skip("Returning warnings instead of issue/resolutions in 2022-10-01-preview") @pytest.mark.asyncio async def test_conversational_summarization(self, recorded_test, conversation_creds): # analyze query @@ -85,4 +86,7 @@ async def test_conversational_summarization(self, recorded_test, conversation_cr # assert - conv result conversation_result = task_result["results"]["conversations"][0] summaries = conversation_result["summaries"] - assert summaries is not None + assert summaries + for summary in summaries: + assert summary["aspect"] in ["issue", "resolution"] + assert summary["text"] From 66ecdf328fcf71a9f017a61b0df18386303da79c Mon Sep 17 00:00:00 2001 From: Krista Pratico Date: Thu, 20 Oct 2022 12:37:40 -0700 Subject: [PATCH 3/4] missed async --- .../samples/async/sample_conv_summarization_async.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sdk/cognitivelanguage/azure-ai-language-conversations/samples/async/sample_conv_summarization_async.py b/sdk/cognitivelanguage/azure-ai-language-conversations/samples/async/sample_conv_summarization_async.py index 7694deed3c78..5cae22f75504 100644 --- a/sdk/cognitivelanguage/azure-ai-language-conversations/samples/async/sample_conv_summarization_async.py +++ b/sdk/cognitivelanguage/azure-ai-language-conversations/samples/async/sample_conv_summarization_async.py @@ -34,7 +34,7 @@ async def sample_conv_summarization_async(): endpoint = os.environ["AZURE_CONVERSATIONS_ENDPOINT"] key = os.environ["AZURE_CONVERSATIONS_KEY"] - # analyze quey + # analyze query client = ConversationAnalysisClient(endpoint, AzureKeyCredential(key)) async with client: poller = await client.begin_conversation_analysis( @@ -74,7 +74,7 @@ async def sample_conv_summarization_async(): "taskName": "analyze 1", "kind": "ConversationalSummarizationTask", "parameters": { - "summaryAspects": ["Issue, Resolution"] + "summaryAspects": ["issue", "resolution"] } } ] From 90fbd8134889449c1fbfab5f318a28c0b5632f47 Mon Sep 17 00:00:00 2001 From: Krista Pratico Date: Thu, 20 Oct 2022 17:23:39 -0700 Subject: [PATCH 4/4] account for role --- scripts/devops_tasks/test_run_samples.py | 2 - .../async/sample_conv_summarization_async.py | 3 + .../samples/sample_conv_summarization.py | 3 + ...tiontest_conversational_summarization.json | 80 +++++++++---------- ...synctest_conversational_summarization.json | 76 +++++++++--------- .../tests/test_conv_summarization.py | 4 +- .../tests/test_conv_summarization_async.py | 4 +- 7 files changed, 88 insertions(+), 84 deletions(-) diff --git a/scripts/devops_tasks/test_run_samples.py b/scripts/devops_tasks/test_run_samples.py index 666cda2c4d15..1f1d36e1c90e 100644 --- a/scripts/devops_tasks/test_run_samples.py +++ b/scripts/devops_tasks/test_run_samples.py @@ -136,8 +136,6 @@ "azure-ai-language-conversations": [ "sample_import_train_deploy_project_async.py", "sample_import_train_deploy_project.py", - "sample_conv_summarization.py", - "sample_conv_summarization_async.py" ], "azure-ai-textanalytics": [ "sample_analyze_healthcare_entities_with_cancellation.py", diff --git a/sdk/cognitivelanguage/azure-ai-language-conversations/samples/async/sample_conv_summarization_async.py b/sdk/cognitivelanguage/azure-ai-language-conversations/samples/async/sample_conv_summarization_async.py index 5cae22f75504..d636416c4409 100644 --- a/sdk/cognitivelanguage/azure-ai-language-conversations/samples/async/sample_conv_summarization_async.py +++ b/sdk/cognitivelanguage/azure-ai-language-conversations/samples/async/sample_conv_summarization_async.py @@ -48,18 +48,21 @@ async def sample_conv_summarization_async(): "text": "Hello, how can I help you?", "modality": "text", "id": "1", + "role": "Agent", "participantId": "Agent" }, { "text": "How to upgrade Office? I am getting error messages the whole day.", "modality": "text", "id": "2", + "role": "Customer", "participantId": "Customer" }, { "text": "Press the upgrade button please. Then sign in and follow the instructions.", "modality": "text", "id": "3", + "role": "Agent", "participantId": "Agent" } ], diff --git a/sdk/cognitivelanguage/azure-ai-language-conversations/samples/sample_conv_summarization.py b/sdk/cognitivelanguage/azure-ai-language-conversations/samples/sample_conv_summarization.py index 6f7972b8fb4f..862e549a8095 100644 --- a/sdk/cognitivelanguage/azure-ai-language-conversations/samples/sample_conv_summarization.py +++ b/sdk/cognitivelanguage/azure-ai-language-conversations/samples/sample_conv_summarization.py @@ -46,18 +46,21 @@ def sample_conv_summarization(): "text": "Hello, how can I help you?", "modality": "text", "id": "1", + "role": "Agent", "participantId": "Agent" }, { "text": "How to upgrade Office? I am getting error messages the whole day.", "modality": "text", "id": "2", + "role": "Customer", "participantId": "Customer" }, { "text": "Press the upgrade button please. Then sign in and follow the instructions.", "modality": "text", "id": "3", + "role": "Agent", "participantId": "Agent" } ], diff --git a/sdk/cognitivelanguage/azure-ai-language-conversations/tests/recordings/test_conv_summarization.pyTestConversationalSummarizationtest_conversational_summarization.json b/sdk/cognitivelanguage/azure-ai-language-conversations/tests/recordings/test_conv_summarization.pyTestConversationalSummarizationtest_conversational_summarization.json index 9374ff33c708..29c452350523 100644 --- a/sdk/cognitivelanguage/azure-ai-language-conversations/tests/recordings/test_conv_summarization.pyTestConversationalSummarizationtest_conversational_summarization.json +++ b/sdk/cognitivelanguage/azure-ai-language-conversations/tests/recordings/test_conv_summarization.pyTestConversationalSummarizationtest_conversational_summarization.json @@ -7,7 +7,7 @@ "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "Content-Length": "694", + "Content-Length": "748", "Content-Type": "application/json", "Ocp-Apim-Subscription-Key": "0000000000000000", "User-Agent": "azsdk-python-ai-language-conversations/1.1.0b3 Python/3.10.0 (Windows-10-10.0.22621-SP0)" @@ -22,18 +22,21 @@ "text": "Hello, how can I help you?", "modality": "text", "id": "1", + "role": "Agent", "participantId": "Agent" }, { "text": "How to upgrade Office? I am getting error messages the whole day.", "modality": "text", "id": "2", + "role": "Customer", "participantId": "Customer" }, { "text": "Press the upgrade button please. Then sign in and follow the instructions.", "modality": "text", "id": "3", + "role": "Agent", "participantId": "Agent" } ], @@ -58,18 +61,19 @@ }, "StatusCode": 202, "ResponseHeaders": { - "apim-request-id": "e478e1ac-86a5-4933-b74c-5d63cc4f4e46", + "apim-request-id": "2e91b606-9082-496b-a546-dbdebd082072", "Content-Length": "0", - "Date": "Thu, 20 Oct 2022 18:36:22 GMT", - "operation-location": "https://test-resource.api.cognitive.microsoft.com/language/analyze-conversations/jobs/0b58ae79-d45d-4dcf-9dbc-b527faf39ac5?api-version=2022-10-01-preview", + "Date": "Fri, 21 Oct 2022 00:17:28 GMT", + "operation-location": "https://test-resource.api.cognitive.microsoft.com/language/analyze-conversations/jobs/64be3414-83c9-4105-ab1c-4bb1350d2e19?api-version=2022-10-01-preview", "Strict-Transport-Security": "max-age=31536000; includeSubDomains; preload", "X-Content-Type-Options": "nosniff", - "x-envoy-upstream-service-time": "293" + "x-envoy-upstream-service-time": "144", + "x-ms-region": "UK South" }, "ResponseBody": null }, { - "RequestUri": "https://test-resource.api.cognitive.microsoft.com/language/analyze-conversations/jobs/0b58ae79-d45d-4dcf-9dbc-b527faf39ac5?api-version=2022-10-01-preview", + "RequestUri": "https://test-resource.api.cognitive.microsoft.com/language/analyze-conversations/jobs/64be3414-83c9-4105-ab1c-4bb1350d2e19?api-version=2022-10-01-preview", "RequestMethod": "GET", "RequestHeaders": { "Accept": "*/*", @@ -81,20 +85,21 @@ "RequestBody": null, "StatusCode": 200, "ResponseHeaders": { - "apim-request-id": "426e5a8c-127b-442e-aec2-f1b566254997", - "Content-Length": "327", + "apim-request-id": "947ee134-b200-4631-8e79-c42b208b53cb", + "Content-Length": "330", "Content-Type": "application/json; charset=utf-8", - "Date": "Thu, 20 Oct 2022 18:36:22 GMT", + "Date": "Fri, 21 Oct 2022 00:17:28 GMT", "Strict-Transport-Security": "max-age=31536000; includeSubDomains; preload", "X-Content-Type-Options": "nosniff", - "x-envoy-upstream-service-time": "77" + "x-envoy-upstream-service-time": "13", + "x-ms-region": "UK South" }, "ResponseBody": { - "jobId": "0b58ae79-d45d-4dcf-9dbc-b527faf39ac5", - "lastUpdatedDateTime": "2022-10-20T18:36:22Z", - "createdDateTime": "2022-10-20T18:36:21Z", - "expirationDateTime": "2022-10-21T18:36:21Z", - "status": "running", + "jobId": "64be3414-83c9-4105-ab1c-4bb1350d2e19", + "lastUpdatedDateTime": "2022-10-21T00:17:28Z", + "createdDateTime": "2022-10-21T00:17:28Z", + "expirationDateTime": "2022-10-22T00:17:28Z", + "status": "notStarted", "errors": [], "displayName": "Analyze conversations from xxx", "tasks": { @@ -107,7 +112,7 @@ } }, { - "RequestUri": "https://test-resource.api.cognitive.microsoft.com/language/analyze-conversations/jobs/0b58ae79-d45d-4dcf-9dbc-b527faf39ac5?api-version=2022-10-01-preview", + "RequestUri": "https://test-resource.api.cognitive.microsoft.com/language/analyze-conversations/jobs/64be3414-83c9-4105-ab1c-4bb1350d2e19?api-version=2022-10-01-preview", "RequestMethod": "GET", "RequestHeaders": { "Accept": "*/*", @@ -119,19 +124,20 @@ "RequestBody": null, "StatusCode": 200, "ResponseHeaders": { - "apim-request-id": "7ab0f9f3-ddca-4c14-bcae-eb06f07934bc", - "Content-Length": "914", + "apim-request-id": "ade6d7d8-8304-4cae-9d0d-1fcf441eafa0", + "Content-Length": "801", "Content-Type": "application/json; charset=utf-8", - "Date": "Thu, 20 Oct 2022 18:36:27 GMT", + "Date": "Fri, 21 Oct 2022 00:17:33 GMT", "Strict-Transport-Security": "max-age=31536000; includeSubDomains; preload", "X-Content-Type-Options": "nosniff", - "x-envoy-upstream-service-time": "154" + "x-envoy-upstream-service-time": "211", + "x-ms-region": "UK South" }, "ResponseBody": { - "jobId": "0b58ae79-d45d-4dcf-9dbc-b527faf39ac5", - "lastUpdatedDateTime": "2022-10-20T18:36:25Z", - "createdDateTime": "2022-10-20T18:36:21Z", - "expirationDateTime": "2022-10-21T18:36:21Z", + "jobId": "64be3414-83c9-4105-ab1c-4bb1350d2e19", + "lastUpdatedDateTime": "2022-10-21T00:17:31Z", + "createdDateTime": "2022-10-21T00:17:28Z", + "expirationDateTime": "2022-10-22T00:17:28Z", "status": "succeeded", "errors": [], "displayName": "Analyze conversations from xxx", @@ -144,31 +150,23 @@ { "kind": "conversationalSummarizationResults", "taskName": "analyze 1", - "lastUpdateDateTime": "2022-10-20T18:36:25.082891Z", + "lastUpdateDateTime": "2022-10-21T00:17:31.3219791Z", "status": "succeeded", "results": { "conversations": [ { - "summaries": [], - "id": "conversation1", - "warnings": [ - { - "code": "GenerationFailure", - "message": "Insufficient content to generate summary." - }, + "summaries": [ { - "code": "GenerationFailure", - "message": "No relevant summary could be generated." + "aspect": "issue", + "text": "Customer wants to upgrade Office. | Customer is getting error messages." }, { - "code": "GenerationFailure", - "message": "Insufficient content to generate summary." - }, - { - "code": "GenerationFailure", - "message": "No relevant summary could be generated." + "aspect": "resolution", + "text": "Advised to press the upgrade button. | Then sign in and follow the instructions." } - ] + ], + "id": "conversation1", + "warnings": [] } ], "errors": [], diff --git a/sdk/cognitivelanguage/azure-ai-language-conversations/tests/recordings/test_conv_summarization_async.pyTestConversationalSummarizationAsynctest_conversational_summarization.json b/sdk/cognitivelanguage/azure-ai-language-conversations/tests/recordings/test_conv_summarization_async.pyTestConversationalSummarizationAsynctest_conversational_summarization.json index d309724919b5..69d8e9b3a335 100644 --- a/sdk/cognitivelanguage/azure-ai-language-conversations/tests/recordings/test_conv_summarization_async.pyTestConversationalSummarizationAsynctest_conversational_summarization.json +++ b/sdk/cognitivelanguage/azure-ai-language-conversations/tests/recordings/test_conv_summarization_async.pyTestConversationalSummarizationAsynctest_conversational_summarization.json @@ -6,7 +6,7 @@ "RequestHeaders": { "Accept": "application/json", "Accept-Encoding": "gzip, deflate", - "Content-Length": "694", + "Content-Length": "748", "Content-Type": "application/json", "Ocp-Apim-Subscription-Key": "0000000000000000", "User-Agent": "azsdk-python-ai-language-conversations/1.1.0b3 Python/3.10.0 (Windows-10-10.0.22621-SP0)" @@ -21,18 +21,21 @@ "text": "Hello, how can I help you?", "modality": "text", "id": "1", + "role": "Agent", "participantId": "Agent" }, { "text": "How to upgrade Office? I am getting error messages the whole day.", "modality": "text", "id": "2", + "role": "Customer", "participantId": "Customer" }, { "text": "Press the upgrade button please. Then sign in and follow the instructions.", "modality": "text", "id": "3", + "role": "Agent", "participantId": "Agent" } ], @@ -57,18 +60,19 @@ }, "StatusCode": 202, "ResponseHeaders": { - "apim-request-id": "a08dbe88-1f66-40ee-8b30-2979bd3dc9df", + "apim-request-id": "3d00d1be-725b-4085-aeef-8706172170aa", "Content-Length": "0", - "Date": "Thu, 20 Oct 2022 18:38:43 GMT", - "operation-location": "https://test-resource.api.cognitive.microsoft.com/language/analyze-conversations/jobs/24820f41-5551-46ee-b60c-52bf3677fa33?api-version=2022-10-01-preview", + "Date": "Fri, 21 Oct 2022 00:22:11 GMT", + "operation-location": "https://test-resource.api.cognitive.microsoft.com/language/analyze-conversations/jobs/c8f4cff3-2d78-4427-9668-c7b84897746b?api-version=2022-10-01-preview", "Strict-Transport-Security": "max-age=31536000; includeSubDomains; preload", "X-Content-Type-Options": "nosniff", - "x-envoy-upstream-service-time": "283" + "x-envoy-upstream-service-time": "342", + "x-ms-region": "UK South" }, "ResponseBody": null }, { - "RequestUri": "https://test-resource.api.cognitive.microsoft.com/language/analyze-conversations/jobs/24820f41-5551-46ee-b60c-52bf3677fa33?api-version=2022-10-01-preview", + "RequestUri": "https://test-resource.api.cognitive.microsoft.com/language/analyze-conversations/jobs/c8f4cff3-2d78-4427-9668-c7b84897746b?api-version=2022-10-01-preview", "RequestMethod": "GET", "RequestHeaders": { "Accept": "*/*", @@ -79,19 +83,20 @@ "RequestBody": null, "StatusCode": 200, "ResponseHeaders": { - "apim-request-id": "51c64d4d-a54e-407e-bf69-627974880b48", + "apim-request-id": "8194cf1a-303a-4e06-bd2e-7f0fa8ed6da1", "Content-Length": "327", "Content-Type": "application/json; charset=utf-8", - "Date": "Thu, 20 Oct 2022 18:38:43 GMT", + "Date": "Fri, 21 Oct 2022 00:22:11 GMT", "Strict-Transport-Security": "max-age=31536000; includeSubDomains; preload", "X-Content-Type-Options": "nosniff", - "x-envoy-upstream-service-time": "129" + "x-envoy-upstream-service-time": "79", + "x-ms-region": "UK South" }, "ResponseBody": { - "jobId": "24820f41-5551-46ee-b60c-52bf3677fa33", - "lastUpdatedDateTime": "2022-10-20T18:38:44Z", - "createdDateTime": "2022-10-20T18:38:43Z", - "expirationDateTime": "2022-10-21T18:38:43Z", + "jobId": "c8f4cff3-2d78-4427-9668-c7b84897746b", + "lastUpdatedDateTime": "2022-10-21T00:22:11Z", + "createdDateTime": "2022-10-21T00:22:11Z", + "expirationDateTime": "2022-10-22T00:22:11Z", "status": "running", "errors": [], "displayName": "Analyze conversations from xxx", @@ -105,7 +110,7 @@ } }, { - "RequestUri": "https://test-resource.api.cognitive.microsoft.com/language/analyze-conversations/jobs/24820f41-5551-46ee-b60c-52bf3677fa33?api-version=2022-10-01-preview", + "RequestUri": "https://test-resource.api.cognitive.microsoft.com/language/analyze-conversations/jobs/c8f4cff3-2d78-4427-9668-c7b84897746b?api-version=2022-10-01-preview", "RequestMethod": "GET", "RequestHeaders": { "Accept": "*/*", @@ -116,19 +121,20 @@ "RequestBody": null, "StatusCode": 200, "ResponseHeaders": { - "apim-request-id": "0969c98f-ed79-490e-95c3-d8572685354d", - "Content-Length": "915", + "apim-request-id": "50c389a6-b9f7-4467-aa23-549c0195c664", + "Content-Length": "801", "Content-Type": "application/json; charset=utf-8", - "Date": "Thu, 20 Oct 2022 18:38:49 GMT", + "Date": "Fri, 21 Oct 2022 00:22:17 GMT", "Strict-Transport-Security": "max-age=31536000; includeSubDomains; preload", "X-Content-Type-Options": "nosniff", - "x-envoy-upstream-service-time": "140" + "x-envoy-upstream-service-time": "192", + "x-ms-region": "UK South" }, "ResponseBody": { - "jobId": "24820f41-5551-46ee-b60c-52bf3677fa33", - "lastUpdatedDateTime": "2022-10-20T18:38:46Z", - "createdDateTime": "2022-10-20T18:38:43Z", - "expirationDateTime": "2022-10-21T18:38:43Z", + "jobId": "c8f4cff3-2d78-4427-9668-c7b84897746b", + "lastUpdatedDateTime": "2022-10-21T00:22:14Z", + "createdDateTime": "2022-10-21T00:22:11Z", + "expirationDateTime": "2022-10-22T00:22:11Z", "status": "succeeded", "errors": [], "displayName": "Analyze conversations from xxx", @@ -141,31 +147,23 @@ { "kind": "conversationalSummarizationResults", "taskName": "analyze 1", - "lastUpdateDateTime": "2022-10-20T18:38:46.9365153Z", + "lastUpdateDateTime": "2022-10-21T00:22:14.6247374Z", "status": "succeeded", "results": { "conversations": [ { - "summaries": [], - "id": "conversation1", - "warnings": [ - { - "code": "GenerationFailure", - "message": "Insufficient content to generate summary." - }, + "summaries": [ { - "code": "GenerationFailure", - "message": "No relevant summary could be generated." + "aspect": "issue", + "text": "Customer wants to upgrade Office. | Customer is getting error messages." }, { - "code": "GenerationFailure", - "message": "Insufficient content to generate summary." - }, - { - "code": "GenerationFailure", - "message": "No relevant summary could be generated." + "aspect": "resolution", + "text": "Advised to press the upgrade button. | Then sign in and follow the instructions." } - ] + ], + "id": "conversation1", + "warnings": [] } ], "errors": [], diff --git a/sdk/cognitivelanguage/azure-ai-language-conversations/tests/test_conv_summarization.py b/sdk/cognitivelanguage/azure-ai-language-conversations/tests/test_conv_summarization.py index 9a9a4143af08..0eab268cee24 100644 --- a/sdk/cognitivelanguage/azure-ai-language-conversations/tests/test_conv_summarization.py +++ b/sdk/cognitivelanguage/azure-ai-language-conversations/tests/test_conv_summarization.py @@ -19,7 +19,6 @@ def test_polling_interval(self, conversation_creds): client = ConversationAnalysisClient(conversation_creds["endpoint"], AzureKeyCredential(conversation_creds["key"]), polling_interval=1) assert client._config.polling_interval == 1 - @pytest.mark.skip("Returning warnings instead of issue/resolutions in 2022-10-01-preview") def test_conversational_summarization(self, recorded_test, conversation_creds): # analyze query client = ConversationAnalysisClient( @@ -38,18 +37,21 @@ def test_conversational_summarization(self, recorded_test, conversation_creds): "text": "Hello, how can I help you?", "modality": "text", "id": "1", + "role": "Agent", "participantId": "Agent" }, { "text": "How to upgrade Office? I am getting error messages the whole day.", "modality": "text", "id": "2", + "role": "Customer", "participantId": "Customer" }, { "text": "Press the upgrade button please. Then sign in and follow the instructions.", "modality": "text", "id": "3", + "role": "Agent", "participantId": "Agent" } ], diff --git a/sdk/cognitivelanguage/azure-ai-language-conversations/tests/test_conv_summarization_async.py b/sdk/cognitivelanguage/azure-ai-language-conversations/tests/test_conv_summarization_async.py index 5b28767f5b1d..c84d6a000ca3 100644 --- a/sdk/cognitivelanguage/azure-ai-language-conversations/tests/test_conv_summarization_async.py +++ b/sdk/cognitivelanguage/azure-ai-language-conversations/tests/test_conv_summarization_async.py @@ -20,7 +20,6 @@ def test_polling_interval(self, conversation_creds): client = ConversationAnalysisClient(conversation_creds["endpoint"], AzureKeyCredential(conversation_creds["key"]), polling_interval=1) assert client._config.polling_interval == 1 - @pytest.mark.skip("Returning warnings instead of issue/resolutions in 2022-10-01-preview") @pytest.mark.asyncio async def test_conversational_summarization(self, recorded_test, conversation_creds): # analyze query @@ -40,18 +39,21 @@ async def test_conversational_summarization(self, recorded_test, conversation_cr "text": "Hello, how can I help you?", "modality": "text", "id": "1", + "role": "Agent", "participantId": "Agent" }, { "text": "How to upgrade Office? I am getting error messages the whole day.", "modality": "text", "id": "2", + "role": "Customer", "participantId": "Customer" }, { "text": "Press the upgrade button please. Then sign in and follow the instructions.", "modality": "text", "id": "3", + "role": "Agent", "participantId": "Agent" } ],