Skip to content

Commit 6c5c9d6

Browse files
authored
Fix broken CLU live tests (Azure#37251)
* Fix broken CLU live tests * Update snippets
1 parent 6a62c83 commit 6c5c9d6

File tree

3 files changed

+15
-69
lines changed

3 files changed

+15
-69
lines changed

sdk/cognitivelanguage/Azure.AI.Language.Conversations/assets.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,5 @@
22
"AssetsRepo": "Azure/azure-sdk-assets",
33
"AssetsRepoPrefixPath": "net",
44
"TagPrefix": "net/cognitivelanguage/Azure.AI.Language.Conversations",
5-
"Tag": "net/cognitivelanguage/Azure.AI.Language.Conversations_76d76224ff"
5+
"Tag": "net/cognitivelanguage/Azure.AI.Language.Conversations_4ab193e5b0"
66
}

sdk/cognitivelanguage/Azure.AI.Language.Conversations/samples/Sample2_AnalyzeConversation_OrchestrationPrediction.md

Lines changed: 6 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -97,43 +97,16 @@ if (targetIntentResult.TargetProjectKind == "QuestionAnswering")
9797
string respondingProjectName = orchestrationPrediction.TopIntent;
9898
dynamic targetIntentResult = orchestrationPrediction.Intents[respondingProjectName];
9999

100-
if (targetIntentResult.TargetProjectKind == "Conversation")
100+
if (targetIntentResult.TargetProjectKind == "QuestionAnswering")
101101
{
102-
dynamic conversationResult = targetIntentResult.Result;
103-
dynamic conversationPrediction = conversationResult.Prediction;
104-
105-
Console.WriteLine($"Top Intent: {conversationPrediction.TopIntent}");
106-
Console.WriteLine($"Intents:");
107-
foreach (dynamic intent in conversationPrediction.Intents)
108-
{
109-
Console.WriteLine($"Intent Category: {intent.Category}");
110-
Console.WriteLine($"Confidence: {intent.ConfidenceScore}");
111-
Console.WriteLine();
112-
}
102+
dynamic questionAnsweringResult = targetIntentResult.Result;
113103

114-
Console.WriteLine($"Entities:");
115-
foreach (dynamic entity in conversationPrediction.Entities)
104+
Console.WriteLine($"Answers:");
105+
foreach (dynamic answer in questionAnsweringResult.Answers)
116106
{
117-
Console.WriteLine($"Entity Text: {entity.Text}");
118-
Console.WriteLine($"Entity Category: {entity.Category}");
119-
Console.WriteLine($"Confidence: {entity.ConfidenceScore}");
120-
Console.WriteLine($"Starting Position: {entity.Offset}");
121-
Console.WriteLine($"Length: {entity.Length}");
107+
Console.WriteLine($"{answer.Answer}");
108+
Console.WriteLine($"Confidence: {answer.ConfidenceScore}");
122109
Console.WriteLine();
123-
124-
if (entity.resolutions is not null)
125-
{
126-
foreach (dynamic resolution in entity.Resolutions)
127-
{
128-
if (resolution.ResolutionKind == "DateTimeResolution")
129-
{
130-
Console.WriteLine($"Datetime Sub Kind: {resolution.DateTimeSubKind}");
131-
Console.WriteLine($"Timex: {resolution.Timex}");
132-
Console.WriteLine($"Value: {resolution.Value}");
133-
Console.WriteLine();
134-
}
135-
}
136-
}
137110
}
138111
}
139112
```

sdk/cognitivelanguage/Azure.AI.Language.Conversations/tests/Samples/Sample2_AnalyzeConversation_OrchestrationPrediction.cs

Lines changed: 8 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -111,49 +111,22 @@ public void AnalyzeConversationOrchestrationPredictionConversation()
111111
string respondingProjectName = orchestrationPrediction.TopIntent;
112112
dynamic targetIntentResult = orchestrationPrediction.Intents[respondingProjectName];
113113

114-
if (targetIntentResult.TargetProjectKind == "Conversation")
114+
if (targetIntentResult.TargetProjectKind == "QuestionAnswering")
115115
{
116-
dynamic conversationResult = targetIntentResult.Result;
117-
dynamic conversationPrediction = conversationResult.Prediction;
116+
dynamic questionAnsweringResult = targetIntentResult.Result;
118117

119-
Console.WriteLine($"Top Intent: {conversationPrediction.TopIntent}");
120-
Console.WriteLine($"Intents:");
121-
foreach (dynamic intent in conversationPrediction.Intents)
118+
Console.WriteLine($"Answers:");
119+
foreach (dynamic answer in questionAnsweringResult.Answers)
122120
{
123-
Console.WriteLine($"Intent Category: {intent.Category}");
124-
Console.WriteLine($"Confidence: {intent.ConfidenceScore}");
121+
Console.WriteLine($"{answer.Answer}");
122+
Console.WriteLine($"Confidence: {answer.ConfidenceScore}");
125123
Console.WriteLine();
126124
}
127-
128-
Console.WriteLine($"Entities:");
129-
foreach (dynamic entity in conversationPrediction.Entities)
130-
{
131-
Console.WriteLine($"Entity Text: {entity.Text}");
132-
Console.WriteLine($"Entity Category: {entity.Category}");
133-
Console.WriteLine($"Confidence: {entity.ConfidenceScore}");
134-
Console.WriteLine($"Starting Position: {entity.Offset}");
135-
Console.WriteLine($"Length: {entity.Length}");
136-
Console.WriteLine();
137-
138-
if (entity.resolutions is not null)
139-
{
140-
foreach (dynamic resolution in entity.Resolutions)
141-
{
142-
if (resolution.ResolutionKind == "DateTimeResolution")
143-
{
144-
Console.WriteLine($"Datetime Sub Kind: {resolution.DateTimeSubKind}");
145-
Console.WriteLine($"Timex: {resolution.Timex}");
146-
Console.WriteLine($"Value: {resolution.Value}");
147-
Console.WriteLine();
148-
}
149-
}
150-
}
151-
}
152125
}
153126
#endregion
154127

155-
Assert.That(targetIntentResult.TargetProjectKind?.ToString(), Is.EqualTo("Conversation"));
156-
Assert.That(orchestrationPrediction.TopIntent?.ToString(), Is.EqualTo("EmailIntent"));
128+
Assert.That(targetIntentResult.TargetProjectKind?.ToString(), Is.EqualTo("QuestionAnswering"));
129+
Assert.That(orchestrationPrediction.TopIntent?.ToString(), Is.EqualTo("ChitChat-QnA"));
157130
}
158131

159132
[SyncOnly]

0 commit comments

Comments
 (0)