Skip to content

Commit fe141b7

Browse files
authored
Merge pull request #104226 from kristapratico/patch-2
Update python-sdk.md
2 parents 5918dd8 + a39335d commit fe141b7

File tree

1 file changed

+42
-40
lines changed
  • articles/cognitive-services/language-service/summarization/includes/quickstarts

1 file changed

+42
-40
lines changed

articles/cognitive-services/language-service/summarization/includes/quickstarts/python-sdk.md

Lines changed: 42 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ ms.custom: ignite-fall-2021
1414

1515
# [Conversation summarization](#tab/conversation-summarization)
1616

17-
[Reference documentation](/python/api/overview/azure/ai-language-conversations-readme?preserve-view=true&view=azure-python-preview) | [Additional samples](https://github.com/Azure/azure-sdk-for-python/blob/azure-ai-language-conversations_1.1.0b2/sdk/cognitivelanguage/azure-ai-language-conversations/samples/README.md) | [Package (PyPi)](https://pypi.org/project/azure-ai-language-conversations/1.1.0b2/) | [Library source code](https://github.com/Azure/azure-sdk-for-python/tree/azure-ai-language-conversations_1.1.0b2/sdk/cognitivelanguage/azure-ai-language-conversations)
17+
[Reference documentation](/python/api/overview/azure/ai-language-conversations-readme?preserve-view=true&view=azure-python-preview) | [Additional samples](https://github.com/Azure/azure-sdk-for-python/blob/azure-ai-language-conversations_1.1.0b3/sdk/cognitivelanguage/azure-ai-language-conversations/samples/README.md) | [Package (PyPi)](https://pypi.org/project/azure-ai-language-conversations/1.1.0b3/) | [Library source code](https://github.com/Azure/azure-sdk-for-python/tree/azure-ai-language-conversations_1.1.0b3/sdk/cognitivelanguage/azure-ai-language-conversations)
1818

1919
---
2020

@@ -49,7 +49,7 @@ pip install azure-ai-textanalytics==5.3.0b1
4949
# [Conversation summarization](#tab/conversation-summarization)
5050

5151
```console
52-
pip install azure-ai-language-conversations==1.1.0b2
52+
pip install azure-ai-language-conversations==1.1.0b3
5353
```
5454

5555
---
@@ -155,84 +155,86 @@ with client:
155155
"text": "Hello, you’re chatting with Rene. How may I help you?",
156156
"id": "1",
157157
"role": "Agent",
158-
"participantId": "Agent_1"
158+
"participantId": "Agent_1",
159159
},
160160
{
161161
"text": "Hi, I tried to set up wifi connection for Smart Brew 300 coffee machine, but it didn’t work.",
162162
"id": "2",
163163
"role": "Customer",
164-
"participantId": "Customer_1"
164+
"participantId": "Customer_1",
165165
},
166166
{
167167
"text": "I’m sorry to hear that. Let’s see what we can do to fix this issue. Could you please try the following steps for me? First, could you push the wifi connection button, hold for 3 seconds, then let me know if the power light is slowly blinking on and off every second?",
168168
"id": "3",
169169
"role": "Agent",
170-
"participantId": "Agent_1"
170+
"participantId": "Agent_1",
171171
},
172172
{
173173
"text": "Yes, I pushed the wifi connection button, and now the power light is slowly blinking.",
174174
"id": "4",
175175
"role": "Customer",
176-
"participantId": "Customer_1"
176+
"participantId": "Customer_1",
177177
},
178178
{
179179
"text": "Great. Thank you! Now, please check in your Contoso Coffee app. Does it prompt to ask you to connect with the machine?",
180180
"id": "5",
181181
"role": "Agent",
182-
"participantId": "Agent_1"
182+
"participantId": "Agent_1",
183183
},
184184
{
185185
"text": "No. Nothing happened.",
186186
"id": "6",
187187
"role": "Customer",
188-
"participantId": "Customer_1"
188+
"participantId": "Customer_1",
189189
},
190190
{
191191
"text": "I’m very sorry to hear that. Let me see if there’s another way to fix the issue. Please hold on for a minute.",
192192
"id": "7",
193193
"role": "Agent",
194-
"participantId": "Agent_1"
195-
}
194+
"participantId": "Agent_1",
195+
},
196196
],
197197
"modality": "text",
198198
"id": "conversation1",
199-
"language": "en"
199+
"language": "en",
200200
},
201201
]
202202
},
203203
"tasks": [
204204
{
205-
"taskName": "analyze 1",
205+
"taskName": "Issue task",
206+
"kind": "ConversationalSummarizationTask",
207+
"parameters": {"summaryAspects": ["issue"]},
208+
},
209+
{
210+
"taskName": "Resolution task",
206211
"kind": "ConversationalSummarizationTask",
207-
"parameters": {
208-
"summaryAspects": ["Issue, Resolution"]
209-
}
210-
}
211-
]
212+
"parameters": {"summaryAspects": ["resolution"]},
213+
},
214+
],
212215
}
213216
)
214217

215218
# view result
216219
result = poller.result()
217-
task_result = result["tasks"]["items"][0]
218-
print("... view task status ...")
219-
print("status: {}".format(task_result["status"]))
220-
resolution_result = task_result["results"]
221-
if resolution_result["errors"]:
222-
print("... errors occured ...")
223-
for error in resolution_result["errors"]:
224-
print(error)
225-
else:
226-
conversation_result = resolution_result["conversations"][0]
227-
if conversation_result["warnings"]:
228-
print("... view warnings ...")
229-
for warning in conversation_result["warnings"]:
230-
print(warning)
220+
task_results = result["tasks"]["items"]
221+
for task in task_results:
222+
print(f"\n{task['taskName']} status: {task['status']}")
223+
task_result = task["results"]
224+
if task_result["errors"]:
225+
print("... errors occurred ...")
226+
for error in task_result["errors"]:
227+
print(error)
231228
else:
232-
summaries = conversation_result["summaries"]
233-
print("... view task result ...")
234-
print("issue: {}".format(summaries[0]["text"]))
235-
print("resolution: {}".format(summaries[1]["text"]))
229+
conversation_result = task_result["conversations"][0]
230+
if conversation_result["warnings"]:
231+
print("... view warnings ...")
232+
for warning in conversation_result["warnings"]:
233+
print(warning)
234+
else:
235+
summaries = conversation_result["summaries"]
236+
for summary in summaries:
237+
print(f"{summary['aspect']}: {summary['text']}")
236238

237239
```
238240

@@ -242,11 +244,11 @@ with client:
242244
### Output
243245

244246
```console
245-
... view task status ...
246-
status: succeeded
247-
... view task result ...
248-
issue: Customer tried to set up wifi connection for Smart Brew 300 coffee machine, but it didn't work
249-
resolution: Asked customer to try the following steps | Asked customer for the power light | Helped customer to connect to the machine
247+
Issue task status: succeeded
248+
issue: Customer tried to set up wifi connection for Smart Brew 300 coffee machine but it didn't work. No error message.
249+
250+
Resolution task status: succeeded
251+
resolution: Asked customer to check if the Contoso Coffee app prompts to connect with the machine. Customer ended the chat.
250252
```
251253

252254
---

0 commit comments

Comments
 (0)