Skip to content
Merged
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
## 1.1.0b1 (Unreleased)
Comment thread
mshaban-msft marked this conversation as resolved.
Outdated

### Features Added
* Conversation issue summarization task (Long-running operation)
* Conversation summarization task (Long-running operation)
* Conversation PII extraction task (Long-running operation)

### Breaking Changes
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
Conversational Language Understanding - aka **CLU** for short - is a cloud-based conversational AI service which provides many language understanding capabilities like:
- Conversation App: It's used in extracting intents and entities in conversations
- Workflow app: Acts like an orchestrator to select the best candidate to analyze conversations to get best response from apps like Qna, Luis, and Conversation App
- Conversational Issue Summarization: Used to summarize conversations in the form of issues, and final resolutions
- Conversational Summarization: Used to summarize conversations in the form of issues, and final resolutions
- Conversational PII: Used to extract and redact personally-identifiable info (PII)

[Source code][conversationallanguage_client_src] | [Package (PyPI)][conversationallanguage_pypi_package] | [API reference documentation][api_reference_documentation] | [Product documentation][conversationallanguage_docs] | [Samples][conversationallanguage_samples]
Expand Down Expand Up @@ -200,7 +200,7 @@ if top_intent_object["targetProjectKind"] == "Luis":

```

### Conversational Issue Summarization
### Conversational Summarization

You can use this sample if you need to summarize a conversation in the form of an issue, and final resolution. For example, a dialog from tech support:

Expand Down Expand Up @@ -267,13 +267,13 @@ with client:
task_result = result["tasks"]["items"][0]
print("... view task status ...")
print("status: {}".format(task_result["status"]))
issue_resolution_result = task_result["results"]
if issue_resolution_result["errors"]:
resolution_result = task_result["results"]
if resolution_result["errors"]:
print("... errors occured ...")
for error in issue_resolution_result["errors"]:
for error in resolution_result["errors"]:
print(error)
else:
conversation_result = issue_resolution_result["conversations"][0]
conversation_result = resolution_result["conversations"][0]
if conversation_result["warnings"]:
print("... view warnings ...")
for warning in conversation_result["warnings"]:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,94 @@

Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize
"""
from typing import List
from typing import List, MutableMapping
from async_timeout import Any
JSON = MutableMapping[str, Any] # pylint: disable=unsubscriptable-object

__all__: List[str] = [] # Add all objects you want publicly available to users at this package level
from azure.core.tracing.decorator import distributed_trace

from ._operations import ConversationAnalysisClientOperationsMixin as ConversationAnalysisClientOperationsMixinGenerated

class ConversationAnalysisClientOperationsMixin(ConversationAnalysisClientOperationsMixinGenerated):
@distributed_trace
def analyze_conversation(
self,
task: JSON,
**kwargs: Any
) -> JSON:
"""Analyzes the input conversation utterance.

:param task: A single conversational task to execute.
:type task: JSON
:return: JSON object
:rtype: JSON
:raises: ~azure.core.exceptions.HttpResponseError

Example:
.. code-block:: python

kind = 'Conversation'

# JSON input template you can fill out and use as your body input.
task = {
"kind": "Conversation",
"analysisInput": {
"conversationItem": {
"id": "",
"participantId": "",
"modality": "text",
"language": "",
"text": ""
}
},
"parameters": {
"projectName": "",
"deploymentName": "",
}
}

# response body for status code(s): 200
response.json() == {
"kind": "ConversationResult",
"result": {
"query": "",
"prediction": {
"topIntent": "",
"projectKind": "Conversation",
"intents": [
{
"category": "",
"confidenceScore": 1
},
{
"category": "",
"confidenceScore": 0
},
{
"category": "",
"confidenceScore": 0
}
],
"entities": [
{
"category": "",
"text": "",
"offset": 29,
"length": 12,
"confidenceScore": 1
}
]
}
}
}
"""
task["parameters"]["stringIndexType"] = "UnicodeCodePoint"
return super().analyze_conversation(task, **kwargs)


__all__: List[str] = [
"ConversationAnalysisClientOperationsMixin"
] # Add all objects you want publicly available to users at this package level

def patch_sdk():
"""Do not remove from this file.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,94 @@

Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize
"""
from typing import List
from typing import List, MutableMapping
from async_timeout import Any
JSON = MutableMapping[str, Any] # pylint: disable=unsubscriptable-object

__all__: List[str] = [] # Add all objects you want publicly available to users at this package level
from azure.core.tracing.decorator import distributed_trace

from ._operations import ConversationAnalysisClientOperationsMixin as ConversationAnalysisClientOperationsMixinGenerated

class ConversationAnalysisClientOperationsMixin(ConversationAnalysisClientOperationsMixinGenerated):
@distributed_trace
async def analyze_conversation(
self,
task: JSON,
**kwargs: Any
) -> JSON:
"""Analyzes the input conversation utterance.

:param task: A single conversational task to execute.
:type task: JSON
:return: JSON object
:rtype: JSON
:raises: ~azure.core.exceptions.HttpResponseError

Example:
.. code-block:: python

kind = 'Conversation'

# JSON input template you can fill out and use as your body input.
task = {
"kind": "Conversation",
"analysisInput": {
"conversationItem": {
"id": "",
"participantId": "",
"modality": "text",
"language": "",
"text": ""
}
},
"parameters": {
"projectName": "",
"deploymentName": "",
}
}

# response body for status code(s): 200
response.json() == {
"kind": "ConversationResult",
"result": {
"query": "",
"prediction": {
"topIntent": "",
"projectKind": "Conversation",
"intents": [
{
"category": "",
"confidenceScore": 1
},
{
"category": "",
"confidenceScore": 0
},
{
"category": "",
"confidenceScore": 0
}
],
"entities": [
{
"category": "",
"text": "",
"offset": 29,
"length": 12,
"confidenceScore": 1
}
]
}
}
}
"""
task["parameters"]["stringIndexType"] = "UnicodeCodePoint"
return await super().analyze_conversation(task, **kwargs)


__all__: List[str] = [
"ConversationAnalysisClientOperationsMixin"
] # Add all objects you want publicly available to users at this package level

def patch_sdk():
"""Do not remove from this file.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ languages:
products:
- azure
- azure-cognitive-services
- azure-ai-language-understanding
- azure-language-service
urlFragment: conversationslanguageunderstanding-samples
---

Expand All @@ -25,7 +25,7 @@ These sample programs show common scenarios for the Conversational Language Unde
| [sample_analyze_orchestration_app_conv_response.py][sample_analyze_orchestration_app_conv_response] and [sample_analyze_orchestration_app_conv_response_async.py][sample_analyze_orchestration_app_conv_response_async]| Analyze user utterance using an orchestration project, which selects the best candidate from one of your different apps to analyze user query (ex: Qna, Conversation, and Luis). In this case, it uses a conversation project. |
| [sample_analyze_orchestration_app_luis_response.py][sample_analyze_orchestration_app_luis_response] and [sample_analyze_orchestration_app_luis_response_async.py][sample_analyze_orchestration_app_luis_response_async]| Analyze user utterance using an orchestration project, which selects the best candidate from one of your different apps to analyze user query (ex: Qna, Conversation, and Luis). In this case, it uses a Luis project. |
| [sample_analyze_orchestration_app_qna_response.py][sample_analyze_orchestration_app_qna_response] and [sample_analyze_orchestration_app_qna_response_async.py][sample_analyze_orchestration_app_qna_response_async]| Analyze user utterance using an orchestration project, which selects the best candidate from one of your different apps to analyze user query (ex: Qna, Conversation, and Luis). In this case, it uses a Qna project. |
| [sample_conv_issue_summarization.py][sample_conv_issue_summarization] and [sample_conv_issue_summarization_async.py][sample_conv_issue_summarization_async]| Summarize conversation in the form of issues and resolutions (ex: tech support conversation) |
| [sample_conv_summarization.py][sample_conv_summarization] and [sample_conv_summarization_async.py][sample_conv_summarization_async]| Summarize conversation in the form of issues and resolutions (ex: tech support conversation) |
| [sample_conv_pii_transcript_input.py][sample_conv_pii_transcript_input] and [sample_conv_pii_transcript_input_async.py][sample_conv_pii_transcript_input_async]| Extract and redact personally-identifiable info from/in conversations |

## Prerequisites
Expand Down Expand Up @@ -79,8 +79,8 @@ what you can do with the Azure Conversational Language Understanding client libr
[sample_analyze_orchestration_app_qna_response]: https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/cognitivelanguage/azure-ai-language-conversations/samples/sample_analyze_orchestration_app_qna_response.py
[sample_analyze_orchestration_app_qna_response_async]: https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/cognitivelanguage/azure-ai-language-conversations/samples/async/sample_analyze_orchestration_app_qna_response_async.py

[sample_conv_issue_summarization]: https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/cognitivelanguage/azure-ai-language-conversations/samples/sample_conv_issue_summarization.py
[sample_conv_issue_summarization_async]: https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/cognitivelanguage/azure-ai-language-conversations/samples/async/sample_conv_issue_summarization_async.py
[sample_conv_summarization]: https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/cognitivelanguage/azure-ai-language-conversations/samples/sample_conv_summarization.py
[sample_conv_summarization_async]: https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/cognitivelanguage/azure-ai-language-conversations/samples/async/sample_conv_summarization_async.py

[sample_conv_pii_transcript_input]: https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/cognitivelanguage/azure-ai-language-conversations/samples/sample_conv_pii_transcript_input.py
[sample_conv_pii_transcript_input_async]: https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/cognitivelanguage/azure-ai-language-conversations/samples/async/sample_conv_pii_transcript_input_async.py
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,15 @@
# ------------------------------------

"""
FILE: sample_conv_issue_summarization_async.py
FILE: sample_conv_summarization_async.py

DESCRIPTION:
This sample demonstrates how to analyze a conversation for issue resolution.

For more info about how to setup a CLU conversation project, see the README.

USAGE:
python sample_conv_issue_summarization_async.py
python sample_conv_summarization_async.py

Set the environment variables with your own values before running the sample:
1) AZURE_CONVERSATIONS_ENDPOINT - endpoint for your CLU resource.
Expand All @@ -22,7 +22,7 @@

import asyncio

async def sample_conv_issue_summarization_async():
async def sample_conv_summarization_async():
# [START analyze_conversation_app]
# import libraries
import os
Expand Down Expand Up @@ -86,13 +86,13 @@ async def sample_conv_issue_summarization_async():
task_result = result["tasks"]["items"][0]
print("... view task status ...")
print("status: {}".format(task_result["status"]))
issue_resolution_result = task_result["results"]
if issue_resolution_result["errors"]:
resolution_result = task_result["results"]
if resolution_result["errors"]:
print("... errors occured ...")
for error in issue_resolution_result["errors"]:
for error in resolution_result["errors"]:
print(error)
else:
conversation_result = issue_resolution_result["conversations"][0]
conversation_result = resolution_result["conversations"][0]
if conversation_result["warnings"]:
print("... view warnings ...")
for warning in conversation_result["warnings"]:
Expand All @@ -107,7 +107,7 @@ async def sample_conv_issue_summarization_async():


async def main():
await sample_conv_issue_summarization_async()
await sample_conv_summarization_async()

if __name__ == '__main__':
loop = asyncio.get_event_loop()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,22 +5,22 @@
# ------------------------------------

"""
FILE: sample_conv_issue_summarization.py
FILE: sample_conv_summarization.py

DESCRIPTION:
This sample demonstrates how to analyze a conversation for issue resolution.

For more info about how to setup a CLU conversation project, see the README.

USAGE:
python sample_conv_issue_summarization.py
python sample_conv_summarization.py

Set the environment variables with your own values before running the sample:
1) AZURE_CONVERSATIONS_ENDPOINT - endpoint for your CLU resource.
2) AZURE_CONVERSATIONS_KEY - API key for your CLU resource.
"""

def sample_conv_issue_summarization():
def sample_conv_summarization():
# [START analyze_conversation_app]
# import libraries
import os
Expand Down Expand Up @@ -84,13 +84,13 @@ def sample_conv_issue_summarization():
task_result = result["tasks"]["items"][0]
print("... view task status ...")
print("status: {}".format(task_result["status"]))
issue_resolution_result = task_result["results"]
if issue_resolution_result["errors"]:
resolution_result = task_result["results"]
if resolution_result["errors"]:
print("... errors occured ...")
for error in issue_resolution_result["errors"]:
for error in resolution_result["errors"]:
print(error)
else:
conversation_result = issue_resolution_result["conversations"][0]
conversation_result = resolution_result["conversations"][0]
if conversation_result["warnings"]:
print("... view warnings ...")
for warning in conversation_result["warnings"]:
Expand All @@ -105,4 +105,4 @@ def sample_conv_issue_summarization():


if __name__ == '__main__':
sample_conv_issue_summarization()
sample_conv_summarization()
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ autorest
### Settings

```yaml
input-file: https://raw.githubusercontent.com/Azure/azure-rest-api-specs/d1716d13b0814a9d0785eda9a74529a315212f53/specification/cognitiveservices/data-plane/Language/preview/2022-05-15-preview/analyzeconversations.json
input-file: https://raw.githubusercontent.com/Azure/azure-rest-api-specs/e7f37e4e43b1d12fd1988fda3ed39624c4b23303/specification/cognitiveservices/data-plane/Language/preview/2022-05-15-preview/analyzeconversations.json
output-folder: ../azure/ai/language/conversations
namespace: azure.ai.language.conversations
package-name: azure-ai-language-conversations
Expand Down
Loading