Skip to content

Commit ec44703

Browse files
authored
create Conversation Runtime 2025-05-15-preview sdk (Azure#49914)
* generate first version of Conversation Runtime 2025-05-15-preview * add sample tests for new feature AIAnalyzeConversation * add ConvAI test in ClientLiveTest * add some logs in tests * adjust the test file * commit new new tag in assets.json * run Export-API.ps1 for update * add the md file for AIConv * udpate to the latest main commit * update tag in assets.json * update tag in assets.json * update tag in assets.json * update Text Runtime sdk * updated the latest commit id in tsp-location.yaml in text conversation sdk * generate new models for Conversations Runtime * update text conversations sdk * update changelog * modify to `AI Conversation` in md * remove the console.log * added new api version and changed `test` to `recordedtest` * update the tag in assets.json in Text Runtime sdk * add tests for `Value exclusion policy` and `Synonyms` * add tests after Synonyms bug fix * update tag in assets.json * update the tag in assets.json * Revert the text runtime sdk * rebuild on old commit id of Text Runtime * udpated the files to be same as main for Text Runtime SDK * update documentation for AI Conversation Analyze feature (20250515-preview) * remove the dynamic json in doc * updated the Namespaces snippets * removed authoring in readme * update language studio to Azure AI Foundry in readme * updated "https://myaccount.cognitiveservices.azure.com" to "{endpoint}" in all snippets * Update all the tests and snippets * updated the tag in assets.json * added conversation authoring to conversation runtime readme * updated snippet sample code in readme to links * update analyze utterance to analyze conversation, and change the order of ai conversation in sample links * added api version 2024-11-01 for Conversations * add Blank lines and Indentation to make the ai conversation output clearer * adjust position of 2024-11-01 in api versions in readMe
1 parent bcf285f commit ec44703

File tree

62 files changed

+4339
-906
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

62 files changed

+4339
-906
lines changed

sdk/cognitivelanguage/Azure.AI.Language.Conversations/CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,10 @@
44

55
### Features Added
66

7+
- Added AI Conversation Analyze feature
8+
- Added support for analyze-conversation API Versions
9+
- 2025-05-15-preview
10+
711
### Breaking Changes
812

913
### Bugs Fixed

sdk/cognitivelanguage/Azure.AI.Language.Conversations/README.md

Lines changed: 21 additions & 565 deletions
Large diffs are not rendered by default.

sdk/cognitivelanguage/Azure.AI.Language.Conversations/api/Azure.AI.Language.Conversations.net8.0.cs

Lines changed: 156 additions & 2 deletions
Large diffs are not rendered by default.

sdk/cognitivelanguage/Azure.AI.Language.Conversations/api/Azure.AI.Language.Conversations.netstandard2.0.cs

Lines changed: 156 additions & 2 deletions
Large diffs are not rendered by default.

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_26c3361e25"
5+
"Tag": "net/cognitivelanguage/Azure.AI.Language.Conversations_d84e304e3b"
66
}

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

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,13 @@ Conversation Analysis is a cloud-based conversational AI service that applies cu
1616

1717
You can work with request and response content more easily by using our [Dynamic JSON](https://aka.ms/azsdk/net/dynamiccontent) feature. This is illustrated in the following samples:
1818

19-
- [Analyze an utterance - Conversation project](https://github.com/Azure/azure-sdk-for-net/tree/main/sdk/cognitivelanguage/Azure.AI.Language.Conversations/samples/Sample1_AnalyzeConversation_ConversationPrediction.md)
20-
- [Analyze an utterance - Orchestration project](https://github.com/Azure/azure-sdk-for-net/tree/main/sdk/cognitivelanguage/Azure.AI.Language.Conversations/samples/Sample2_AnalyzeConversation_OrchestrationPrediction.md)
21-
- [Analyze an utterance in a different language](https://github.com/Azure/azure-sdk-for-net/tree/main/sdk/cognitivelanguage/Azure.AI.Language.Conversations/samples/Sample3_AnalyzeConversationWithLanguage.md)
22-
- [Analyze an utterance using extra options](https://github.com/Azure/azure-sdk-for-net/tree/main/sdk/cognitivelanguage/Azure.AI.Language.Conversations/samples/Sample4_AnalyzeConversationWithOptions.md)
23-
- [Analyze a conversation with Conversation PII](https://github.com/Azure/azure-sdk-for-net/tree/main/sdk/cognitivelanguage/Azure.AI.Language.Conversations/samples/Sample8_AnalyzeConversation_ConversationPii.md)
24-
- [Analyze a conversation with Conversation Summarization](https://github.com/Azure/azure-sdk-for-net/tree/main/sdk/cognitivelanguage/Azure.AI.Language.Conversations/samples/Sample6_AnalyzeConversation_ConversationSummarization.md)
19+
- [Analyze an utterance - Conversation project](https://github.com/amber-ccc/azure-sdk-for-net/blob/amber/create_conversation_runtime_sdk_preview_20250515/sdk/cognitivelanguage/Azure.AI.Language.Conversations/samples/Sample1_AnalyzeConversation_ConversationPrediction.md)
20+
- [Analyze an utterance - Orchestration project](https://github.com/amber-ccc/azure-sdk-for-net/blob/amber/create_conversation_runtime_sdk_preview_20250515/sdk/cognitivelanguage/Azure.AI.Language.Conversations/samples/Sample2_AnalyzeConversation_OrchestrationPrediction.md)
21+
- [Analyze an utterance in a different language](https://github.com/amber-ccc/azure-sdk-for-net/blob/amber/create_conversation_runtime_sdk_preview_20250515/sdk/cognitivelanguage/Azure.AI.Language.Conversations/samples/Sample3_AnalyzeConversationWithLanguage.md)
22+
- [Analyze an utterance using extra options](https://github.com/amber-ccc/azure-sdk-for-net/blob/amber/create_conversation_runtime_sdk_preview_20250515/sdk/cognitivelanguage/Azure.AI.Language.Conversations/samples/Sample4_AnalyzeConversationWithOptions.md)
23+
- [Analyze a conversation with Conversation Summarization](https://github.com/amber-ccc/azure-sdk-for-net/blob/amber/create_conversation_runtime_sdk_preview_20250515/sdk/cognitivelanguage/Azure.AI.Language.Conversations/samples/Sample5_AnalyzeConversation_ConversationSummarization.md)
24+
- [Analyze a conversation with Conversation PII](https://github.com/amber-ccc/azure-sdk-for-net/blob/amber/create_conversation_runtime_sdk_preview_20250515/sdk/cognitivelanguage/Azure.AI.Language.Conversations/samples/Sample6_AnalyzeConversation_ConversationPii.md)
25+
- [Analyze a Conversation for PII Using Character Masking](https://github.com/amber-ccc/azure-sdk-for-net/blob/amber/create_conversation_runtime_sdk_preview_20250515/sdk/cognitivelanguage/Azure.AI.Language.Conversations/samples/Sample7_AnalyzeConversation_ConversationPiiWithCharacterMaskPolicy.md)
26+
- [Analyze a Conversation for PII Using Entity Masking](https://github.com/amber-ccc/azure-sdk-for-net/blob/amber/create_conversation_runtime_sdk_preview_20250515/sdk/cognitivelanguage/Azure.AI.Language.Conversations/samples/Sample8_AnalyzeConversation_ConversationPiiWithEntityMaskPolicy.md)
27+
- [Analyze a Conversation for PII With No Masking](https://github.com/amber-ccc/azure-sdk-for-net/blob/amber/create_conversation_runtime_sdk_preview_20250515/sdk/cognitivelanguage/Azure.AI.Language.Conversations/samples/Sample9_AnalyzeConversation_ConversationPiiWithNoMaskPolicy.md)
28+
- [Analyze an utterance - Conversational AI project](https://github.com/amber-ccc/azure-sdk-for-net/blob/amber/create_conversation_runtime_sdk_preview_20250515/sdk/cognitivelanguage/Azure.AI.Language.Conversations/samples/Sample10_AnalyzeConversation_ConversationalAIPrediction.md)
Lines changed: 141 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,141 @@
1+
# Analyze an AI Conversation
2+
3+
This sample demonstrates how to analyze an utterance in an AI Conversation. To get started, you'll need to create a Cognitive Language service endpoint and an API key. See the [README](https://github.com/Azure/azure-sdk-for-net/blob/main/sdk/cognitivelanguage/Azure.AI.Language.Conversations/README.md) for links and instructions.
4+
5+
Start by importing the namespace for the `ConversationAnalysisClient` and related classes:
6+
7+
```C# Snippet:ConversationAnalysisClient_Namespaces
8+
using Azure.Core;
9+
using Azure.Core.Serialization;
10+
using Azure.AI.Language.Conversations;
11+
using Azure.AI.Language.Conversations.Models;
12+
```
13+
14+
To analyze an utterance, you need to first create a `ConversationAnalysisClient` using an endpoint and API key. These can be stored in an environment variable, configuration setting, or any way that works for your application.
15+
16+
```C# Snippet:CreateConversationAnalysisClientForSpecificApiVersion
17+
Uri endpoint = new Uri("{endpoint}");
18+
AzureKeyCredential credential = new AzureKeyCredential("{api-key}");
19+
ConversationsClientOptions options = new ConversationsClientOptions(ConversationsClientOptions.ServiceVersion.V2025_05_15_Preview);
20+
ConversationAnalysisClient client = new ConversationAnalysisClient(endpoint, credential, options);
21+
```
22+
23+
Once you have created a client, you can call synchronous or asynchronous methods.
24+
25+
## Synchronous
26+
27+
```C# Snippet:ConversationAnalysis_AnalyzeAIConversation
28+
string projectName = "EmailApp";
29+
string deploymentName = "production";
30+
31+
AnalyzeConversationInput data = new ConversationalAITask(
32+
new ConversationalAIAnalysisInput(
33+
conversations: new AIConversation[] {
34+
new AIConversation(
35+
id: "order",
36+
modality: InputModality.Text,
37+
language: "en-GB",
38+
conversationItems: new ConversationalAIItem[]
39+
{
40+
new ConversationalAIItem(id: "1", participantId: "user", text: "Hi"),
41+
new ConversationalAIItem(id: "2", participantId: "bot", text: "Hello, how can I help you?"),
42+
new ConversationalAIItem(id: "3", participantId: "user", text: "Send an email to Carol about tomorrow's demo")
43+
}
44+
)
45+
}),
46+
new AIConversationLanguageUnderstandingActionContent(projectName, deploymentName)
47+
{
48+
StringIndexType = StringIndexType.Utf16CodeUnit,
49+
});
50+
51+
Response<AnalyzeConversationActionResult> response = client.AnalyzeConversation(data);
52+
ConversationalAITaskResult result = response.Value as ConversationalAITaskResult;
53+
ConversationalAIResult aiResult = result.Result;
54+
55+
foreach (var conversation in aiResult?.Conversations ?? Enumerable.Empty<ConversationalAIAnalysis>())
56+
{
57+
Console.WriteLine($"Conversation ID: {conversation.Id}\n");
58+
59+
Console.WriteLine("Intents:");
60+
foreach (var intent in conversation.Intents ?? Enumerable.Empty<ConversationalAIIntent>())
61+
{
62+
Console.WriteLine($" Name: {intent.Name}");
63+
Console.WriteLine($" Type: {intent.Type}");
64+
65+
Console.WriteLine(" Conversation Item Ranges:");
66+
foreach (var range in intent.ConversationItemRanges ?? Enumerable.Empty<ConversationItemRange>())
67+
{
68+
Console.WriteLine($" - Offset: {range.Offset}, Count: {range.Count}");
69+
}
70+
71+
Console.WriteLine("\n Entities (Scoped to Intent):");
72+
foreach (var entity in intent.Entities ?? Enumerable.Empty<ConversationalAIEntity>())
73+
{
74+
Console.WriteLine($" Name: {entity.Name}");
75+
Console.WriteLine($" Text: {entity.Text}");
76+
Console.WriteLine($" Confidence: {entity.ConfidenceScore}");
77+
Console.WriteLine($" Offset: {entity.Offset}, Length: {entity.Length}");
78+
Console.WriteLine($" Conversation Item ID: {entity.ConversationItemId}, Index: {entity.ConversationItemIndex}");
79+
80+
if (entity.Resolutions != null)
81+
{
82+
foreach (var res in entity.Resolutions.OfType<DateTimeResolution>())
83+
{
84+
Console.WriteLine($" - [DateTimeResolution] SubKind: {res.DateTimeSubKind}, Timex: {res.Timex}, Value: {res.Value}");
85+
}
86+
}
87+
88+
if (entity.ExtraInformation != null)
89+
{
90+
foreach (var extra in entity.ExtraInformation.OfType<EntitySubtype>())
91+
{
92+
Console.WriteLine($" - [EntitySubtype] Value: {extra.Value}");
93+
foreach (var tag in extra.Tags ?? Enumerable.Empty<EntityTag>())
94+
{
95+
Console.WriteLine($" • Tag: {tag.Name}, Confidence: {tag.ConfidenceScore}");
96+
}
97+
}
98+
}
99+
100+
Console.WriteLine();
101+
}
102+
103+
Console.WriteLine();
104+
}
105+
106+
Console.WriteLine("Global Entities:");
107+
foreach (var entity in conversation.Entities ?? Enumerable.Empty<ConversationalAIEntity>())
108+
{
109+
Console.WriteLine($" Name: {entity.Name}");
110+
Console.WriteLine($" Text: {entity.Text}");
111+
Console.WriteLine($" Confidence: {entity.ConfidenceScore}");
112+
Console.WriteLine($" Offset: {entity.Offset}, Length: {entity.Length}");
113+
Console.WriteLine($" Conversation Item ID: {entity.ConversationItemId}, Index: {entity.ConversationItemIndex}");
114+
115+
if (entity.ExtraInformation != null)
116+
{
117+
foreach (var extra in entity.ExtraInformation.OfType<EntitySubtype>())
118+
{
119+
Console.WriteLine($" - [EntitySubtype] Value: {extra.Value}");
120+
foreach (var tag in extra.Tags ?? Enumerable.Empty<EntityTag>())
121+
{
122+
Console.WriteLine($" • Tag: {tag.Name}, Confidence: {tag.ConfidenceScore}");
123+
}
124+
}
125+
}
126+
127+
Console.WriteLine();
128+
}
129+
130+
Console.WriteLine(new string('-', 40));
131+
}
132+
```
133+
134+
## Asynchronous
135+
136+
Using the same `data` definition above, you can make an asynchronous request by calling `AnalyzeConversationAsync`:
137+
138+
```C# Snippet:ConversationAnalysis_AnalyzeAIConversationAsync
139+
Response<AnalyzeConversationActionResult> response = await client.AnalyzeConversationAsync(data);
140+
ConversationalAITaskResult taskResult = response.Value as ConversationalAITaskResult;
141+
```

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

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,15 @@ Start by importing the namespace for the `ConversationAnalysisClient` and relate
1010
using Azure.Core;
1111
using Azure.Core.Serialization;
1212
using Azure.AI.Language.Conversations;
13+
using Azure.AI.Language.Conversations.Models;
1314
```
1415

1516
To analyze an utterance, you need to first create a `ConversationAnalysisClient` using an endpoint and API key. These can be stored in an environment variable, configuration setting, or any way that works for your application.
1617

1718
```C# Snippet:CreateConversationAnalysisClientForSpecificApiVersion
18-
Uri endpoint = new Uri("https://myaccount.cognitiveservices.azure.com");
19+
Uri endpoint = new Uri("{endpoint}");
1920
AzureKeyCredential credential = new AzureKeyCredential("{api-key}");
20-
ConversationsClientOptions options = new ConversationsClientOptions(ConversationsClientOptions.ServiceVersion.V2024_05_01);
21+
ConversationsClientOptions options = new ConversationsClientOptions(ConversationsClientOptions.ServiceVersion.V2025_05_15_Preview);
2122
ConversationAnalysisClient client = new ConversationAnalysisClient(endpoint, credential, options);
2223
```
2324

@@ -26,7 +27,7 @@ Once you have created a client, you can call synchronous or asynchronous methods
2627
## Synchronous
2728

2829
```C# Snippet:ConversationAnalysis_AnalyzeConversation
29-
string projectName = "Menu";
30+
string projectName = "EmailApp";
3031
string deploymentName = "production";
3132

3233
AnalyzeConversationInput data = new ConversationLanguageUnderstandingInput(

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

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,13 @@ Start by importing the namespace for the `ConversationAnalysisClient` and relate
1010
using Azure.Core;
1111
using Azure.Core.Serialization;
1212
using Azure.AI.Language.Conversations;
13+
using Azure.AI.Language.Conversations.Models;
1314
```
1415

1516
To analyze an utterance, you need to first create a `ConversationAnalysisClient` using an endpoint and API key. These can be stored in an environment variable, configuration setting, or any way that works for your application.
1617

1718
```C# Snippet:ConversationAnalysisClient_Create
18-
Uri endpoint = new Uri("https://myaccount.cognitiveservices.azure.com");
19+
Uri endpoint = new Uri("{endpoint}");
1920
AzureKeyCredential credential = new AzureKeyCredential("{api-key}");
2021

2122
ConversationAnalysisClient client = new ConversationAnalysisClient(endpoint, credential);
@@ -26,8 +27,12 @@ Once you have created a client, you can call synchronous or asynchronous methods
2627
## Synchronous
2728

2829
```C# Snippet:ConversationAnalysis_AnalyzeConversationOrchestrationPrediction
29-
string projectName = "DomainOrchestrator";
30+
string projectName = "TestWorkflow";
3031
string deploymentName = "production";
32+
Console.WriteLine("=== Request Info ===");
33+
Console.WriteLine($"Project Name: {projectName}");
34+
Console.WriteLine($"Deployment Name: {deploymentName}");
35+
3136
AnalyzeConversationInput data = new ConversationLanguageUnderstandingInput(
3237
new ConversationAnalysisInput(
3338
new TextConversationItem(
@@ -38,6 +43,15 @@ AnalyzeConversationInput data = new ConversationLanguageUnderstandingInput(
3843
{
3944
StringIndexType = StringIndexType.Utf16CodeUnit,
4045
});
46+
var serializedRequest = JsonSerializer.Serialize(data, new JsonSerializerOptions
47+
{
48+
WriteIndented = true,
49+
DefaultIgnoreCondition = JsonIgnoreCondition.WhenWritingNull,
50+
Converters = { new JsonStringEnumConverter() }
51+
});
52+
53+
Console.WriteLine("Request payload:");
54+
Console.WriteLine(serializedRequest);
4155

4256
Response<AnalyzeConversationActionResult> response = client.AnalyzeConversation(data);
4357
ConversationActionResult conversationResult = response.Value as ConversationActionResult;

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

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,13 @@ Start by importing the namespace for the `ConversationAnalysisClient` and relate
1010
using Azure.Core;
1111
using Azure.Core.Serialization;
1212
using Azure.AI.Language.Conversations;
13+
using Azure.AI.Language.Conversations.Models;
1314
```
1415

1516
To analyze an utterance, you need to first create a `ConversationAnalysisClient` using an endpoint and API key. These can be stored in an environment variable, configuration setting, or any way that works for your application.
1617

1718
```C# Snippet:ConversationAnalysisClient_Create
18-
Uri endpoint = new Uri("https://myaccount.cognitiveservices.azure.com");
19+
Uri endpoint = new Uri("{endpoint}");
1920
AzureKeyCredential credential = new AzureKeyCredential("{api-key}");
2021

2122
ConversationAnalysisClient client = new ConversationAnalysisClient(endpoint, credential);
@@ -26,7 +27,7 @@ Once you have created a client, you can call synchronous or asynchronous methods
2627
## Synchronous
2728

2829
```C# Snippet:ConversationAnalysis_AnalyzeConversationWithLanguage
29-
string projectName = "Menu";
30+
string projectName = "EmailApp";
3031
string deploymentName = "production";
3132

3233
AnalyzeConversationInput data =

0 commit comments

Comments
 (0)