From a97f8738474d27e46759aecbb51a8b7a6d4f5156 Mon Sep 17 00:00:00 2001 From: Xiong Chen Date: Fri, 10 Jan 2025 10:18:43 -0800 Subject: [PATCH 01/31] Updated the dotnet sdk based on the new commit --- .../Generated/ConversationsClientOptions.cs | 8 +- .../Generated/ConversationsModelFactory.cs | 18 +- .../Docs/ConversationAnalysisClient.xml | 1198 ++++++++++++++++- .../BaseRedactionPolicy.Serialization.cs | 135 ++ .../Generated/Models/BaseRedactionPolicy.cs | 69 + ...onversationActionContent.Serialization.cs} | 42 +- ...ontent.cs => ConversationActionContent.cs} | 14 +- ...anguageUnderstandingInput.Serialization.cs | 4 +- .../ConversationLanguageUnderstandingInput.cs | 6 +- .../DoNotRedactPolicyType.Serialization.cs | 126 ++ .../Generated/Models/DoNotRedactPolicyType.cs | 29 + ...kWithEntityTypePolicyType.Serialization.cs | 126 ++ .../Models/MaskWithEntityTypePolicyType.cs | 29 + ...actionCharacterPolicyType.Serialization.cs | 141 ++ .../MaskWithRedactionCharacterPolicyType.cs | 34 + .../Models/NamedEntity.Serialization.cs | 44 + .../src/Generated/Models/NamedEntity.cs | 14 +- ...n.cs => PiiActionContent.Serialization.cs} | 58 +- ...iiActionContent.cs => PiiActionContent.cs} | 22 +- .../PiiOperationAction.Serialization.cs | 4 +- .../Generated/Models/PiiOperationAction.cs | 4 +- .../Generated/Models/RedactionPolicyKind.cs | 54 + ...nknownBaseRedactionPolicy.Serialization.cs | 126 ++ .../Models/UnknownBaseRedactionPolicy.cs | 28 + .../Samples_ConversationAnalysisClient.cs | 1180 +++++++++++++++- .../tsp-location.yaml | 2 +- 26 files changed, 3351 insertions(+), 164 deletions(-) create mode 100644 sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/BaseRedactionPolicy.Serialization.cs create mode 100644 sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/BaseRedactionPolicy.cs rename sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/{ConversationLanguageUnderstandingActionContent.Serialization.cs => ConversationActionContent.Serialization.cs} (76%) rename sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/{ConversationLanguageUnderstandingActionContent.cs => ConversationActionContent.cs} (88%) create mode 100644 sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/DoNotRedactPolicyType.Serialization.cs create mode 100644 sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/DoNotRedactPolicyType.cs create mode 100644 sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/MaskWithEntityTypePolicyType.Serialization.cs create mode 100644 sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/MaskWithEntityTypePolicyType.cs create mode 100644 sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/MaskWithRedactionCharacterPolicyType.Serialization.cs create mode 100644 sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/MaskWithRedactionCharacterPolicyType.cs rename sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/{ConversationPiiActionContent.Serialization.cs => PiiActionContent.Serialization.cs} (78%) rename sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/{ConversationPiiActionContent.cs => PiiActionContent.cs} (72%) create mode 100644 sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/RedactionPolicyKind.cs create mode 100644 sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/UnknownBaseRedactionPolicy.Serialization.cs create mode 100644 sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/UnknownBaseRedactionPolicy.cs diff --git a/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/ConversationsClientOptions.cs b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/ConversationsClientOptions.cs index 87f2eba66e91..e0430ea44cd0 100644 --- a/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/ConversationsClientOptions.cs +++ b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/ConversationsClientOptions.cs @@ -13,7 +13,7 @@ namespace Azure.AI.Language.Conversations /// Client options for ConversationAnalysisClient. public partial class ConversationsClientOptions : ClientOptions { - private const ServiceVersion LatestVersion = ServiceVersion.V2024_05_15_Preview; + private const ServiceVersion LatestVersion = ServiceVersion.V2024_11_15_Preview; /// The version of the service to use. public enum ServiceVersion @@ -24,8 +24,8 @@ public enum ServiceVersion V2023_04_01 = 2, /// Service version "2024-05-01". V2024_05_01 = 3, - /// Service version "2024-05-15-preview". - V2024_05_15_Preview = 4, + /// Service version "2024-11-15-preview". + V2024_11_15_Preview = 4, } internal string Version { get; } @@ -38,7 +38,7 @@ public ConversationsClientOptions(ServiceVersion version = LatestVersion) ServiceVersion.V2022_05_01 => "2022-05-01", ServiceVersion.V2023_04_01 => "2023-04-01", ServiceVersion.V2024_05_01 => "2024-05-01", - ServiceVersion.V2024_05_15_Preview => "2024-05-15-preview", + ServiceVersion.V2024_11_15_Preview => "2024-11-15-preview", _ => throw new NotSupportedException() }; } diff --git a/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/ConversationsModelFactory.cs b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/ConversationsModelFactory.cs index ade8de3ca4ea..fe3dea411b99 100644 --- a/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/ConversationsModelFactory.cs +++ b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/ConversationsModelFactory.cs @@ -19,7 +19,7 @@ public static partial class ConversationsModelFactory /// The input ConversationItem and its optional parameters. /// Input parameters necessary for a Conversation language understanding task. /// A new instance for mocking. - public static ConversationLanguageUnderstandingInput ConversationLanguageUnderstandingInput(ConversationAnalysisInput conversationInput = null, ConversationLanguageUnderstandingActionContent actionContent = null) + public static ConversationLanguageUnderstandingInput ConversationLanguageUnderstandingInput(ConversationAnalysisInput conversationInput = null, ConversationActionContent actionContent = null) { return new ConversationLanguageUnderstandingInput(AnalyzeConversationInputKind.Conversation, serializedAdditionalRawData: null, conversationInput, actionContent); } @@ -44,7 +44,7 @@ public static TextConversationItem TextConversationItem(string id = null, string serializedAdditionalRawData: null); } - /// Initializes a new instance of . + /// Initializes a new instance of . /// The name of the project to use. /// The name of the deployment to use. /// If true, the service will return more detailed information in the response. @@ -56,12 +56,12 @@ public static TextConversationItem TextConversationItem(string id = null, string /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. /// The available derived classes include , and . /// - /// A new instance for mocking. - public static ConversationLanguageUnderstandingActionContent ConversationLanguageUnderstandingActionContent(string projectName = null, string deploymentName = null, bool? verbose = null, bool? isLoggingEnabled = null, StringIndexType? stringIndexType = null, string directTarget = null, IDictionary targetProjectParameters = null) + /// A new instance for mocking. + public static ConversationActionContent ConversationActionContent(string projectName = null, string deploymentName = null, bool? verbose = null, bool? isLoggingEnabled = null, StringIndexType? stringIndexType = null, string directTarget = null, IDictionary targetProjectParameters = null) { targetProjectParameters ??= new Dictionary(); - return new ConversationLanguageUnderstandingActionContent( + return new ConversationActionContent( projectName, deploymentName, verbose, @@ -749,8 +749,11 @@ public static AudioTiming AudioTiming(long? offset = null, long? duration = null /// Start position for the entity text. Use of different 'stringIndexType' values can affect the offset returned. /// Length for the entity text. Use of different 'stringIndexType' values can affect the length returned. /// Confidence score between 0 and 1 of the extracted entity. + /// Exact mask text to mask the PII entity. + /// Offset of the mask text. + /// Length of the mask text. /// A new instance for mocking. - public static NamedEntity NamedEntity(string text = null, string category = null, string subcategory = null, int offset = default, int length = default, double confidenceScore = default) + public static NamedEntity NamedEntity(string text = null, string category = null, string subcategory = null, int offset = default, int length = default, double confidenceScore = default, string mask = null, int? maskOffset = null, int? maskLength = null) { return new NamedEntity( text, @@ -759,6 +762,9 @@ public static NamedEntity NamedEntity(string text = null, string category = null offset, length, confidenceScore, + mask, + maskOffset, + maskLength, serializedAdditionalRawData: null); } diff --git a/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Docs/ConversationAnalysisClient.xml b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Docs/ConversationAnalysisClient.xml index 9a307ff5dc86..2143e58afdb5 100644 --- a/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Docs/ConversationAnalysisClient.xml +++ b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Docs/ConversationAnalysisClient.xml @@ -9,7 +9,7 @@ Uri endpoint = new Uri(""); AzureKeyCredential credential = new AzureKeyCredential(""); ConversationAnalysisClient client = new ConversationAnalysisClient(endpoint, credential); -AnalyzeConversationInput analyzeConversationInput = new ConversationLanguageUnderstandingInput(new ConversationAnalysisInput(new TextConversationItem("1", "1", "Book a flight to Seattle on Oct 10th")), new ConversationLanguageUnderstandingActionContent("{project-name}", "{deployment-name}")); +AnalyzeConversationInput analyzeConversationInput = new ConversationLanguageUnderstandingInput(new ConversationAnalysisInput(new TextConversationItem("1", "1", "Book a flight to Seattle on Oct 10th")), new ConversationActionContent("{project-name}", "{deployment-name}")); Response response = await client.AnalyzeConversationAsync(analyzeConversationInput); ]]> This sample shows how to call AnalyzeConversationAsync. @@ -22,7 +22,7 @@ AnalyzeConversationInput analyzeConversationInput = new ConversationLanguageUnde { Language = "en-GB", Modality = InputModality.Text, -}), new ConversationLanguageUnderstandingActionContent("{project-name}", "{deployment-name}") +}), new ConversationActionContent("{project-name}", "{deployment-name}") { Verbose = true, IsLoggingEnabled = false, @@ -35,7 +35,7 @@ Uri endpoint = new Uri(""); AzureKeyCredential credential = new AzureKeyCredential(""); ConversationAnalysisClient client = new ConversationAnalysisClient(endpoint, credential); -AnalyzeConversationInput analyzeConversationInput = new ConversationLanguageUnderstandingInput(new ConversationAnalysisInput(new TextConversationItem("1", "1", "Ports and connectors")), new ConversationLanguageUnderstandingActionContent("prj1", "dep1") +AnalyzeConversationInput analyzeConversationInput = new ConversationLanguageUnderstandingInput(new ConversationAnalysisInput(new TextConversationItem("1", "1", "Ports and connectors")), new ConversationActionContent("prj1", "dep1") { DirectTarget = "qnaProject", TargetProjectParameters = @@ -65,7 +65,7 @@ Uri endpoint = new Uri(""); AzureKeyCredential credential = new AzureKeyCredential(""); ConversationAnalysisClient client = new ConversationAnalysisClient(endpoint, credential); -AnalyzeConversationInput analyzeConversationInput = new ConversationLanguageUnderstandingInput(new ConversationAnalysisInput(new TextConversationItem("1", "1", "Book a flight to Seattle on Oct 10th")), new ConversationLanguageUnderstandingActionContent("{project-name}", "{deployment-name}")); +AnalyzeConversationInput analyzeConversationInput = new ConversationLanguageUnderstandingInput(new ConversationAnalysisInput(new TextConversationItem("1", "1", "Book a flight to Seattle on Oct 10th")), new ConversationActionContent("{project-name}", "{deployment-name}")); Response response = client.AnalyzeConversation(analyzeConversationInput); ]]> This sample shows how to call AnalyzeConversation. @@ -78,7 +78,7 @@ AnalyzeConversationInput analyzeConversationInput = new ConversationLanguageUnde { Language = "en-GB", Modality = InputModality.Text, -}), new ConversationLanguageUnderstandingActionContent("{project-name}", "{deployment-name}") +}), new ConversationActionContent("{project-name}", "{deployment-name}") { Verbose = true, IsLoggingEnabled = false, @@ -91,7 +91,7 @@ Uri endpoint = new Uri(""); AzureKeyCredential credential = new AzureKeyCredential(""); ConversationAnalysisClient client = new ConversationAnalysisClient(endpoint, credential); -AnalyzeConversationInput analyzeConversationInput = new ConversationLanguageUnderstandingInput(new ConversationAnalysisInput(new TextConversationItem("1", "1", "Ports and connectors")), new ConversationLanguageUnderstandingActionContent("prj1", "dep1") +AnalyzeConversationInput analyzeConversationInput = new ConversationLanguageUnderstandingInput(new ConversationAnalysisInput(new TextConversationItem("1", "1", "Ports and connectors")), new ConversationActionContent("prj1", "dep1") { DirectTarget = "qnaProject", TargetProjectParameters = @@ -369,6 +369,30 @@ Uri endpoint = new Uri(""); AzureKeyCredential credential = new AzureKeyCredential(""); ConversationAnalysisClient client = new ConversationAnalysisClient(endpoint, credential); +Response response = await client.GetAnalyzeConversationJobStatusAsync(Guid.Parse("c0f2a446-05d9-48fc-ba8f-3ef4af8d0b18")); +]]> +This sample shows how to call GetAnalyzeConversationJobStatusAsync. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +ConversationAnalysisClient client = new ConversationAnalysisClient(endpoint, credential); + +Response response = await client.GetAnalyzeConversationJobStatusAsync(Guid.Parse("c0f2a446-05d9-48fc-ba8f-3ef4af8d0b18")); +]]> +This sample shows how to call GetAnalyzeConversationJobStatusAsync. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +ConversationAnalysisClient client = new ConversationAnalysisClient(endpoint, credential); + +Response response = await client.GetAnalyzeConversationJobStatusAsync(Guid.Parse("c0f2a446-05d9-48fc-ba8f-3ef4af8d0b18")); +]]> +This sample shows how to call GetAnalyzeConversationJobStatusAsync. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +ConversationAnalysisClient client = new ConversationAnalysisClient(endpoint, credential); + Response response = await client.GetAnalyzeConversationJobStatusAsync(Guid.Parse("3e9e8518-492f-47f9-abd1-9a7468231086")); ]]> This sample shows how to call GetAnalyzeConversationJobStatusAsync. @@ -420,6 +444,30 @@ Uri endpoint = new Uri(""); AzureKeyCredential credential = new AzureKeyCredential(""); ConversationAnalysisClient client = new ConversationAnalysisClient(endpoint, credential); +Response response = client.GetAnalyzeConversationJobStatus(Guid.Parse("c0f2a446-05d9-48fc-ba8f-3ef4af8d0b18")); +]]> +This sample shows how to call GetAnalyzeConversationJobStatus. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +ConversationAnalysisClient client = new ConversationAnalysisClient(endpoint, credential); + +Response response = client.GetAnalyzeConversationJobStatus(Guid.Parse("c0f2a446-05d9-48fc-ba8f-3ef4af8d0b18")); +]]> +This sample shows how to call GetAnalyzeConversationJobStatus. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +ConversationAnalysisClient client = new ConversationAnalysisClient(endpoint, credential); + +Response response = client.GetAnalyzeConversationJobStatus(Guid.Parse("c0f2a446-05d9-48fc-ba8f-3ef4af8d0b18")); +]]> +This sample shows how to call GetAnalyzeConversationJobStatus. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +ConversationAnalysisClient client = new ConversationAnalysisClient(endpoint, credential); + Response response = client.GetAnalyzeConversationJobStatus(Guid.Parse("3e9e8518-492f-47f9-abd1-9a7468231086")); ]]> This sample shows how to call GetAnalyzeConversationJobStatus. @@ -501,6 +549,60 @@ Uri endpoint = new Uri(""); AzureKeyCredential credential = new AzureKeyCredential(""); ConversationAnalysisClient client = new ConversationAnalysisClient(endpoint, credential); +Response response = await client.GetAnalyzeConversationJobStatusAsync(Guid.Parse("c0f2a446-05d9-48fc-ba8f-3ef4af8d0b18"), null, null); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("createdDateTime").ToString()); +Console.WriteLine(result.GetProperty("jobId").ToString()); +Console.WriteLine(result.GetProperty("lastUpdatedDateTime").ToString()); +Console.WriteLine(result.GetProperty("status").ToString()); +Console.WriteLine(result.GetProperty("tasks").GetProperty("completed").ToString()); +Console.WriteLine(result.GetProperty("tasks").GetProperty("failed").ToString()); +Console.WriteLine(result.GetProperty("tasks").GetProperty("inProgress").ToString()); +Console.WriteLine(result.GetProperty("tasks").GetProperty("total").ToString()); +]]> +This sample shows how to call GetAnalyzeConversationJobStatusAsync and parse the result. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +ConversationAnalysisClient client = new ConversationAnalysisClient(endpoint, credential); + +Response response = await client.GetAnalyzeConversationJobStatusAsync(Guid.Parse("c0f2a446-05d9-48fc-ba8f-3ef4af8d0b18"), null, null); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("createdDateTime").ToString()); +Console.WriteLine(result.GetProperty("jobId").ToString()); +Console.WriteLine(result.GetProperty("lastUpdatedDateTime").ToString()); +Console.WriteLine(result.GetProperty("status").ToString()); +Console.WriteLine(result.GetProperty("tasks").GetProperty("completed").ToString()); +Console.WriteLine(result.GetProperty("tasks").GetProperty("failed").ToString()); +Console.WriteLine(result.GetProperty("tasks").GetProperty("inProgress").ToString()); +Console.WriteLine(result.GetProperty("tasks").GetProperty("total").ToString()); +]]> +This sample shows how to call GetAnalyzeConversationJobStatusAsync and parse the result. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +ConversationAnalysisClient client = new ConversationAnalysisClient(endpoint, credential); + +Response response = await client.GetAnalyzeConversationJobStatusAsync(Guid.Parse("c0f2a446-05d9-48fc-ba8f-3ef4af8d0b18"), null, null); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("createdDateTime").ToString()); +Console.WriteLine(result.GetProperty("jobId").ToString()); +Console.WriteLine(result.GetProperty("lastUpdatedDateTime").ToString()); +Console.WriteLine(result.GetProperty("status").ToString()); +Console.WriteLine(result.GetProperty("tasks").GetProperty("completed").ToString()); +Console.WriteLine(result.GetProperty("tasks").GetProperty("failed").ToString()); +Console.WriteLine(result.GetProperty("tasks").GetProperty("inProgress").ToString()); +Console.WriteLine(result.GetProperty("tasks").GetProperty("total").ToString()); +]]> +This sample shows how to call GetAnalyzeConversationJobStatusAsync and parse the result. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +ConversationAnalysisClient client = new ConversationAnalysisClient(endpoint, credential); + Response response = await client.GetAnalyzeConversationJobStatusAsync(Guid.Parse("3e9e8518-492f-47f9-abd1-9a7468231086"), null, null); JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; @@ -612,6 +714,60 @@ Uri endpoint = new Uri(""); AzureKeyCredential credential = new AzureKeyCredential(""); ConversationAnalysisClient client = new ConversationAnalysisClient(endpoint, credential); +Response response = client.GetAnalyzeConversationJobStatus(Guid.Parse("c0f2a446-05d9-48fc-ba8f-3ef4af8d0b18"), null, null); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("createdDateTime").ToString()); +Console.WriteLine(result.GetProperty("jobId").ToString()); +Console.WriteLine(result.GetProperty("lastUpdatedDateTime").ToString()); +Console.WriteLine(result.GetProperty("status").ToString()); +Console.WriteLine(result.GetProperty("tasks").GetProperty("completed").ToString()); +Console.WriteLine(result.GetProperty("tasks").GetProperty("failed").ToString()); +Console.WriteLine(result.GetProperty("tasks").GetProperty("inProgress").ToString()); +Console.WriteLine(result.GetProperty("tasks").GetProperty("total").ToString()); +]]> +This sample shows how to call GetAnalyzeConversationJobStatus and parse the result. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +ConversationAnalysisClient client = new ConversationAnalysisClient(endpoint, credential); + +Response response = client.GetAnalyzeConversationJobStatus(Guid.Parse("c0f2a446-05d9-48fc-ba8f-3ef4af8d0b18"), null, null); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("createdDateTime").ToString()); +Console.WriteLine(result.GetProperty("jobId").ToString()); +Console.WriteLine(result.GetProperty("lastUpdatedDateTime").ToString()); +Console.WriteLine(result.GetProperty("status").ToString()); +Console.WriteLine(result.GetProperty("tasks").GetProperty("completed").ToString()); +Console.WriteLine(result.GetProperty("tasks").GetProperty("failed").ToString()); +Console.WriteLine(result.GetProperty("tasks").GetProperty("inProgress").ToString()); +Console.WriteLine(result.GetProperty("tasks").GetProperty("total").ToString()); +]]> +This sample shows how to call GetAnalyzeConversationJobStatus and parse the result. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +ConversationAnalysisClient client = new ConversationAnalysisClient(endpoint, credential); + +Response response = client.GetAnalyzeConversationJobStatus(Guid.Parse("c0f2a446-05d9-48fc-ba8f-3ef4af8d0b18"), null, null); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("createdDateTime").ToString()); +Console.WriteLine(result.GetProperty("jobId").ToString()); +Console.WriteLine(result.GetProperty("lastUpdatedDateTime").ToString()); +Console.WriteLine(result.GetProperty("status").ToString()); +Console.WriteLine(result.GetProperty("tasks").GetProperty("completed").ToString()); +Console.WriteLine(result.GetProperty("tasks").GetProperty("failed").ToString()); +Console.WriteLine(result.GetProperty("tasks").GetProperty("inProgress").ToString()); +Console.WriteLine(result.GetProperty("tasks").GetProperty("total").ToString()); +]]> +This sample shows how to call GetAnalyzeConversationJobStatus and parse the result. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +ConversationAnalysisClient client = new ConversationAnalysisClient(endpoint, credential); + Response response = client.GetAnalyzeConversationJobStatus(Guid.Parse("3e9e8518-492f-47f9-abd1-9a7468231086"), null, null); JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; @@ -711,12 +867,13 @@ AnalyzeConversationOperationInput analyzeConversationOperationInput = new Analyz { new PiiOperationAction { - ActionContent = new ConversationPiiActionContent + ActionContent = new PiiActionContent { ModelVersion = "latest", + PiiCategories = {ConversationPiiCategories.All}, RedactAudioTiming = true, RedactionSource = TranscriptContentType.Lexical, - ExcludePiiCategories = {ConversationPiiCategoryExclusions.Person}, + RedactionPolicy = new DoNotRedactPolicyType(), }, Name = "Conversation PII", } @@ -774,13 +931,12 @@ AnalyzeConversationOperationInput analyzeConversationOperationInput = new Analyz { new PiiOperationAction { - ActionContent = new ConversationPiiActionContent + ActionContent = new PiiActionContent { ModelVersion = "latest", - PiiCategories = {ConversationPiiCategories.All}, RedactAudioTiming = true, RedactionSource = TranscriptContentType.Lexical, - RedactionCharacter = RedactionCharacter.Minus, + ExcludePiiCategories = {ConversationPiiCategoryExclusions.Person}, }, Name = "Conversation PII", } @@ -838,12 +994,13 @@ AnalyzeConversationOperationInput analyzeConversationOperationInput = new Analyz { new PiiOperationAction { - ActionContent = new ConversationPiiActionContent + ActionContent = new PiiActionContent { ModelVersion = "latest", PiiCategories = {ConversationPiiCategories.All}, RedactAudioTiming = true, RedactionSource = TranscriptContentType.Lexical, + RedactionPolicy = new MaskWithEntityTypePolicyType(), }, Name = "Conversation PII", } @@ -865,57 +1022,58 @@ AnalyzeConversationOperationInput analyzeConversationOperationInput = new Analyz { new TranscriptConversationItem( "1", - "speaker 1", - "", - "", - "Let's get started.", - "") + "1", + "good morning john doe", + "good morning john doe", + "Good morning John Doe.", + "good morning john doe") { - ConversationItemLevelTiming = new ConversationItemLevelTiming + WordLevelTimings = {new WordLevelTiming { - Offset = 0L, - Duration = 20000000L, - }, - }, - new TranscriptConversationItem( - "2", - "speaker 2", - "", - "", - "OK. How many remaining bugs do we have now?", - "") - { - ConversationItemLevelTiming = new ConversationItemLevelTiming + Offset = 390000L, + Duration = 2700000L, + Word = "good", + }, new WordLevelTiming { - Offset = 20000000L, - Duration = 50000000L, - }, - }, - new TranscriptConversationItem( - "3", - "speaker 3", - "", - "", - "Only 3.", - "") - { - ConversationItemLevelTiming = new ConversationItemLevelTiming + Offset = 4500000L, + Duration = 920000L, + Word = "morning", + }, new WordLevelTiming { - Offset = 50000000L, - Duration = 60000000L, - }, + Offset = 590000L, + Duration = 2700000L, + Word = "john", + }, new WordLevelTiming + { + Offset = 6300000L, + Duration = 920000L, + Word = "doe", + }}, } }) + { + Domain = ConversationDomain.Generic, + } }), new AnalyzeConversationOperationAction[] { - new SummarizationOperationAction + new PiiOperationAction { - ActionContent = new ConversationSummarizationActionContent(new SummaryAspect[]{SummaryAspect.ChapterTitle, SummaryAspect.Narrative}), - Name = "Conversation Summarization Task 1", + ActionContent = new PiiActionContent + { + ModelVersion = "latest", + PiiCategories = {ConversationPiiCategories.All}, + RedactAudioTiming = true, + RedactionSource = TranscriptContentType.Lexical, + RedactionPolicy = new MaskWithRedactionCharacterPolicyType + { + RedactionCharacter = RedactionCharacter.Minus, + }, + }, + Name = "Conversation PII", } }) { - DisplayName = "Conversation Summarization Example", + DisplayName = "Redacting PII data from transcribed audio", }; Operation operation = await client.AnalyzeConversationSubmitOperationAsync(WaitUntil.Completed, analyzeConversationOperationInput); ]]> @@ -927,19 +1085,212 @@ ConversationAnalysisClient client = new ConversationAnalysisClient(endpoint, cre AnalyzeConversationOperationInput analyzeConversationOperationInput = new AnalyzeConversationOperationInput(new MultiLanguageConversationInput(new ConversationInput[] { - new TextConversation("20220101meeting", "en", new TextConversationItem[] + new TranscriptConversation("1", "en", new TranscriptConversationItem[] { - new TextConversationItem("1", "user", "Hi!") - { - Role = ParticipantRole.Customer, - }, - new TextConversationItem("2", "agent", "Hello, how can I help you?") - { - Role = ParticipantRole.Agent, - }, - new TextConversationItem("3", "user", "I am having trouble issuing a return of a game on my xbox: call of duty") + new TranscriptConversationItem( + "1", + "1", + "good morning john doe", + "good morning john doe", + "Good morning John Doe.", + "good morning john doe") { - Role = ParticipantRole.Customer, + WordLevelTimings = {new WordLevelTiming + { + Offset = 390000L, + Duration = 2700000L, + Word = "good", + }, new WordLevelTiming + { + Offset = 4500000L, + Duration = 920000L, + Word = "morning", + }, new WordLevelTiming + { + Offset = 590000L, + Duration = 2700000L, + Word = "john", + }, new WordLevelTiming + { + Offset = 6300000L, + Duration = 920000L, + Word = "doe", + }}, + } + }) + { + Domain = ConversationDomain.Generic, + } +}), new AnalyzeConversationOperationAction[] +{ + new PiiOperationAction + { + ActionContent = new PiiActionContent + { + ModelVersion = "latest", + PiiCategories = {ConversationPiiCategories.All}, + RedactAudioTiming = true, + RedactionSource = TranscriptContentType.Lexical, + RedactionCharacter = RedactionCharacter.Minus, + }, + Name = "Conversation PII", + } +}) +{ + DisplayName = "Redacting PII data from transcribed audio", +}; +Operation operation = await client.AnalyzeConversationSubmitOperationAsync(WaitUntil.Completed, analyzeConversationOperationInput); +]]> +This sample shows how to call AnalyzeConversationSubmitOperationAsync. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +ConversationAnalysisClient client = new ConversationAnalysisClient(endpoint, credential); + +AnalyzeConversationOperationInput analyzeConversationOperationInput = new AnalyzeConversationOperationInput(new MultiLanguageConversationInput(new ConversationInput[] +{ + new TranscriptConversation("1", "en", new TranscriptConversationItem[] + { + new TranscriptConversationItem( + "1", + "1", + "good morning john doe", + "good morning john doe", + "Good morning John Doe.", + "good morning john doe") + { + WordLevelTimings = {new WordLevelTiming + { + Offset = 390000L, + Duration = 2700000L, + Word = "good", + }, new WordLevelTiming + { + Offset = 4500000L, + Duration = 920000L, + Word = "morning", + }, new WordLevelTiming + { + Offset = 590000L, + Duration = 2700000L, + Word = "john", + }, new WordLevelTiming + { + Offset = 6300000L, + Duration = 920000L, + Word = "doe", + }}, + } + }) + { + Domain = ConversationDomain.Generic, + } +}), new AnalyzeConversationOperationAction[] +{ + new PiiOperationAction + { + ActionContent = new PiiActionContent + { + ModelVersion = "latest", + PiiCategories = {ConversationPiiCategories.All}, + RedactAudioTiming = true, + RedactionSource = TranscriptContentType.Lexical, + }, + Name = "Conversation PII", + } +}) +{ + DisplayName = "Redacting PII data from transcribed audio", +}; +Operation operation = await client.AnalyzeConversationSubmitOperationAsync(WaitUntil.Completed, analyzeConversationOperationInput); +]]> +This sample shows how to call AnalyzeConversationSubmitOperationAsync. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +ConversationAnalysisClient client = new ConversationAnalysisClient(endpoint, credential); + +AnalyzeConversationOperationInput analyzeConversationOperationInput = new AnalyzeConversationOperationInput(new MultiLanguageConversationInput(new ConversationInput[] +{ + new TranscriptConversation("1", "en", new TranscriptConversationItem[] + { + new TranscriptConversationItem( + "1", + "speaker 1", + "", + "", + "Let's get started.", + "") + { + ConversationItemLevelTiming = new ConversationItemLevelTiming + { + Offset = 0L, + Duration = 20000000L, + }, + }, + new TranscriptConversationItem( + "2", + "speaker 2", + "", + "", + "OK. How many remaining bugs do we have now?", + "") + { + ConversationItemLevelTiming = new ConversationItemLevelTiming + { + Offset = 20000000L, + Duration = 50000000L, + }, + }, + new TranscriptConversationItem( + "3", + "speaker 3", + "", + "", + "Only 3.", + "") + { + ConversationItemLevelTiming = new ConversationItemLevelTiming + { + Offset = 50000000L, + Duration = 60000000L, + }, + } + }) +}), new AnalyzeConversationOperationAction[] +{ + new SummarizationOperationAction + { + ActionContent = new ConversationSummarizationActionContent(new SummaryAspect[]{SummaryAspect.ChapterTitle, SummaryAspect.Narrative}), + Name = "Conversation Summarization Task 1", + } +}) +{ + DisplayName = "Conversation Summarization Example", +}; +Operation operation = await client.AnalyzeConversationSubmitOperationAsync(WaitUntil.Completed, analyzeConversationOperationInput); +]]> +This sample shows how to call AnalyzeConversationSubmitOperationAsync. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +ConversationAnalysisClient client = new ConversationAnalysisClient(endpoint, credential); + +AnalyzeConversationOperationInput analyzeConversationOperationInput = new AnalyzeConversationOperationInput(new MultiLanguageConversationInput(new ConversationInput[] +{ + new TextConversation("20220101meeting", "en", new TextConversationItem[] + { + new TextConversationItem("1", "user", "Hi!") + { + Role = ParticipantRole.Customer, + }, + new TextConversationItem("2", "agent", "Hello, how can I help you?") + { + Role = ParticipantRole.Agent, + }, + new TextConversationItem("3", "user", "I am having trouble issuing a return of a game on my xbox: call of duty") + { + Role = ParticipantRole.Customer, } }) { @@ -1078,12 +1429,207 @@ AnalyzeConversationOperationInput analyzeConversationOperationInput = new Analyz { new PiiOperationAction { - ActionContent = new ConversationPiiActionContent + ActionContent = new PiiActionContent + { + ModelVersion = "latest", + PiiCategories = {ConversationPiiCategories.All}, + RedactAudioTiming = true, + RedactionSource = TranscriptContentType.Lexical, + RedactionPolicy = new DoNotRedactPolicyType(), + }, + Name = "Conversation PII", + } +}) +{ + DisplayName = "Redacting PII data from transcribed audio", +}; +Operation operation = client.AnalyzeConversationSubmitOperation(WaitUntil.Completed, analyzeConversationOperationInput); +]]> +This sample shows how to call AnalyzeConversationSubmitOperation. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +ConversationAnalysisClient client = new ConversationAnalysisClient(endpoint, credential); + +AnalyzeConversationOperationInput analyzeConversationOperationInput = new AnalyzeConversationOperationInput(new MultiLanguageConversationInput(new ConversationInput[] +{ + new TranscriptConversation("1", "en", new TranscriptConversationItem[] + { + new TranscriptConversationItem( + "1", + "1", + "good morning john doe", + "good morning john doe", + "Good morning John Doe.", + "good morning john doe") + { + WordLevelTimings = {new WordLevelTiming + { + Offset = 390000L, + Duration = 2700000L, + Word = "good", + }, new WordLevelTiming + { + Offset = 4500000L, + Duration = 920000L, + Word = "morning", + }, new WordLevelTiming + { + Offset = 590000L, + Duration = 2700000L, + Word = "john", + }, new WordLevelTiming + { + Offset = 6300000L, + Duration = 920000L, + Word = "doe", + }}, + } + }) + { + Domain = ConversationDomain.Generic, + } +}), new AnalyzeConversationOperationAction[] +{ + new PiiOperationAction + { + ActionContent = new PiiActionContent + { + ModelVersion = "latest", + RedactAudioTiming = true, + RedactionSource = TranscriptContentType.Lexical, + ExcludePiiCategories = {ConversationPiiCategoryExclusions.Person}, + }, + Name = "Conversation PII", + } +}) +{ + DisplayName = "Redacting PII data from transcribed audio", +}; +Operation operation = client.AnalyzeConversationSubmitOperation(WaitUntil.Completed, analyzeConversationOperationInput); +]]> +This sample shows how to call AnalyzeConversationSubmitOperation. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +ConversationAnalysisClient client = new ConversationAnalysisClient(endpoint, credential); + +AnalyzeConversationOperationInput analyzeConversationOperationInput = new AnalyzeConversationOperationInput(new MultiLanguageConversationInput(new ConversationInput[] +{ + new TranscriptConversation("1", "en", new TranscriptConversationItem[] + { + new TranscriptConversationItem( + "1", + "1", + "good morning john doe", + "good morning john doe", + "Good morning John Doe.", + "good morning john doe") + { + WordLevelTimings = {new WordLevelTiming + { + Offset = 390000L, + Duration = 2700000L, + Word = "good", + }, new WordLevelTiming + { + Offset = 4500000L, + Duration = 920000L, + Word = "morning", + }, new WordLevelTiming + { + Offset = 590000L, + Duration = 2700000L, + Word = "john", + }, new WordLevelTiming + { + Offset = 6300000L, + Duration = 920000L, + Word = "doe", + }}, + } + }) + { + Domain = ConversationDomain.Generic, + } +}), new AnalyzeConversationOperationAction[] +{ + new PiiOperationAction + { + ActionContent = new PiiActionContent + { + ModelVersion = "latest", + PiiCategories = {ConversationPiiCategories.All}, + RedactAudioTiming = true, + RedactionSource = TranscriptContentType.Lexical, + RedactionPolicy = new MaskWithEntityTypePolicyType(), + }, + Name = "Conversation PII", + } +}) +{ + DisplayName = "Redacting PII data from transcribed audio", +}; +Operation operation = client.AnalyzeConversationSubmitOperation(WaitUntil.Completed, analyzeConversationOperationInput); +]]> +This sample shows how to call AnalyzeConversationSubmitOperation. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +ConversationAnalysisClient client = new ConversationAnalysisClient(endpoint, credential); + +AnalyzeConversationOperationInput analyzeConversationOperationInput = new AnalyzeConversationOperationInput(new MultiLanguageConversationInput(new ConversationInput[] +{ + new TranscriptConversation("1", "en", new TranscriptConversationItem[] + { + new TranscriptConversationItem( + "1", + "1", + "good morning john doe", + "good morning john doe", + "Good morning John Doe.", + "good morning john doe") + { + WordLevelTimings = {new WordLevelTiming + { + Offset = 390000L, + Duration = 2700000L, + Word = "good", + }, new WordLevelTiming + { + Offset = 4500000L, + Duration = 920000L, + Word = "morning", + }, new WordLevelTiming + { + Offset = 590000L, + Duration = 2700000L, + Word = "john", + }, new WordLevelTiming + { + Offset = 6300000L, + Duration = 920000L, + Word = "doe", + }}, + } + }) + { + Domain = ConversationDomain.Generic, + } +}), new AnalyzeConversationOperationAction[] +{ + new PiiOperationAction + { + ActionContent = new PiiActionContent { ModelVersion = "latest", + PiiCategories = {ConversationPiiCategories.All}, RedactAudioTiming = true, RedactionSource = TranscriptContentType.Lexical, - ExcludePiiCategories = {ConversationPiiCategoryExclusions.Person}, + RedactionPolicy = new MaskWithRedactionCharacterPolicyType + { + RedactionCharacter = RedactionCharacter.Minus, + }, }, Name = "Conversation PII", } @@ -1141,7 +1687,7 @@ AnalyzeConversationOperationInput analyzeConversationOperationInput = new Analyz { new PiiOperationAction { - ActionContent = new ConversationPiiActionContent + ActionContent = new PiiActionContent { ModelVersion = "latest", PiiCategories = {ConversationPiiCategories.All}, @@ -1205,7 +1751,7 @@ AnalyzeConversationOperationInput analyzeConversationOperationInput = new Analyz { new PiiOperationAction { - ActionContent = new ConversationPiiActionContent + ActionContent = new PiiActionContent { ModelVersion = "latest", PiiCategories = {ConversationPiiCategories.All}, @@ -1403,6 +1949,92 @@ Uri endpoint = new Uri(""); AzureKeyCredential credential = new AzureKeyCredential(""); ConversationAnalysisClient client = new ConversationAnalysisClient(endpoint, credential); +using RequestContent content = RequestContent.Create(new +{ + displayName = "Redacting PII data from transcribed audio", + analysisInput = new + { + conversations = new object[] + { + new + { + id = "1", + language = "en", + modality = "transcript", + domain = "generic", + conversationItems = new object[] + { + new + { + participantId = "1", + id = "1", + text = "Good morning John Doe.", + itn = "good morning john doe", + maskedItn = "good morning john doe", + lexical = "good morning john doe", + wordLevelTimings = new object[] + { + new + { + word = "good", + offset = 390000L, + duration = 2700000L, + }, + new + { + word = "morning", + offset = 4500000L, + duration = 920000L, + }, + new + { + word = "john", + offset = 590000L, + duration = 2700000L, + }, + new + { + word = "doe", + offset = 6300000L, + duration = 920000L, + } + }, + } + }, + } + }, + }, + tasks = new object[] + { + new + { + taskName = "Conversation PII", + kind = "ConversationalPIITask", + parameters = new + { + modelVersion = "latest", + piiCategories = new object[] + { + "All" + }, + redactionPolicy = new + { + policyKind = "DoNotRedact", + }, + redactionSource = "lexical", + redactAudioTiming = true, + }, + } + }, +}); +Operation operation = await client.AnalyzeConversationSubmitOperationAsync(WaitUntil.Completed, content); +]]> +This sample shows how to call AnalyzeConversationSubmitOperationAsync. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +ConversationAnalysisClient client = new ConversationAnalysisClient(endpoint, credential); + using RequestContent content = RequestContent.Create(new { displayName = "Redacting PII data from transcribed audio", @@ -1469,7 +2101,180 @@ using RequestContent content = RequestContent.Create(new modelVersion = "latest", excludePiiCategories = new object[] { - "Person" + "Person" + }, + redactionSource = "lexical", + redactAudioTiming = true, + }, + } + }, +}); +Operation operation = await client.AnalyzeConversationSubmitOperationAsync(WaitUntil.Completed, content); +]]> +This sample shows how to call AnalyzeConversationSubmitOperationAsync. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +ConversationAnalysisClient client = new ConversationAnalysisClient(endpoint, credential); + +using RequestContent content = RequestContent.Create(new +{ + displayName = "Redacting PII data from transcribed audio", + analysisInput = new + { + conversations = new object[] + { + new + { + id = "1", + language = "en", + modality = "transcript", + domain = "generic", + conversationItems = new object[] + { + new + { + participantId = "1", + id = "1", + text = "Good morning John Doe.", + itn = "good morning john doe", + maskedItn = "good morning john doe", + lexical = "good morning john doe", + wordLevelTimings = new object[] + { + new + { + word = "good", + offset = 390000L, + duration = 2700000L, + }, + new + { + word = "morning", + offset = 4500000L, + duration = 920000L, + }, + new + { + word = "john", + offset = 590000L, + duration = 2700000L, + }, + new + { + word = "doe", + offset = 6300000L, + duration = 920000L, + } + }, + } + }, + } + }, + }, + tasks = new object[] + { + new + { + taskName = "Conversation PII", + kind = "ConversationalPIITask", + parameters = new + { + modelVersion = "latest", + piiCategories = new object[] + { + "All" + }, + redactionPolicy = new + { + policyKind = "MaskWithEntityType", + }, + redactionSource = "lexical", + redactAudioTiming = true, + }, + } + }, +}); +Operation operation = await client.AnalyzeConversationSubmitOperationAsync(WaitUntil.Completed, content); +]]> +This sample shows how to call AnalyzeConversationSubmitOperationAsync. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +ConversationAnalysisClient client = new ConversationAnalysisClient(endpoint, credential); + +using RequestContent content = RequestContent.Create(new +{ + displayName = "Redacting PII data from transcribed audio", + analysisInput = new + { + conversations = new object[] + { + new + { + id = "1", + language = "en", + modality = "transcript", + domain = "generic", + conversationItems = new object[] + { + new + { + participantId = "1", + id = "1", + text = "Good morning John Doe.", + itn = "good morning john doe", + maskedItn = "good morning john doe", + lexical = "good morning john doe", + wordLevelTimings = new object[] + { + new + { + word = "good", + offset = 390000L, + duration = 2700000L, + }, + new + { + word = "morning", + offset = 4500000L, + duration = 920000L, + }, + new + { + word = "john", + offset = 590000L, + duration = 2700000L, + }, + new + { + word = "doe", + offset = 6300000L, + duration = 920000L, + } + }, + } + }, + } + }, + }, + tasks = new object[] + { + new + { + taskName = "Conversation PII", + kind = "ConversationalPIITask", + parameters = new + { + modelVersion = "latest", + piiCategories = new object[] + { + "All" + }, + redactionPolicy = new + { + policyKind = "MaskWithRedactionCharacter", + redactionCharacter = "-", }, redactionSource = "lexical", redactAudioTiming = true, @@ -1890,6 +2695,92 @@ Uri endpoint = new Uri(""); AzureKeyCredential credential = new AzureKeyCredential(""); ConversationAnalysisClient client = new ConversationAnalysisClient(endpoint, credential); +using RequestContent content = RequestContent.Create(new +{ + displayName = "Redacting PII data from transcribed audio", + analysisInput = new + { + conversations = new object[] + { + new + { + id = "1", + language = "en", + modality = "transcript", + domain = "generic", + conversationItems = new object[] + { + new + { + participantId = "1", + id = "1", + text = "Good morning John Doe.", + itn = "good morning john doe", + maskedItn = "good morning john doe", + lexical = "good morning john doe", + wordLevelTimings = new object[] + { + new + { + word = "good", + offset = 390000L, + duration = 2700000L, + }, + new + { + word = "morning", + offset = 4500000L, + duration = 920000L, + }, + new + { + word = "john", + offset = 590000L, + duration = 2700000L, + }, + new + { + word = "doe", + offset = 6300000L, + duration = 920000L, + } + }, + } + }, + } + }, + }, + tasks = new object[] + { + new + { + taskName = "Conversation PII", + kind = "ConversationalPIITask", + parameters = new + { + modelVersion = "latest", + piiCategories = new object[] + { + "All" + }, + redactionPolicy = new + { + policyKind = "DoNotRedact", + }, + redactionSource = "lexical", + redactAudioTiming = true, + }, + } + }, +}); +Operation operation = client.AnalyzeConversationSubmitOperation(WaitUntil.Completed, content); +]]> +This sample shows how to call AnalyzeConversationSubmitOperation. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +ConversationAnalysisClient client = new ConversationAnalysisClient(endpoint, credential); + using RequestContent content = RequestContent.Create(new { displayName = "Redacting PII data from transcribed audio", @@ -1972,6 +2863,179 @@ Uri endpoint = new Uri(""); AzureKeyCredential credential = new AzureKeyCredential(""); ConversationAnalysisClient client = new ConversationAnalysisClient(endpoint, credential); +using RequestContent content = RequestContent.Create(new +{ + displayName = "Redacting PII data from transcribed audio", + analysisInput = new + { + conversations = new object[] + { + new + { + id = "1", + language = "en", + modality = "transcript", + domain = "generic", + conversationItems = new object[] + { + new + { + participantId = "1", + id = "1", + text = "Good morning John Doe.", + itn = "good morning john doe", + maskedItn = "good morning john doe", + lexical = "good morning john doe", + wordLevelTimings = new object[] + { + new + { + word = "good", + offset = 390000L, + duration = 2700000L, + }, + new + { + word = "morning", + offset = 4500000L, + duration = 920000L, + }, + new + { + word = "john", + offset = 590000L, + duration = 2700000L, + }, + new + { + word = "doe", + offset = 6300000L, + duration = 920000L, + } + }, + } + }, + } + }, + }, + tasks = new object[] + { + new + { + taskName = "Conversation PII", + kind = "ConversationalPIITask", + parameters = new + { + modelVersion = "latest", + piiCategories = new object[] + { + "All" + }, + redactionPolicy = new + { + policyKind = "MaskWithEntityType", + }, + redactionSource = "lexical", + redactAudioTiming = true, + }, + } + }, +}); +Operation operation = client.AnalyzeConversationSubmitOperation(WaitUntil.Completed, content); +]]> +This sample shows how to call AnalyzeConversationSubmitOperation. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +ConversationAnalysisClient client = new ConversationAnalysisClient(endpoint, credential); + +using RequestContent content = RequestContent.Create(new +{ + displayName = "Redacting PII data from transcribed audio", + analysisInput = new + { + conversations = new object[] + { + new + { + id = "1", + language = "en", + modality = "transcript", + domain = "generic", + conversationItems = new object[] + { + new + { + participantId = "1", + id = "1", + text = "Good morning John Doe.", + itn = "good morning john doe", + maskedItn = "good morning john doe", + lexical = "good morning john doe", + wordLevelTimings = new object[] + { + new + { + word = "good", + offset = 390000L, + duration = 2700000L, + }, + new + { + word = "morning", + offset = 4500000L, + duration = 920000L, + }, + new + { + word = "john", + offset = 590000L, + duration = 2700000L, + }, + new + { + word = "doe", + offset = 6300000L, + duration = 920000L, + } + }, + } + }, + } + }, + }, + tasks = new object[] + { + new + { + taskName = "Conversation PII", + kind = "ConversationalPIITask", + parameters = new + { + modelVersion = "latest", + piiCategories = new object[] + { + "All" + }, + redactionPolicy = new + { + policyKind = "MaskWithRedactionCharacter", + redactionCharacter = "-", + }, + redactionSource = "lexical", + redactAudioTiming = true, + }, + } + }, +}); +Operation operation = client.AnalyzeConversationSubmitOperation(WaitUntil.Completed, content); +]]> +This sample shows how to call AnalyzeConversationSubmitOperation. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +ConversationAnalysisClient client = new ConversationAnalysisClient(endpoint, credential); + using RequestContent content = RequestContent.Create(new { displayName = "Redacting PII data from transcribed audio", diff --git a/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/BaseRedactionPolicy.Serialization.cs b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/BaseRedactionPolicy.Serialization.cs new file mode 100644 index 000000000000..486879f9da8c --- /dev/null +++ b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/BaseRedactionPolicy.Serialization.cs @@ -0,0 +1,135 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Text.Json; +using Azure.Core; + +namespace Azure.AI.Language.Conversations.Models +{ + [PersistableModelProxy(typeof(UnknownBaseRedactionPolicy))] + public partial class BaseRedactionPolicy : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(BaseRedactionPolicy)} does not support writing '{format}' format."); + } + + writer.WritePropertyName("policyKind"u8); + writer.WriteStringValue(PolicyKind.ToString()); + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + BaseRedactionPolicy IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(BaseRedactionPolicy)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeBaseRedactionPolicy(document.RootElement, options); + } + + internal static BaseRedactionPolicy DeserializeBaseRedactionPolicy(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + if (element.TryGetProperty("policyKind", out JsonElement discriminator)) + { + switch (discriminator.GetString()) + { + case "DoNotRedact": return DoNotRedactPolicyType.DeserializeDoNotRedactPolicyType(element, options); + case "MaskWithEntityType": return MaskWithEntityTypePolicyType.DeserializeMaskWithEntityTypePolicyType(element, options); + case "MaskWithRedactionCharacter": return MaskWithRedactionCharacterPolicyType.DeserializeMaskWithRedactionCharacterPolicyType(element, options); + } + } + return UnknownBaseRedactionPolicy.DeserializeUnknownBaseRedactionPolicy(element, options); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(BaseRedactionPolicy)} does not support writing '{options.Format}' format."); + } + } + + BaseRedactionPolicy IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeBaseRedactionPolicy(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(BaseRedactionPolicy)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static BaseRedactionPolicy FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeBaseRedactionPolicy(document.RootElement); + } + + /// Convert into a . + internal virtual RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/BaseRedactionPolicy.cs b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/BaseRedactionPolicy.cs new file mode 100644 index 000000000000..cdb2c5d1ee29 --- /dev/null +++ b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/BaseRedactionPolicy.cs @@ -0,0 +1,69 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.AI.Language.Conversations.Models +{ + /// + /// The abstract base class for RedactionPolicy. + /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. + /// The available derived classes include , and . + /// + public abstract partial class BaseRedactionPolicy + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private protected IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + protected BaseRedactionPolicy() + { + } + + /// Initializes a new instance of . + /// The entity RedactionPolicy object kind. + /// Keeps track of any properties unknown to the library. + internal BaseRedactionPolicy(RedactionPolicyKind policyKind, IDictionary serializedAdditionalRawData) + { + PolicyKind = policyKind; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// The entity RedactionPolicy object kind. + internal RedactionPolicyKind PolicyKind { get; set; } + } +} diff --git a/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/ConversationLanguageUnderstandingActionContent.Serialization.cs b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/ConversationActionContent.Serialization.cs similarity index 76% rename from sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/ConversationLanguageUnderstandingActionContent.Serialization.cs rename to sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/ConversationActionContent.Serialization.cs index fb1b2203c25d..718e2a950608 100644 --- a/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/ConversationLanguageUnderstandingActionContent.Serialization.cs +++ b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/ConversationActionContent.Serialization.cs @@ -13,11 +13,11 @@ namespace Azure.AI.Language.Conversations.Models { - public partial class ConversationLanguageUnderstandingActionContent : IUtf8JsonSerializable, IJsonModel + public partial class ConversationActionContent : IUtf8JsonSerializable, IJsonModel { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); - void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) { writer.WriteStartObject(); JsonModelWriteCore(writer, options); @@ -28,10 +28,10 @@ void IJsonModel.Write(Utf8JsonWr /// The client options for reading and writing models. protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") { - throw new FormatException($"The model {nameof(ConversationLanguageUnderstandingActionContent)} does not support writing '{format}' format."); + throw new FormatException($"The model {nameof(ConversationActionContent)} does not support writing '{format}' format."); } writer.WritePropertyName("projectName"u8); @@ -86,19 +86,19 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit } } - ConversationLanguageUnderstandingActionContent IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + ConversationActionContent IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") { - throw new FormatException($"The model {nameof(ConversationLanguageUnderstandingActionContent)} does not support reading '{format}' format."); + throw new FormatException($"The model {nameof(ConversationActionContent)} does not support reading '{format}' format."); } using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeConversationLanguageUnderstandingActionContent(document.RootElement, options); + return DeserializeConversationActionContent(document.RootElement, options); } - internal static ConversationLanguageUnderstandingActionContent DeserializeConversationLanguageUnderstandingActionContent(JsonElement element, ModelReaderWriterOptions options = null) + internal static ConversationActionContent DeserializeConversationActionContent(JsonElement element, ModelReaderWriterOptions options = null) { options ??= ModelSerializationExtensions.WireOptions; @@ -179,7 +179,7 @@ internal static ConversationLanguageUnderstandingActionContent DeserializeConver } } serializedAdditionalRawData = rawDataDictionary; - return new ConversationLanguageUnderstandingActionContent( + return new ConversationActionContent( projectName, deploymentName, verbose, @@ -190,43 +190,43 @@ internal static ConversationLanguageUnderstandingActionContent DeserializeConver serializedAdditionalRawData); } - BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; switch (format) { case "J": return ModelReaderWriter.Write(this, options); default: - throw new FormatException($"The model {nameof(ConversationLanguageUnderstandingActionContent)} does not support writing '{options.Format}' format."); + throw new FormatException($"The model {nameof(ConversationActionContent)} does not support writing '{options.Format}' format."); } } - ConversationLanguageUnderstandingActionContent IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + ConversationActionContent IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; switch (format) { case "J": { using JsonDocument document = JsonDocument.Parse(data); - return DeserializeConversationLanguageUnderstandingActionContent(document.RootElement, options); + return DeserializeConversationActionContent(document.RootElement, options); } default: - throw new FormatException($"The model {nameof(ConversationLanguageUnderstandingActionContent)} does not support reading '{options.Format}' format."); + throw new FormatException($"The model {nameof(ConversationActionContent)} does not support reading '{options.Format}' format."); } } - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; /// Deserializes the model from a raw response. /// The response to deserialize the model from. - internal static ConversationLanguageUnderstandingActionContent FromResponse(Response response) + internal static ConversationActionContent FromResponse(Response response) { using var document = JsonDocument.Parse(response.Content); - return DeserializeConversationLanguageUnderstandingActionContent(document.RootElement); + return DeserializeConversationActionContent(document.RootElement); } /// Convert into a . diff --git a/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/ConversationLanguageUnderstandingActionContent.cs b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/ConversationActionContent.cs similarity index 88% rename from sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/ConversationLanguageUnderstandingActionContent.cs rename to sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/ConversationActionContent.cs index f2bda2bab4e6..84b590eb52f5 100644 --- a/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/ConversationLanguageUnderstandingActionContent.cs +++ b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/ConversationActionContent.cs @@ -11,7 +11,7 @@ namespace Azure.AI.Language.Conversations.Models { /// Input parameters necessary for a Conversation task. - public partial class ConversationLanguageUnderstandingActionContent + public partial class ConversationActionContent { /// /// Keeps track of any properties unknown to the library. @@ -45,11 +45,11 @@ public partial class ConversationLanguageUnderstandingActionContent /// private IDictionary _serializedAdditionalRawData; - /// Initializes a new instance of . + /// Initializes a new instance of . /// The name of the project to use. /// The name of the deployment to use. /// or is null. - public ConversationLanguageUnderstandingActionContent(string projectName, string deploymentName) + public ConversationActionContent(string projectName, string deploymentName) { Argument.AssertNotNull(projectName, nameof(projectName)); Argument.AssertNotNull(deploymentName, nameof(deploymentName)); @@ -59,7 +59,7 @@ public ConversationLanguageUnderstandingActionContent(string projectName, string TargetProjectParameters = new ChangeTrackingDictionary(); } - /// Initializes a new instance of . + /// Initializes a new instance of . /// The name of the project to use. /// The name of the deployment to use. /// If true, the service will return more detailed information in the response. @@ -72,7 +72,7 @@ public ConversationLanguageUnderstandingActionContent(string projectName, string /// The available derived classes include , and . /// /// Keeps track of any properties unknown to the library. - internal ConversationLanguageUnderstandingActionContent(string projectName, string deploymentName, bool? verbose, bool? isLoggingEnabled, StringIndexType? stringIndexType, string directTarget, IDictionary targetProjectParameters, IDictionary serializedAdditionalRawData) + internal ConversationActionContent(string projectName, string deploymentName, bool? verbose, bool? isLoggingEnabled, StringIndexType? stringIndexType, string directTarget, IDictionary targetProjectParameters, IDictionary serializedAdditionalRawData) { ProjectName = projectName; DeploymentName = deploymentName; @@ -84,8 +84,8 @@ internal ConversationLanguageUnderstandingActionContent(string projectName, stri _serializedAdditionalRawData = serializedAdditionalRawData; } - /// Initializes a new instance of for deserialization. - internal ConversationLanguageUnderstandingActionContent() + /// Initializes a new instance of for deserialization. + internal ConversationActionContent() { } diff --git a/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/ConversationLanguageUnderstandingInput.Serialization.cs b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/ConversationLanguageUnderstandingInput.Serialization.cs index 65a0873b21fd..58f10004bfc4 100644 --- a/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/ConversationLanguageUnderstandingInput.Serialization.cs +++ b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/ConversationLanguageUnderstandingInput.Serialization.cs @@ -62,7 +62,7 @@ internal static ConversationLanguageUnderstandingInput DeserializeConversationLa return null; } ConversationAnalysisInput analysisInput = default; - ConversationLanguageUnderstandingActionContent parameters = default; + ConversationActionContent parameters = default; AnalyzeConversationInputKind kind = default; IDictionary serializedAdditionalRawData = default; Dictionary rawDataDictionary = new Dictionary(); @@ -75,7 +75,7 @@ internal static ConversationLanguageUnderstandingInput DeserializeConversationLa } if (property.NameEquals("parameters"u8)) { - parameters = ConversationLanguageUnderstandingActionContent.DeserializeConversationLanguageUnderstandingActionContent(property.Value, options); + parameters = ConversationActionContent.DeserializeConversationActionContent(property.Value, options); continue; } if (property.NameEquals("kind"u8)) diff --git a/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/ConversationLanguageUnderstandingInput.cs b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/ConversationLanguageUnderstandingInput.cs index 95872fc6fca7..870c70b61e56 100644 --- a/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/ConversationLanguageUnderstandingInput.cs +++ b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/ConversationLanguageUnderstandingInput.cs @@ -17,7 +17,7 @@ public partial class ConversationLanguageUnderstandingInput : AnalyzeConversatio /// The input ConversationItem and its optional parameters. /// Input parameters necessary for a Conversation language understanding task. /// or is null. - public ConversationLanguageUnderstandingInput(ConversationAnalysisInput conversationInput, ConversationLanguageUnderstandingActionContent actionContent) + public ConversationLanguageUnderstandingInput(ConversationAnalysisInput conversationInput, ConversationActionContent actionContent) { Argument.AssertNotNull(conversationInput, nameof(conversationInput)); Argument.AssertNotNull(actionContent, nameof(actionContent)); @@ -32,7 +32,7 @@ public ConversationLanguageUnderstandingInput(ConversationAnalysisInput conversa /// Keeps track of any properties unknown to the library. /// The input ConversationItem and its optional parameters. /// Input parameters necessary for a Conversation language understanding task. - internal ConversationLanguageUnderstandingInput(AnalyzeConversationInputKind kind, IDictionary serializedAdditionalRawData, ConversationAnalysisInput conversationInput, ConversationLanguageUnderstandingActionContent actionContent) : base(kind, serializedAdditionalRawData) + internal ConversationLanguageUnderstandingInput(AnalyzeConversationInputKind kind, IDictionary serializedAdditionalRawData, ConversationAnalysisInput conversationInput, ConversationActionContent actionContent) : base(kind, serializedAdditionalRawData) { ConversationInput = conversationInput; ActionContent = actionContent; @@ -46,6 +46,6 @@ internal ConversationLanguageUnderstandingInput() /// The input ConversationItem and its optional parameters. public ConversationAnalysisInput ConversationInput { get; } /// Input parameters necessary for a Conversation language understanding task. - public ConversationLanguageUnderstandingActionContent ActionContent { get; } + public ConversationActionContent ActionContent { get; } } } diff --git a/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/DoNotRedactPolicyType.Serialization.cs b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/DoNotRedactPolicyType.Serialization.cs new file mode 100644 index 000000000000..c54c187fd7f4 --- /dev/null +++ b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/DoNotRedactPolicyType.Serialization.cs @@ -0,0 +1,126 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.AI.Language.Conversations.Models +{ + public partial class DoNotRedactPolicyType : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(DoNotRedactPolicyType)} does not support writing '{format}' format."); + } + + base.JsonModelWriteCore(writer, options); + } + + DoNotRedactPolicyType IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(DoNotRedactPolicyType)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeDoNotRedactPolicyType(document.RootElement, options); + } + + internal static DoNotRedactPolicyType DeserializeDoNotRedactPolicyType(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + RedactionPolicyKind policyKind = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("policyKind"u8)) + { + policyKind = new RedactionPolicyKind(property.Value.GetString()); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new DoNotRedactPolicyType(policyKind, serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(DoNotRedactPolicyType)} does not support writing '{options.Format}' format."); + } + } + + DoNotRedactPolicyType IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeDoNotRedactPolicyType(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(DoNotRedactPolicyType)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static new DoNotRedactPolicyType FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeDoNotRedactPolicyType(document.RootElement); + } + + /// Convert into a . + internal override RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/DoNotRedactPolicyType.cs b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/DoNotRedactPolicyType.cs new file mode 100644 index 000000000000..99b7497c83c7 --- /dev/null +++ b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/DoNotRedactPolicyType.cs @@ -0,0 +1,29 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.AI.Language.Conversations.Models +{ + /// Represents the policy of not redacting found PII. + public partial class DoNotRedactPolicyType : BaseRedactionPolicy + { + /// Initializes a new instance of . + public DoNotRedactPolicyType() + { + PolicyKind = RedactionPolicyKind.DoNotRedact; + } + + /// Initializes a new instance of . + /// The entity RedactionPolicy object kind. + /// Keeps track of any properties unknown to the library. + internal DoNotRedactPolicyType(RedactionPolicyKind policyKind, IDictionary serializedAdditionalRawData) : base(policyKind, serializedAdditionalRawData) + { + } + } +} diff --git a/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/MaskWithEntityTypePolicyType.Serialization.cs b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/MaskWithEntityTypePolicyType.Serialization.cs new file mode 100644 index 000000000000..aac1644aacbe --- /dev/null +++ b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/MaskWithEntityTypePolicyType.Serialization.cs @@ -0,0 +1,126 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.AI.Language.Conversations.Models +{ + public partial class MaskWithEntityTypePolicyType : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(MaskWithEntityTypePolicyType)} does not support writing '{format}' format."); + } + + base.JsonModelWriteCore(writer, options); + } + + MaskWithEntityTypePolicyType IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(MaskWithEntityTypePolicyType)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeMaskWithEntityTypePolicyType(document.RootElement, options); + } + + internal static MaskWithEntityTypePolicyType DeserializeMaskWithEntityTypePolicyType(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + RedactionPolicyKind policyKind = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("policyKind"u8)) + { + policyKind = new RedactionPolicyKind(property.Value.GetString()); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new MaskWithEntityTypePolicyType(policyKind, serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(MaskWithEntityTypePolicyType)} does not support writing '{options.Format}' format."); + } + } + + MaskWithEntityTypePolicyType IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeMaskWithEntityTypePolicyType(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(MaskWithEntityTypePolicyType)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static new MaskWithEntityTypePolicyType FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeMaskWithEntityTypePolicyType(document.RootElement); + } + + /// Convert into a . + internal override RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/MaskWithEntityTypePolicyType.cs b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/MaskWithEntityTypePolicyType.cs new file mode 100644 index 000000000000..e5f7efad55fc --- /dev/null +++ b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/MaskWithEntityTypePolicyType.cs @@ -0,0 +1,29 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.AI.Language.Conversations.Models +{ + /// Represents the policy of redacting PII with the entity type. + public partial class MaskWithEntityTypePolicyType : BaseRedactionPolicy + { + /// Initializes a new instance of . + public MaskWithEntityTypePolicyType() + { + PolicyKind = RedactionPolicyKind.MaskWithEntityType; + } + + /// Initializes a new instance of . + /// The entity RedactionPolicy object kind. + /// Keeps track of any properties unknown to the library. + internal MaskWithEntityTypePolicyType(RedactionPolicyKind policyKind, IDictionary serializedAdditionalRawData) : base(policyKind, serializedAdditionalRawData) + { + } + } +} diff --git a/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/MaskWithRedactionCharacterPolicyType.Serialization.cs b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/MaskWithRedactionCharacterPolicyType.Serialization.cs new file mode 100644 index 000000000000..d4125c5601f2 --- /dev/null +++ b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/MaskWithRedactionCharacterPolicyType.Serialization.cs @@ -0,0 +1,141 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.AI.Language.Conversations.Models +{ + public partial class MaskWithRedactionCharacterPolicyType : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(MaskWithRedactionCharacterPolicyType)} does not support writing '{format}' format."); + } + + base.JsonModelWriteCore(writer, options); + if (Optional.IsDefined(RedactionCharacter)) + { + writer.WritePropertyName("redactionCharacter"u8); + writer.WriteStringValue(RedactionCharacter.Value.ToString()); + } + } + + MaskWithRedactionCharacterPolicyType IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(MaskWithRedactionCharacterPolicyType)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeMaskWithRedactionCharacterPolicyType(document.RootElement, options); + } + + internal static MaskWithRedactionCharacterPolicyType DeserializeMaskWithRedactionCharacterPolicyType(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + RedactionCharacter? redactionCharacter = default; + RedactionPolicyKind policyKind = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("redactionCharacter"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + redactionCharacter = new RedactionCharacter(property.Value.GetString()); + continue; + } + if (property.NameEquals("policyKind"u8)) + { + policyKind = new RedactionPolicyKind(property.Value.GetString()); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new MaskWithRedactionCharacterPolicyType(policyKind, serializedAdditionalRawData, redactionCharacter); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(MaskWithRedactionCharacterPolicyType)} does not support writing '{options.Format}' format."); + } + } + + MaskWithRedactionCharacterPolicyType IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeMaskWithRedactionCharacterPolicyType(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(MaskWithRedactionCharacterPolicyType)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static new MaskWithRedactionCharacterPolicyType FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeMaskWithRedactionCharacterPolicyType(document.RootElement); + } + + /// Convert into a . + internal override RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/MaskWithRedactionCharacterPolicyType.cs b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/MaskWithRedactionCharacterPolicyType.cs new file mode 100644 index 000000000000..2ffe65cff585 --- /dev/null +++ b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/MaskWithRedactionCharacterPolicyType.cs @@ -0,0 +1,34 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.AI.Language.Conversations.Models +{ + /// Represents the policy of redacting with a redaction character. + public partial class MaskWithRedactionCharacterPolicyType : BaseRedactionPolicy + { + /// Initializes a new instance of . + public MaskWithRedactionCharacterPolicyType() + { + PolicyKind = RedactionPolicyKind.MaskWithRedactionCharacter; + } + + /// Initializes a new instance of . + /// The entity RedactionPolicy object kind. + /// Keeps track of any properties unknown to the library. + /// Optional parameter to use a Custom Character to be used for redaction in PII responses. Default character will be * as before. We allow specific ascii characters for redaction. + internal MaskWithRedactionCharacterPolicyType(RedactionPolicyKind policyKind, IDictionary serializedAdditionalRawData, RedactionCharacter? redactionCharacter) : base(policyKind, serializedAdditionalRawData) + { + RedactionCharacter = redactionCharacter; + } + + /// Optional parameter to use a Custom Character to be used for redaction in PII responses. Default character will be * as before. We allow specific ascii characters for redaction. + public RedactionCharacter? RedactionCharacter { get; set; } + } +} diff --git a/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/NamedEntity.Serialization.cs b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/NamedEntity.Serialization.cs index d5bb88576ca7..6f9b007511c6 100644 --- a/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/NamedEntity.Serialization.cs +++ b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/NamedEntity.Serialization.cs @@ -49,6 +49,21 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit writer.WriteNumberValue(Length); writer.WritePropertyName("confidenceScore"u8); writer.WriteNumberValue(ConfidenceScore); + if (Optional.IsDefined(Mask)) + { + writer.WritePropertyName("mask"u8); + writer.WriteStringValue(Mask); + } + if (Optional.IsDefined(MaskOffset)) + { + writer.WritePropertyName("maskOffset"u8); + writer.WriteNumberValue(MaskOffset.Value); + } + if (Optional.IsDefined(MaskLength)) + { + writer.WritePropertyName("maskLength"u8); + writer.WriteNumberValue(MaskLength.Value); + } if (options.Format != "W" && _serializedAdditionalRawData != null) { foreach (var item in _serializedAdditionalRawData) @@ -92,6 +107,9 @@ internal static NamedEntity DeserializeNamedEntity(JsonElement element, ModelRea int offset = default; int length = default; double confidenceScore = default; + string mask = default; + int? maskOffset = default; + int? maskLength = default; IDictionary serializedAdditionalRawData = default; Dictionary rawDataDictionary = new Dictionary(); foreach (var property in element.EnumerateObject()) @@ -126,6 +144,29 @@ internal static NamedEntity DeserializeNamedEntity(JsonElement element, ModelRea confidenceScore = property.Value.GetDouble(); continue; } + if (property.NameEquals("mask"u8)) + { + mask = property.Value.GetString(); + continue; + } + if (property.NameEquals("maskOffset"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + maskOffset = property.Value.GetInt32(); + continue; + } + if (property.NameEquals("maskLength"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + maskLength = property.Value.GetInt32(); + continue; + } if (options.Format != "W") { rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); @@ -139,6 +180,9 @@ internal static NamedEntity DeserializeNamedEntity(JsonElement element, ModelRea offset, length, confidenceScore, + mask, + maskOffset, + maskLength, serializedAdditionalRawData); } diff --git a/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/NamedEntity.cs b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/NamedEntity.cs index f8079487a0a5..3e60776d7584 100644 --- a/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/NamedEntity.cs +++ b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/NamedEntity.cs @@ -71,8 +71,11 @@ internal NamedEntity(string text, string category, int offset, int length, doubl /// Start position for the entity text. Use of different 'stringIndexType' values can affect the offset returned. /// Length for the entity text. Use of different 'stringIndexType' values can affect the length returned. /// Confidence score between 0 and 1 of the extracted entity. + /// Exact mask text to mask the PII entity. + /// Offset of the mask text. + /// Length of the mask text. /// Keeps track of any properties unknown to the library. - internal NamedEntity(string text, string category, string subcategory, int offset, int length, double confidenceScore, IDictionary serializedAdditionalRawData) + internal NamedEntity(string text, string category, string subcategory, int offset, int length, double confidenceScore, string mask, int? maskOffset, int? maskLength, IDictionary serializedAdditionalRawData) { Text = text; Category = category; @@ -80,6 +83,9 @@ internal NamedEntity(string text, string category, string subcategory, int offse Offset = offset; Length = length; ConfidenceScore = confidenceScore; + Mask = mask; + MaskOffset = maskOffset; + MaskLength = maskLength; _serializedAdditionalRawData = serializedAdditionalRawData; } @@ -100,5 +106,11 @@ internal NamedEntity() public int Length { get; } /// Confidence score between 0 and 1 of the extracted entity. public double ConfidenceScore { get; } + /// Exact mask text to mask the PII entity. + public string Mask { get; } + /// Offset of the mask text. + public int? MaskOffset { get; } + /// Length of the mask text. + public int? MaskLength { get; } } } diff --git a/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/ConversationPiiActionContent.Serialization.cs b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/PiiActionContent.Serialization.cs similarity index 78% rename from sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/ConversationPiiActionContent.Serialization.cs rename to sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/PiiActionContent.Serialization.cs index 5b5f0e66c881..88ead554ea32 100644 --- a/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/ConversationPiiActionContent.Serialization.cs +++ b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/PiiActionContent.Serialization.cs @@ -13,11 +13,11 @@ namespace Azure.AI.Language.Conversations.Models { - public partial class ConversationPiiActionContent : IUtf8JsonSerializable, IJsonModel + public partial class PiiActionContent : IUtf8JsonSerializable, IJsonModel { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); - void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) { writer.WriteStartObject(); JsonModelWriteCore(writer, options); @@ -28,10 +28,10 @@ void IJsonModel.Write(Utf8JsonWriter writer, Model /// The client options for reading and writing models. protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") { - throw new FormatException($"The model {nameof(ConversationPiiActionContent)} does not support writing '{format}' format."); + throw new FormatException($"The model {nameof(PiiActionContent)} does not support writing '{format}' format."); } if (Optional.IsDefined(LoggingOptOut)) @@ -79,6 +79,11 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit } writer.WriteEndArray(); } + if (Optional.IsDefined(RedactionPolicy)) + { + writer.WritePropertyName("redactionPolicy"u8); + writer.WriteObjectValue(RedactionPolicy, options); + } if (options.Format != "W" && _serializedAdditionalRawData != null) { foreach (var item in _serializedAdditionalRawData) @@ -96,19 +101,19 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit } } - ConversationPiiActionContent IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + PiiActionContent IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") { - throw new FormatException($"The model {nameof(ConversationPiiActionContent)} does not support reading '{format}' format."); + throw new FormatException($"The model {nameof(PiiActionContent)} does not support reading '{format}' format."); } using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeConversationPiiActionContent(document.RootElement, options); + return DeserializePiiActionContent(document.RootElement, options); } - internal static ConversationPiiActionContent DeserializeConversationPiiActionContent(JsonElement element, ModelReaderWriterOptions options = null) + internal static PiiActionContent DeserializePiiActionContent(JsonElement element, ModelReaderWriterOptions options = null) { options ??= ModelSerializationExtensions.WireOptions; @@ -123,6 +128,7 @@ internal static ConversationPiiActionContent DeserializeConversationPiiActionCon TranscriptContentType? redactionSource = default; RedactionCharacter? redactionCharacter = default; IList excludePiiCategories = default; + BaseRedactionPolicy redactionPolicy = default; IDictionary serializedAdditionalRawData = default; Dictionary rawDataDictionary = new Dictionary(); foreach (var property in element.EnumerateObject()) @@ -196,13 +202,22 @@ internal static ConversationPiiActionContent DeserializeConversationPiiActionCon excludePiiCategories = array; continue; } + if (property.NameEquals("redactionPolicy"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + redactionPolicy = BaseRedactionPolicy.DeserializeBaseRedactionPolicy(property.Value, options); + continue; + } if (options.Format != "W") { rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); } } serializedAdditionalRawData = rawDataDictionary; - return new ConversationPiiActionContent( + return new PiiActionContent( loggingOptOut, modelVersion, piiCategories ?? new ChangeTrackingList(), @@ -210,46 +225,47 @@ internal static ConversationPiiActionContent DeserializeConversationPiiActionCon redactionSource, redactionCharacter, excludePiiCategories ?? new ChangeTrackingList(), + redactionPolicy, serializedAdditionalRawData); } - BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; switch (format) { case "J": return ModelReaderWriter.Write(this, options); default: - throw new FormatException($"The model {nameof(ConversationPiiActionContent)} does not support writing '{options.Format}' format."); + throw new FormatException($"The model {nameof(PiiActionContent)} does not support writing '{options.Format}' format."); } } - ConversationPiiActionContent IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + PiiActionContent IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; switch (format) { case "J": { using JsonDocument document = JsonDocument.Parse(data); - return DeserializeConversationPiiActionContent(document.RootElement, options); + return DeserializePiiActionContent(document.RootElement, options); } default: - throw new FormatException($"The model {nameof(ConversationPiiActionContent)} does not support reading '{options.Format}' format."); + throw new FormatException($"The model {nameof(PiiActionContent)} does not support reading '{options.Format}' format."); } } - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; /// Deserializes the model from a raw response. /// The response to deserialize the model from. - internal static ConversationPiiActionContent FromResponse(Response response) + internal static PiiActionContent FromResponse(Response response) { using var document = JsonDocument.Parse(response.Content); - return DeserializeConversationPiiActionContent(document.RootElement); + return DeserializePiiActionContent(document.RootElement); } /// Convert into a . diff --git a/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/ConversationPiiActionContent.cs b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/PiiActionContent.cs similarity index 72% rename from sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/ConversationPiiActionContent.cs rename to sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/PiiActionContent.cs index fc962a138448..0bd98f978abe 100644 --- a/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/ConversationPiiActionContent.cs +++ b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/PiiActionContent.cs @@ -11,7 +11,7 @@ namespace Azure.AI.Language.Conversations.Models { /// Supported parameters for a conversational pii task. - public partial class ConversationPiiActionContent + public partial class PiiActionContent { /// /// Keeps track of any properties unknown to the library. @@ -45,14 +45,14 @@ public partial class ConversationPiiActionContent /// private IDictionary _serializedAdditionalRawData; - /// Initializes a new instance of . - public ConversationPiiActionContent() + /// Initializes a new instance of . + public PiiActionContent() { PiiCategories = new ChangeTrackingList(); ExcludePiiCategories = new ChangeTrackingList(); } - /// Initializes a new instance of . + /// Initializes a new instance of . /// logging opt out. /// model version. /// Array of ConversationPIICategories. @@ -60,8 +60,13 @@ public ConversationPiiActionContent() /// For transcript conversations, this parameter provides information regarding which content type (ITN, Text, Lexical, Masked ITN) should be used for entity detection. The details of the entities detected - like the offset, length and the text itself - will correspond to the text type selected here. /// Optional parameter to use a Custom Character to be used for redaction in PII responses. Default character will be * as before. We allow specific ascii characters for redaction. /// List of categories that need to be excluded instead of included. + /// + /// Optional parameter determine what type of redaction to use. + /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. + /// The available derived classes include , and . + /// /// Keeps track of any properties unknown to the library. - internal ConversationPiiActionContent(bool? loggingOptOut, string modelVersion, IList piiCategories, bool? redactAudioTiming, TranscriptContentType? redactionSource, RedactionCharacter? redactionCharacter, IList excludePiiCategories, IDictionary serializedAdditionalRawData) + internal PiiActionContent(bool? loggingOptOut, string modelVersion, IList piiCategories, bool? redactAudioTiming, TranscriptContentType? redactionSource, RedactionCharacter? redactionCharacter, IList excludePiiCategories, BaseRedactionPolicy redactionPolicy, IDictionary serializedAdditionalRawData) { LoggingOptOut = loggingOptOut; ModelVersion = modelVersion; @@ -70,6 +75,7 @@ internal ConversationPiiActionContent(bool? loggingOptOut, string modelVersion, RedactionSource = redactionSource; RedactionCharacter = redactionCharacter; ExcludePiiCategories = excludePiiCategories; + RedactionPolicy = redactionPolicy; _serializedAdditionalRawData = serializedAdditionalRawData; } @@ -87,5 +93,11 @@ internal ConversationPiiActionContent(bool? loggingOptOut, string modelVersion, public RedactionCharacter? RedactionCharacter { get; set; } /// List of categories that need to be excluded instead of included. public IList ExcludePiiCategories { get; } + /// + /// Optional parameter determine what type of redaction to use. + /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. + /// The available derived classes include , and . + /// + public BaseRedactionPolicy RedactionPolicy { get; set; } } } diff --git a/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/PiiOperationAction.Serialization.cs b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/PiiOperationAction.Serialization.cs index 4a3d0516e4f7..64ac880e4940 100644 --- a/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/PiiOperationAction.Serialization.cs +++ b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/PiiOperationAction.Serialization.cs @@ -62,7 +62,7 @@ internal static PiiOperationAction DeserializePiiOperationAction(JsonElement ele { return null; } - ConversationPiiActionContent parameters = default; + PiiActionContent parameters = default; string taskName = default; AnalyzeConversationOperationActionKind kind = default; IDictionary serializedAdditionalRawData = default; @@ -75,7 +75,7 @@ internal static PiiOperationAction DeserializePiiOperationAction(JsonElement ele { continue; } - parameters = ConversationPiiActionContent.DeserializeConversationPiiActionContent(property.Value, options); + parameters = PiiActionContent.DeserializePiiActionContent(property.Value, options); continue; } if (property.NameEquals("taskName"u8)) diff --git a/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/PiiOperationAction.cs b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/PiiOperationAction.cs index 60d95bc1ccb1..b77a4105a311 100644 --- a/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/PiiOperationAction.cs +++ b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/PiiOperationAction.cs @@ -24,12 +24,12 @@ public PiiOperationAction() /// Enumeration of supported analysis tasks on a collection of conversations. /// Keeps track of any properties unknown to the library. /// parameters. - internal PiiOperationAction(string name, AnalyzeConversationOperationActionKind kind, IDictionary serializedAdditionalRawData, ConversationPiiActionContent actionContent) : base(name, kind, serializedAdditionalRawData) + internal PiiOperationAction(string name, AnalyzeConversationOperationActionKind kind, IDictionary serializedAdditionalRawData, PiiActionContent actionContent) : base(name, kind, serializedAdditionalRawData) { ActionContent = actionContent; } /// parameters. - public ConversationPiiActionContent ActionContent { get; set; } + public PiiActionContent ActionContent { get; set; } } } diff --git a/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/RedactionPolicyKind.cs b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/RedactionPolicyKind.cs new file mode 100644 index 000000000000..3b624e95f4bb --- /dev/null +++ b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/RedactionPolicyKind.cs @@ -0,0 +1,54 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.AI.Language.Conversations.Models +{ + /// Kinds of redaction policies supported. + internal readonly partial struct RedactionPolicyKind : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public RedactionPolicyKind(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string DoNotRedactValue = "DoNotRedact"; + private const string MaskWithRedactionCharacterValue = "MaskWithRedactionCharacter"; + private const string MaskWithEntityTypeValue = "MaskWithEntityType"; + + /// Do not redact detected entities. + public static RedactionPolicyKind DoNotRedact { get; } = new RedactionPolicyKind(DoNotRedactValue); + /// Redact detected entities with redaction character. + public static RedactionPolicyKind MaskWithRedactionCharacter { get; } = new RedactionPolicyKind(MaskWithRedactionCharacterValue); + /// Redact detected entities with entity type. + public static RedactionPolicyKind MaskWithEntityType { get; } = new RedactionPolicyKind(MaskWithEntityTypeValue); + /// Determines if two values are the same. + public static bool operator ==(RedactionPolicyKind left, RedactionPolicyKind right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(RedactionPolicyKind left, RedactionPolicyKind right) => !left.Equals(right); + /// Converts a to a . + public static implicit operator RedactionPolicyKind(string value) => new RedactionPolicyKind(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is RedactionPolicyKind other && Equals(other); + /// + public bool Equals(RedactionPolicyKind other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/UnknownBaseRedactionPolicy.Serialization.cs b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/UnknownBaseRedactionPolicy.Serialization.cs new file mode 100644 index 000000000000..a4d01a2e7014 --- /dev/null +++ b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/UnknownBaseRedactionPolicy.Serialization.cs @@ -0,0 +1,126 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.AI.Language.Conversations.Models +{ + internal partial class UnknownBaseRedactionPolicy : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(BaseRedactionPolicy)} does not support writing '{format}' format."); + } + + base.JsonModelWriteCore(writer, options); + } + + BaseRedactionPolicy IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(BaseRedactionPolicy)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeBaseRedactionPolicy(document.RootElement, options); + } + + internal static UnknownBaseRedactionPolicy DeserializeUnknownBaseRedactionPolicy(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + RedactionPolicyKind policyKind = "Unknown"; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("policyKind"u8)) + { + policyKind = new RedactionPolicyKind(property.Value.GetString()); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new UnknownBaseRedactionPolicy(policyKind, serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(BaseRedactionPolicy)} does not support writing '{options.Format}' format."); + } + } + + BaseRedactionPolicy IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeBaseRedactionPolicy(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(BaseRedactionPolicy)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static new UnknownBaseRedactionPolicy FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeUnknownBaseRedactionPolicy(document.RootElement); + } + + /// Convert into a . + internal override RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/UnknownBaseRedactionPolicy.cs b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/UnknownBaseRedactionPolicy.cs new file mode 100644 index 000000000000..07561d15dc2c --- /dev/null +++ b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/UnknownBaseRedactionPolicy.cs @@ -0,0 +1,28 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.AI.Language.Conversations.Models +{ + /// Unknown version of BaseRedactionPolicy. + internal partial class UnknownBaseRedactionPolicy : BaseRedactionPolicy + { + /// Initializes a new instance of . + /// The entity RedactionPolicy object kind. + /// Keeps track of any properties unknown to the library. + internal UnknownBaseRedactionPolicy(RedactionPolicyKind policyKind, IDictionary serializedAdditionalRawData) : base(policyKind, serializedAdditionalRawData) + { + } + + /// Initializes a new instance of for deserialization. + internal UnknownBaseRedactionPolicy() + { + } + } +} diff --git a/sdk/cognitivelanguage/Azure.AI.Language.Conversations/tests/Generated/Samples/Samples_ConversationAnalysisClient.cs b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/tests/Generated/Samples/Samples_ConversationAnalysisClient.cs index 1ba9ef786043..cf945509eaf1 100644 --- a/sdk/cognitivelanguage/Azure.AI.Language.Conversations/tests/Generated/Samples/Samples_ConversationAnalysisClient.cs +++ b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/tests/Generated/Samples/Samples_ConversationAnalysisClient.cs @@ -89,7 +89,7 @@ public void Example_Conversations_AnalyzeConversation_SuccessfulAnalyzeConversat AzureKeyCredential credential = new AzureKeyCredential(""); ConversationAnalysisClient client = new ConversationAnalysisClient(endpoint, credential); - AnalyzeConversationInput analyzeConversationInput = new ConversationLanguageUnderstandingInput(new ConversationAnalysisInput(new TextConversationItem("1", "1", "Book a flight to Seattle on Oct 10th")), new ConversationLanguageUnderstandingActionContent("{project-name}", "{deployment-name}")); + AnalyzeConversationInput analyzeConversationInput = new ConversationLanguageUnderstandingInput(new ConversationAnalysisInput(new TextConversationItem("1", "1", "Book a flight to Seattle on Oct 10th")), new ConversationActionContent("{project-name}", "{deployment-name}")); Response response = client.AnalyzeConversation(analyzeConversationInput); } @@ -101,7 +101,7 @@ public async Task Example_Conversations_AnalyzeConversation_SuccessfulAnalyzeCon AzureKeyCredential credential = new AzureKeyCredential(""); ConversationAnalysisClient client = new ConversationAnalysisClient(endpoint, credential); - AnalyzeConversationInput analyzeConversationInput = new ConversationLanguageUnderstandingInput(new ConversationAnalysisInput(new TextConversationItem("1", "1", "Book a flight to Seattle on Oct 10th")), new ConversationLanguageUnderstandingActionContent("{project-name}", "{deployment-name}")); + AnalyzeConversationInput analyzeConversationInput = new ConversationLanguageUnderstandingInput(new ConversationAnalysisInput(new TextConversationItem("1", "1", "Book a flight to Seattle on Oct 10th")), new ConversationActionContent("{project-name}", "{deployment-name}")); Response response = await client.AnalyzeConversationAsync(analyzeConversationInput); } @@ -189,7 +189,7 @@ public void Example_Conversations_AnalyzeConversation_SuccessfulAnalyzeConversat { Language = "en-GB", Modality = InputModality.Text, - }), new ConversationLanguageUnderstandingActionContent("{project-name}", "{deployment-name}") + }), new ConversationActionContent("{project-name}", "{deployment-name}") { Verbose = true, IsLoggingEnabled = false, @@ -209,7 +209,7 @@ public async Task Example_Conversations_AnalyzeConversation_SuccessfulAnalyzeCon { Language = "en-GB", Modality = InputModality.Text, - }), new ConversationLanguageUnderstandingActionContent("{project-name}", "{deployment-name}") + }), new ConversationActionContent("{project-name}", "{deployment-name}") { Verbose = true, IsLoggingEnabled = false, @@ -325,7 +325,7 @@ public void Example_Conversations_AnalyzeConversation_SuccessfulAnalyzeConversat AzureKeyCredential credential = new AzureKeyCredential(""); ConversationAnalysisClient client = new ConversationAnalysisClient(endpoint, credential); - AnalyzeConversationInput analyzeConversationInput = new ConversationLanguageUnderstandingInput(new ConversationAnalysisInput(new TextConversationItem("1", "1", "Ports and connectors")), new ConversationLanguageUnderstandingActionContent("prj1", "dep1") + AnalyzeConversationInput analyzeConversationInput = new ConversationLanguageUnderstandingInput(new ConversationAnalysisInput(new TextConversationItem("1", "1", "Ports and connectors")), new ConversationActionContent("prj1", "dep1") { DirectTarget = "qnaProject", TargetProjectParameters = @@ -355,7 +355,7 @@ public async Task Example_Conversations_AnalyzeConversation_SuccessfulAnalyzeCon AzureKeyCredential credential = new AzureKeyCredential(""); ConversationAnalysisClient client = new ConversationAnalysisClient(endpoint, credential); - AnalyzeConversationInput analyzeConversationInput = new ConversationLanguageUnderstandingInput(new ConversationAnalysisInput(new TextConversationItem("1", "1", "Ports and connectors")), new ConversationLanguageUnderstandingActionContent("prj1", "dep1") + AnalyzeConversationInput analyzeConversationInput = new ConversationLanguageUnderstandingInput(new ConversationAnalysisInput(new TextConversationItem("1", "1", "Ports and connectors")), new ConversationActionContent("prj1", "dep1") { DirectTarget = "qnaProject", TargetProjectParameters = @@ -377,6 +377,70 @@ public async Task Example_Conversations_AnalyzeConversation_SuccessfulAnalyzeCon Response response = await client.AnalyzeConversationAsync(analyzeConversationInput); } + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_AnalyzeConversationJobState_GetAnalyzeConversationJobStatus_SuccessfulConversationPIIDoNotRedactTaskStatusRequest() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + ConversationAnalysisClient client = new ConversationAnalysisClient(endpoint, credential); + + Response response = client.GetAnalyzeConversationJobStatus(Guid.Parse("c0f2a446-05d9-48fc-ba8f-3ef4af8d0b18"), null, null); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("createdDateTime").ToString()); + Console.WriteLine(result.GetProperty("jobId").ToString()); + Console.WriteLine(result.GetProperty("lastUpdatedDateTime").ToString()); + Console.WriteLine(result.GetProperty("status").ToString()); + Console.WriteLine(result.GetProperty("tasks").GetProperty("completed").ToString()); + Console.WriteLine(result.GetProperty("tasks").GetProperty("failed").ToString()); + Console.WriteLine(result.GetProperty("tasks").GetProperty("inProgress").ToString()); + Console.WriteLine(result.GetProperty("tasks").GetProperty("total").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_AnalyzeConversationJobState_GetAnalyzeConversationJobStatus_SuccessfulConversationPIIDoNotRedactTaskStatusRequest_Async() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + ConversationAnalysisClient client = new ConversationAnalysisClient(endpoint, credential); + + Response response = await client.GetAnalyzeConversationJobStatusAsync(Guid.Parse("c0f2a446-05d9-48fc-ba8f-3ef4af8d0b18"), null, null); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("createdDateTime").ToString()); + Console.WriteLine(result.GetProperty("jobId").ToString()); + Console.WriteLine(result.GetProperty("lastUpdatedDateTime").ToString()); + Console.WriteLine(result.GetProperty("status").ToString()); + Console.WriteLine(result.GetProperty("tasks").GetProperty("completed").ToString()); + Console.WriteLine(result.GetProperty("tasks").GetProperty("failed").ToString()); + Console.WriteLine(result.GetProperty("tasks").GetProperty("inProgress").ToString()); + Console.WriteLine(result.GetProperty("tasks").GetProperty("total").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_AnalyzeConversationJobState_GetAnalyzeConversationJobStatus_SuccessfulConversationPIIDoNotRedactTaskStatusRequest_Convenience() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + ConversationAnalysisClient client = new ConversationAnalysisClient(endpoint, credential); + + Response response = client.GetAnalyzeConversationJobStatus(Guid.Parse("c0f2a446-05d9-48fc-ba8f-3ef4af8d0b18")); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_AnalyzeConversationJobState_GetAnalyzeConversationJobStatus_SuccessfulConversationPIIDoNotRedactTaskStatusRequest_Convenience_Async() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + ConversationAnalysisClient client = new ConversationAnalysisClient(endpoint, credential); + + Response response = await client.GetAnalyzeConversationJobStatusAsync(Guid.Parse("c0f2a446-05d9-48fc-ba8f-3ef4af8d0b18")); + } + [Test] [Ignore("Only validating compilation of examples")] public void Example_AnalyzeConversationJobState_GetAnalyzeConversationJobStatus_SuccessfulConversationPIIExclusionTaskStatusRequest() @@ -441,6 +505,134 @@ public async Task Example_AnalyzeConversationJobState_GetAnalyzeConversationJobS Response response = await client.GetAnalyzeConversationJobStatusAsync(Guid.Parse("c0f2a446-05d9-48fc-ba8f-3ef4af8d0b18")); } + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_AnalyzeConversationJobState_GetAnalyzeConversationJobStatus_SuccessfulConversationPIIMaskWithEntityTypeTaskStatusRequest() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + ConversationAnalysisClient client = new ConversationAnalysisClient(endpoint, credential); + + Response response = client.GetAnalyzeConversationJobStatus(Guid.Parse("c0f2a446-05d9-48fc-ba8f-3ef4af8d0b18"), null, null); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("createdDateTime").ToString()); + Console.WriteLine(result.GetProperty("jobId").ToString()); + Console.WriteLine(result.GetProperty("lastUpdatedDateTime").ToString()); + Console.WriteLine(result.GetProperty("status").ToString()); + Console.WriteLine(result.GetProperty("tasks").GetProperty("completed").ToString()); + Console.WriteLine(result.GetProperty("tasks").GetProperty("failed").ToString()); + Console.WriteLine(result.GetProperty("tasks").GetProperty("inProgress").ToString()); + Console.WriteLine(result.GetProperty("tasks").GetProperty("total").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_AnalyzeConversationJobState_GetAnalyzeConversationJobStatus_SuccessfulConversationPIIMaskWithEntityTypeTaskStatusRequest_Async() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + ConversationAnalysisClient client = new ConversationAnalysisClient(endpoint, credential); + + Response response = await client.GetAnalyzeConversationJobStatusAsync(Guid.Parse("c0f2a446-05d9-48fc-ba8f-3ef4af8d0b18"), null, null); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("createdDateTime").ToString()); + Console.WriteLine(result.GetProperty("jobId").ToString()); + Console.WriteLine(result.GetProperty("lastUpdatedDateTime").ToString()); + Console.WriteLine(result.GetProperty("status").ToString()); + Console.WriteLine(result.GetProperty("tasks").GetProperty("completed").ToString()); + Console.WriteLine(result.GetProperty("tasks").GetProperty("failed").ToString()); + Console.WriteLine(result.GetProperty("tasks").GetProperty("inProgress").ToString()); + Console.WriteLine(result.GetProperty("tasks").GetProperty("total").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_AnalyzeConversationJobState_GetAnalyzeConversationJobStatus_SuccessfulConversationPIIMaskWithEntityTypeTaskStatusRequest_Convenience() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + ConversationAnalysisClient client = new ConversationAnalysisClient(endpoint, credential); + + Response response = client.GetAnalyzeConversationJobStatus(Guid.Parse("c0f2a446-05d9-48fc-ba8f-3ef4af8d0b18")); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_AnalyzeConversationJobState_GetAnalyzeConversationJobStatus_SuccessfulConversationPIIMaskWithEntityTypeTaskStatusRequest_Convenience_Async() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + ConversationAnalysisClient client = new ConversationAnalysisClient(endpoint, credential); + + Response response = await client.GetAnalyzeConversationJobStatusAsync(Guid.Parse("c0f2a446-05d9-48fc-ba8f-3ef4af8d0b18")); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_AnalyzeConversationJobState_GetAnalyzeConversationJobStatus_SuccessfulConversationPIIMaskWithRedactionTaskStatusRequest() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + ConversationAnalysisClient client = new ConversationAnalysisClient(endpoint, credential); + + Response response = client.GetAnalyzeConversationJobStatus(Guid.Parse("c0f2a446-05d9-48fc-ba8f-3ef4af8d0b18"), null, null); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("createdDateTime").ToString()); + Console.WriteLine(result.GetProperty("jobId").ToString()); + Console.WriteLine(result.GetProperty("lastUpdatedDateTime").ToString()); + Console.WriteLine(result.GetProperty("status").ToString()); + Console.WriteLine(result.GetProperty("tasks").GetProperty("completed").ToString()); + Console.WriteLine(result.GetProperty("tasks").GetProperty("failed").ToString()); + Console.WriteLine(result.GetProperty("tasks").GetProperty("inProgress").ToString()); + Console.WriteLine(result.GetProperty("tasks").GetProperty("total").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_AnalyzeConversationJobState_GetAnalyzeConversationJobStatus_SuccessfulConversationPIIMaskWithRedactionTaskStatusRequest_Async() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + ConversationAnalysisClient client = new ConversationAnalysisClient(endpoint, credential); + + Response response = await client.GetAnalyzeConversationJobStatusAsync(Guid.Parse("c0f2a446-05d9-48fc-ba8f-3ef4af8d0b18"), null, null); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("createdDateTime").ToString()); + Console.WriteLine(result.GetProperty("jobId").ToString()); + Console.WriteLine(result.GetProperty("lastUpdatedDateTime").ToString()); + Console.WriteLine(result.GetProperty("status").ToString()); + Console.WriteLine(result.GetProperty("tasks").GetProperty("completed").ToString()); + Console.WriteLine(result.GetProperty("tasks").GetProperty("failed").ToString()); + Console.WriteLine(result.GetProperty("tasks").GetProperty("inProgress").ToString()); + Console.WriteLine(result.GetProperty("tasks").GetProperty("total").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_AnalyzeConversationJobState_GetAnalyzeConversationJobStatus_SuccessfulConversationPIIMaskWithRedactionTaskStatusRequest_Convenience() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + ConversationAnalysisClient client = new ConversationAnalysisClient(endpoint, credential); + + Response response = client.GetAnalyzeConversationJobStatus(Guid.Parse("c0f2a446-05d9-48fc-ba8f-3ef4af8d0b18")); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_AnalyzeConversationJobState_GetAnalyzeConversationJobStatus_SuccessfulConversationPIIMaskWithRedactionTaskStatusRequest_Convenience_Async() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + ConversationAnalysisClient client = new ConversationAnalysisClient(endpoint, credential); + + Response response = await client.GetAnalyzeConversationJobStatusAsync(Guid.Parse("c0f2a446-05d9-48fc-ba8f-3ef4af8d0b18")); + } + [Test] [Ignore("Only validating compilation of examples")] public void Example_AnalyzeConversationJobState_GetAnalyzeConversationJobStatus_SuccessfulConversationPIIRedactionCharTaskStatusRequest() @@ -763,7 +955,7 @@ public async Task Example_AnalyzeConversationJobState_GetAnalyzeConversationJobS [Test] [Ignore("Only validating compilation of examples")] - public void Example_Conversations_AnalyzeConversationSubmitOperation_SuccessfulConversationPIIExclusionSubmit() + public void Example_Conversations_AnalyzeConversationSubmitOperation_SuccessfulConversationPIIDoNotRedact() { Uri endpoint = new Uri(""); AzureKeyCredential credential = new AzureKeyCredential(""); @@ -833,9 +1025,13 @@ public void Example_Conversations_AnalyzeConversationSubmitOperation_SuccessfulC parameters = new { modelVersion = "latest", -excludePiiCategories = new object[] +piiCategories = new object[] { -"Person" +"All" +}, +redactionPolicy = new +{ +policyKind = "DoNotRedact", }, redactionSource = "lexical", redactAudioTiming = true, @@ -848,7 +1044,7 @@ public void Example_Conversations_AnalyzeConversationSubmitOperation_SuccessfulC [Test] [Ignore("Only validating compilation of examples")] - public async Task Example_Conversations_AnalyzeConversationSubmitOperation_SuccessfulConversationPIIExclusionSubmit_Async() + public async Task Example_Conversations_AnalyzeConversationSubmitOperation_SuccessfulConversationPIIDoNotRedact_Async() { Uri endpoint = new Uri(""); AzureKeyCredential credential = new AzureKeyCredential(""); @@ -918,9 +1114,13 @@ public async Task Example_Conversations_AnalyzeConversationSubmitOperation_Succe parameters = new { modelVersion = "latest", -excludePiiCategories = new object[] +piiCategories = new object[] { -"Person" +"All" +}, +redactionPolicy = new +{ +policyKind = "DoNotRedact", }, redactionSource = "lexical", redactAudioTiming = true, @@ -933,7 +1133,7 @@ public async Task Example_Conversations_AnalyzeConversationSubmitOperation_Succe [Test] [Ignore("Only validating compilation of examples")] - public void Example_Conversations_AnalyzeConversationSubmitOperation_SuccessfulConversationPIIExclusionSubmit_Convenience() + public void Example_Conversations_AnalyzeConversationSubmitOperation_SuccessfulConversationPIIDoNotRedact_Convenience() { Uri endpoint = new Uri(""); AzureKeyCredential credential = new AzureKeyCredential(""); @@ -981,12 +1181,13 @@ public void Example_Conversations_AnalyzeConversationSubmitOperation_SuccessfulC { new PiiOperationAction { -ActionContent = new ConversationPiiActionContent +ActionContent = new PiiActionContent { ModelVersion = "latest", +PiiCategories = {ConversationPiiCategories.All}, RedactAudioTiming = true, RedactionSource = TranscriptContentType.Lexical, -ExcludePiiCategories = {ConversationPiiCategoryExclusions.Person}, +RedactionPolicy = new DoNotRedactPolicyType(), }, Name = "Conversation PII", } @@ -999,7 +1200,7 @@ public void Example_Conversations_AnalyzeConversationSubmitOperation_SuccessfulC [Test] [Ignore("Only validating compilation of examples")] - public async Task Example_Conversations_AnalyzeConversationSubmitOperation_SuccessfulConversationPIIExclusionSubmit_Convenience_Async() + public async Task Example_Conversations_AnalyzeConversationSubmitOperation_SuccessfulConversationPIIDoNotRedact_Convenience_Async() { Uri endpoint = new Uri(""); AzureKeyCredential credential = new AzureKeyCredential(""); @@ -1047,12 +1248,947 @@ public async Task Example_Conversations_AnalyzeConversationSubmitOperation_Succe { new PiiOperationAction { -ActionContent = new ConversationPiiActionContent +ActionContent = new PiiActionContent { ModelVersion = "latest", +PiiCategories = {ConversationPiiCategories.All}, RedactAudioTiming = true, RedactionSource = TranscriptContentType.Lexical, -ExcludePiiCategories = {ConversationPiiCategoryExclusions.Person}, +RedactionPolicy = new DoNotRedactPolicyType(), +}, +Name = "Conversation PII", +} + }) + { + DisplayName = "Redacting PII data from transcribed audio", + }; + Operation operation = await client.AnalyzeConversationSubmitOperationAsync(WaitUntil.Completed, analyzeConversationOperationInput); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_Conversations_AnalyzeConversationSubmitOperation_SuccessfulConversationPIIExclusionSubmit() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + ConversationAnalysisClient client = new ConversationAnalysisClient(endpoint, credential); + + using RequestContent content = RequestContent.Create(new + { + displayName = "Redacting PII data from transcribed audio", + analysisInput = new + { + conversations = new object[] + { +new +{ +id = "1", +language = "en", +modality = "transcript", +domain = "generic", +conversationItems = new object[] +{ +new +{ +participantId = "1", +id = "1", +text = "Good morning John Doe.", +itn = "good morning john doe", +maskedItn = "good morning john doe", +lexical = "good morning john doe", +wordLevelTimings = new object[] +{ +new +{ +word = "good", +offset = 390000L, +duration = 2700000L, +}, +new +{ +word = "morning", +offset = 4500000L, +duration = 920000L, +}, +new +{ +word = "john", +offset = 590000L, +duration = 2700000L, +}, +new +{ +word = "doe", +offset = 6300000L, +duration = 920000L, +} +}, +} +}, +} + }, + }, + tasks = new object[] + { +new +{ +taskName = "Conversation PII", +kind = "ConversationalPIITask", +parameters = new +{ +modelVersion = "latest", +excludePiiCategories = new object[] +{ +"Person" +}, +redactionSource = "lexical", +redactAudioTiming = true, +}, +} + }, + }); + Operation operation = client.AnalyzeConversationSubmitOperation(WaitUntil.Completed, content); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_Conversations_AnalyzeConversationSubmitOperation_SuccessfulConversationPIIExclusionSubmit_Async() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + ConversationAnalysisClient client = new ConversationAnalysisClient(endpoint, credential); + + using RequestContent content = RequestContent.Create(new + { + displayName = "Redacting PII data from transcribed audio", + analysisInput = new + { + conversations = new object[] + { +new +{ +id = "1", +language = "en", +modality = "transcript", +domain = "generic", +conversationItems = new object[] +{ +new +{ +participantId = "1", +id = "1", +text = "Good morning John Doe.", +itn = "good morning john doe", +maskedItn = "good morning john doe", +lexical = "good morning john doe", +wordLevelTimings = new object[] +{ +new +{ +word = "good", +offset = 390000L, +duration = 2700000L, +}, +new +{ +word = "morning", +offset = 4500000L, +duration = 920000L, +}, +new +{ +word = "john", +offset = 590000L, +duration = 2700000L, +}, +new +{ +word = "doe", +offset = 6300000L, +duration = 920000L, +} +}, +} +}, +} + }, + }, + tasks = new object[] + { +new +{ +taskName = "Conversation PII", +kind = "ConversationalPIITask", +parameters = new +{ +modelVersion = "latest", +excludePiiCategories = new object[] +{ +"Person" +}, +redactionSource = "lexical", +redactAudioTiming = true, +}, +} + }, + }); + Operation operation = await client.AnalyzeConversationSubmitOperationAsync(WaitUntil.Completed, content); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_Conversations_AnalyzeConversationSubmitOperation_SuccessfulConversationPIIExclusionSubmit_Convenience() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + ConversationAnalysisClient client = new ConversationAnalysisClient(endpoint, credential); + + AnalyzeConversationOperationInput analyzeConversationOperationInput = new AnalyzeConversationOperationInput(new MultiLanguageConversationInput(new ConversationInput[] + { +new TranscriptConversation("1", "en", new TranscriptConversationItem[] +{ +new TranscriptConversationItem( + "1", + "1", + "good morning john doe", + "good morning john doe", + "Good morning John Doe.", + "good morning john doe") +{ +WordLevelTimings = {new WordLevelTiming +{ +Offset = 390000L, +Duration = 2700000L, +Word = "good", +}, new WordLevelTiming +{ +Offset = 4500000L, +Duration = 920000L, +Word = "morning", +}, new WordLevelTiming +{ +Offset = 590000L, +Duration = 2700000L, +Word = "john", +}, new WordLevelTiming +{ +Offset = 6300000L, +Duration = 920000L, +Word = "doe", +}}, +} +}) +{ +Domain = ConversationDomain.Generic, +} + }), new AnalyzeConversationOperationAction[] + { +new PiiOperationAction +{ +ActionContent = new PiiActionContent +{ +ModelVersion = "latest", +RedactAudioTiming = true, +RedactionSource = TranscriptContentType.Lexical, +ExcludePiiCategories = {ConversationPiiCategoryExclusions.Person}, +}, +Name = "Conversation PII", +} + }) + { + DisplayName = "Redacting PII data from transcribed audio", + }; + Operation operation = client.AnalyzeConversationSubmitOperation(WaitUntil.Completed, analyzeConversationOperationInput); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_Conversations_AnalyzeConversationSubmitOperation_SuccessfulConversationPIIExclusionSubmit_Convenience_Async() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + ConversationAnalysisClient client = new ConversationAnalysisClient(endpoint, credential); + + AnalyzeConversationOperationInput analyzeConversationOperationInput = new AnalyzeConversationOperationInput(new MultiLanguageConversationInput(new ConversationInput[] + { +new TranscriptConversation("1", "en", new TranscriptConversationItem[] +{ +new TranscriptConversationItem( + "1", + "1", + "good morning john doe", + "good morning john doe", + "Good morning John Doe.", + "good morning john doe") +{ +WordLevelTimings = {new WordLevelTiming +{ +Offset = 390000L, +Duration = 2700000L, +Word = "good", +}, new WordLevelTiming +{ +Offset = 4500000L, +Duration = 920000L, +Word = "morning", +}, new WordLevelTiming +{ +Offset = 590000L, +Duration = 2700000L, +Word = "john", +}, new WordLevelTiming +{ +Offset = 6300000L, +Duration = 920000L, +Word = "doe", +}}, +} +}) +{ +Domain = ConversationDomain.Generic, +} + }), new AnalyzeConversationOperationAction[] + { +new PiiOperationAction +{ +ActionContent = new PiiActionContent +{ +ModelVersion = "latest", +RedactAudioTiming = true, +RedactionSource = TranscriptContentType.Lexical, +ExcludePiiCategories = {ConversationPiiCategoryExclusions.Person}, +}, +Name = "Conversation PII", +} + }) + { + DisplayName = "Redacting PII data from transcribed audio", + }; + Operation operation = await client.AnalyzeConversationSubmitOperationAsync(WaitUntil.Completed, analyzeConversationOperationInput); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_Conversations_AnalyzeConversationSubmitOperation_SuccessfulConversationPIIMaskWithEntityType() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + ConversationAnalysisClient client = new ConversationAnalysisClient(endpoint, credential); + + using RequestContent content = RequestContent.Create(new + { + displayName = "Redacting PII data from transcribed audio", + analysisInput = new + { + conversations = new object[] + { +new +{ +id = "1", +language = "en", +modality = "transcript", +domain = "generic", +conversationItems = new object[] +{ +new +{ +participantId = "1", +id = "1", +text = "Good morning John Doe.", +itn = "good morning john doe", +maskedItn = "good morning john doe", +lexical = "good morning john doe", +wordLevelTimings = new object[] +{ +new +{ +word = "good", +offset = 390000L, +duration = 2700000L, +}, +new +{ +word = "morning", +offset = 4500000L, +duration = 920000L, +}, +new +{ +word = "john", +offset = 590000L, +duration = 2700000L, +}, +new +{ +word = "doe", +offset = 6300000L, +duration = 920000L, +} +}, +} +}, +} + }, + }, + tasks = new object[] + { +new +{ +taskName = "Conversation PII", +kind = "ConversationalPIITask", +parameters = new +{ +modelVersion = "latest", +piiCategories = new object[] +{ +"All" +}, +redactionPolicy = new +{ +policyKind = "MaskWithEntityType", +}, +redactionSource = "lexical", +redactAudioTiming = true, +}, +} + }, + }); + Operation operation = client.AnalyzeConversationSubmitOperation(WaitUntil.Completed, content); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_Conversations_AnalyzeConversationSubmitOperation_SuccessfulConversationPIIMaskWithEntityType_Async() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + ConversationAnalysisClient client = new ConversationAnalysisClient(endpoint, credential); + + using RequestContent content = RequestContent.Create(new + { + displayName = "Redacting PII data from transcribed audio", + analysisInput = new + { + conversations = new object[] + { +new +{ +id = "1", +language = "en", +modality = "transcript", +domain = "generic", +conversationItems = new object[] +{ +new +{ +participantId = "1", +id = "1", +text = "Good morning John Doe.", +itn = "good morning john doe", +maskedItn = "good morning john doe", +lexical = "good morning john doe", +wordLevelTimings = new object[] +{ +new +{ +word = "good", +offset = 390000L, +duration = 2700000L, +}, +new +{ +word = "morning", +offset = 4500000L, +duration = 920000L, +}, +new +{ +word = "john", +offset = 590000L, +duration = 2700000L, +}, +new +{ +word = "doe", +offset = 6300000L, +duration = 920000L, +} +}, +} +}, +} + }, + }, + tasks = new object[] + { +new +{ +taskName = "Conversation PII", +kind = "ConversationalPIITask", +parameters = new +{ +modelVersion = "latest", +piiCategories = new object[] +{ +"All" +}, +redactionPolicy = new +{ +policyKind = "MaskWithEntityType", +}, +redactionSource = "lexical", +redactAudioTiming = true, +}, +} + }, + }); + Operation operation = await client.AnalyzeConversationSubmitOperationAsync(WaitUntil.Completed, content); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_Conversations_AnalyzeConversationSubmitOperation_SuccessfulConversationPIIMaskWithEntityType_Convenience() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + ConversationAnalysisClient client = new ConversationAnalysisClient(endpoint, credential); + + AnalyzeConversationOperationInput analyzeConversationOperationInput = new AnalyzeConversationOperationInput(new MultiLanguageConversationInput(new ConversationInput[] + { +new TranscriptConversation("1", "en", new TranscriptConversationItem[] +{ +new TranscriptConversationItem( + "1", + "1", + "good morning john doe", + "good morning john doe", + "Good morning John Doe.", + "good morning john doe") +{ +WordLevelTimings = {new WordLevelTiming +{ +Offset = 390000L, +Duration = 2700000L, +Word = "good", +}, new WordLevelTiming +{ +Offset = 4500000L, +Duration = 920000L, +Word = "morning", +}, new WordLevelTiming +{ +Offset = 590000L, +Duration = 2700000L, +Word = "john", +}, new WordLevelTiming +{ +Offset = 6300000L, +Duration = 920000L, +Word = "doe", +}}, +} +}) +{ +Domain = ConversationDomain.Generic, +} + }), new AnalyzeConversationOperationAction[] + { +new PiiOperationAction +{ +ActionContent = new PiiActionContent +{ +ModelVersion = "latest", +PiiCategories = {ConversationPiiCategories.All}, +RedactAudioTiming = true, +RedactionSource = TranscriptContentType.Lexical, +RedactionPolicy = new MaskWithEntityTypePolicyType(), +}, +Name = "Conversation PII", +} + }) + { + DisplayName = "Redacting PII data from transcribed audio", + }; + Operation operation = client.AnalyzeConversationSubmitOperation(WaitUntil.Completed, analyzeConversationOperationInput); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_Conversations_AnalyzeConversationSubmitOperation_SuccessfulConversationPIIMaskWithEntityType_Convenience_Async() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + ConversationAnalysisClient client = new ConversationAnalysisClient(endpoint, credential); + + AnalyzeConversationOperationInput analyzeConversationOperationInput = new AnalyzeConversationOperationInput(new MultiLanguageConversationInput(new ConversationInput[] + { +new TranscriptConversation("1", "en", new TranscriptConversationItem[] +{ +new TranscriptConversationItem( + "1", + "1", + "good morning john doe", + "good morning john doe", + "Good morning John Doe.", + "good morning john doe") +{ +WordLevelTimings = {new WordLevelTiming +{ +Offset = 390000L, +Duration = 2700000L, +Word = "good", +}, new WordLevelTiming +{ +Offset = 4500000L, +Duration = 920000L, +Word = "morning", +}, new WordLevelTiming +{ +Offset = 590000L, +Duration = 2700000L, +Word = "john", +}, new WordLevelTiming +{ +Offset = 6300000L, +Duration = 920000L, +Word = "doe", +}}, +} +}) +{ +Domain = ConversationDomain.Generic, +} + }), new AnalyzeConversationOperationAction[] + { +new PiiOperationAction +{ +ActionContent = new PiiActionContent +{ +ModelVersion = "latest", +PiiCategories = {ConversationPiiCategories.All}, +RedactAudioTiming = true, +RedactionSource = TranscriptContentType.Lexical, +RedactionPolicy = new MaskWithEntityTypePolicyType(), +}, +Name = "Conversation PII", +} + }) + { + DisplayName = "Redacting PII data from transcribed audio", + }; + Operation operation = await client.AnalyzeConversationSubmitOperationAsync(WaitUntil.Completed, analyzeConversationOperationInput); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_Conversations_AnalyzeConversationSubmitOperation_SuccessfulConversationPIIMaskWithRedactionCharacter() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + ConversationAnalysisClient client = new ConversationAnalysisClient(endpoint, credential); + + using RequestContent content = RequestContent.Create(new + { + displayName = "Redacting PII data from transcribed audio", + analysisInput = new + { + conversations = new object[] + { +new +{ +id = "1", +language = "en", +modality = "transcript", +domain = "generic", +conversationItems = new object[] +{ +new +{ +participantId = "1", +id = "1", +text = "Good morning John Doe.", +itn = "good morning john doe", +maskedItn = "good morning john doe", +lexical = "good morning john doe", +wordLevelTimings = new object[] +{ +new +{ +word = "good", +offset = 390000L, +duration = 2700000L, +}, +new +{ +word = "morning", +offset = 4500000L, +duration = 920000L, +}, +new +{ +word = "john", +offset = 590000L, +duration = 2700000L, +}, +new +{ +word = "doe", +offset = 6300000L, +duration = 920000L, +} +}, +} +}, +} + }, + }, + tasks = new object[] + { +new +{ +taskName = "Conversation PII", +kind = "ConversationalPIITask", +parameters = new +{ +modelVersion = "latest", +piiCategories = new object[] +{ +"All" +}, +redactionPolicy = new +{ +policyKind = "MaskWithRedactionCharacter", +redactionCharacter = "-", +}, +redactionSource = "lexical", +redactAudioTiming = true, +}, +} + }, + }); + Operation operation = client.AnalyzeConversationSubmitOperation(WaitUntil.Completed, content); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_Conversations_AnalyzeConversationSubmitOperation_SuccessfulConversationPIIMaskWithRedactionCharacter_Async() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + ConversationAnalysisClient client = new ConversationAnalysisClient(endpoint, credential); + + using RequestContent content = RequestContent.Create(new + { + displayName = "Redacting PII data from transcribed audio", + analysisInput = new + { + conversations = new object[] + { +new +{ +id = "1", +language = "en", +modality = "transcript", +domain = "generic", +conversationItems = new object[] +{ +new +{ +participantId = "1", +id = "1", +text = "Good morning John Doe.", +itn = "good morning john doe", +maskedItn = "good morning john doe", +lexical = "good morning john doe", +wordLevelTimings = new object[] +{ +new +{ +word = "good", +offset = 390000L, +duration = 2700000L, +}, +new +{ +word = "morning", +offset = 4500000L, +duration = 920000L, +}, +new +{ +word = "john", +offset = 590000L, +duration = 2700000L, +}, +new +{ +word = "doe", +offset = 6300000L, +duration = 920000L, +} +}, +} +}, +} + }, + }, + tasks = new object[] + { +new +{ +taskName = "Conversation PII", +kind = "ConversationalPIITask", +parameters = new +{ +modelVersion = "latest", +piiCategories = new object[] +{ +"All" +}, +redactionPolicy = new +{ +policyKind = "MaskWithRedactionCharacter", +redactionCharacter = "-", +}, +redactionSource = "lexical", +redactAudioTiming = true, +}, +} + }, + }); + Operation operation = await client.AnalyzeConversationSubmitOperationAsync(WaitUntil.Completed, content); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_Conversations_AnalyzeConversationSubmitOperation_SuccessfulConversationPIIMaskWithRedactionCharacter_Convenience() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + ConversationAnalysisClient client = new ConversationAnalysisClient(endpoint, credential); + + AnalyzeConversationOperationInput analyzeConversationOperationInput = new AnalyzeConversationOperationInput(new MultiLanguageConversationInput(new ConversationInput[] + { +new TranscriptConversation("1", "en", new TranscriptConversationItem[] +{ +new TranscriptConversationItem( + "1", + "1", + "good morning john doe", + "good morning john doe", + "Good morning John Doe.", + "good morning john doe") +{ +WordLevelTimings = {new WordLevelTiming +{ +Offset = 390000L, +Duration = 2700000L, +Word = "good", +}, new WordLevelTiming +{ +Offset = 4500000L, +Duration = 920000L, +Word = "morning", +}, new WordLevelTiming +{ +Offset = 590000L, +Duration = 2700000L, +Word = "john", +}, new WordLevelTiming +{ +Offset = 6300000L, +Duration = 920000L, +Word = "doe", +}}, +} +}) +{ +Domain = ConversationDomain.Generic, +} + }), new AnalyzeConversationOperationAction[] + { +new PiiOperationAction +{ +ActionContent = new PiiActionContent +{ +ModelVersion = "latest", +PiiCategories = {ConversationPiiCategories.All}, +RedactAudioTiming = true, +RedactionSource = TranscriptContentType.Lexical, +RedactionPolicy = new MaskWithRedactionCharacterPolicyType +{ +RedactionCharacter = RedactionCharacter.Minus, +}, +}, +Name = "Conversation PII", +} + }) + { + DisplayName = "Redacting PII data from transcribed audio", + }; + Operation operation = client.AnalyzeConversationSubmitOperation(WaitUntil.Completed, analyzeConversationOperationInput); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_Conversations_AnalyzeConversationSubmitOperation_SuccessfulConversationPIIMaskWithRedactionCharacter_Convenience_Async() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + ConversationAnalysisClient client = new ConversationAnalysisClient(endpoint, credential); + + AnalyzeConversationOperationInput analyzeConversationOperationInput = new AnalyzeConversationOperationInput(new MultiLanguageConversationInput(new ConversationInput[] + { +new TranscriptConversation("1", "en", new TranscriptConversationItem[] +{ +new TranscriptConversationItem( + "1", + "1", + "good morning john doe", + "good morning john doe", + "Good morning John Doe.", + "good morning john doe") +{ +WordLevelTimings = {new WordLevelTiming +{ +Offset = 390000L, +Duration = 2700000L, +Word = "good", +}, new WordLevelTiming +{ +Offset = 4500000L, +Duration = 920000L, +Word = "morning", +}, new WordLevelTiming +{ +Offset = 590000L, +Duration = 2700000L, +Word = "john", +}, new WordLevelTiming +{ +Offset = 6300000L, +Duration = 920000L, +Word = "doe", +}}, +} +}) +{ +Domain = ConversationDomain.Generic, +} + }), new AnalyzeConversationOperationAction[] + { +new PiiOperationAction +{ +ActionContent = new PiiActionContent +{ +ModelVersion = "latest", +PiiCategories = {ConversationPiiCategories.All}, +RedactAudioTiming = true, +RedactionSource = TranscriptContentType.Lexical, +RedactionPolicy = new MaskWithRedactionCharacterPolicyType +{ +RedactionCharacter = RedactionCharacter.Minus, +}, }, Name = "Conversation PII", } @@ -1285,7 +2421,7 @@ public void Example_Conversations_AnalyzeConversationSubmitOperation_SuccessfulC { new PiiOperationAction { -ActionContent = new ConversationPiiActionContent +ActionContent = new PiiActionContent { ModelVersion = "latest", PiiCategories = {ConversationPiiCategories.All}, @@ -1352,7 +2488,7 @@ public async Task Example_Conversations_AnalyzeConversationSubmitOperation_Succe { new PiiOperationAction { -ActionContent = new ConversationPiiActionContent +ActionContent = new PiiActionContent { ModelVersion = "latest", PiiCategories = {ConversationPiiCategories.All}, @@ -1589,7 +2725,7 @@ public void Example_Conversations_AnalyzeConversationSubmitOperation_SuccessfulC { new PiiOperationAction { -ActionContent = new ConversationPiiActionContent +ActionContent = new PiiActionContent { ModelVersion = "latest", PiiCategories = {ConversationPiiCategories.All}, @@ -1655,7 +2791,7 @@ public async Task Example_Conversations_AnalyzeConversationSubmitOperation_Succe { new PiiOperationAction { -ActionContent = new ConversationPiiActionContent +ActionContent = new PiiActionContent { ModelVersion = "latest", PiiCategories = {ConversationPiiCategories.All}, diff --git a/sdk/cognitivelanguage/Azure.AI.Language.Conversations/tsp-location.yaml b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/tsp-location.yaml index 5d1e84c0222b..67bf525c2f06 100644 --- a/sdk/cognitivelanguage/Azure.AI.Language.Conversations/tsp-location.yaml +++ b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/tsp-location.yaml @@ -1,3 +1,3 @@ directory: specification/cognitiveservices/Language.Conversations -commit: 36651c812f1816316250b4ee3c02433e6d60576f +commit: 6e8e566a596fb72581c26696c88e88c6990c3924 repo: Azure/azure-rest-api-specs From 53fd53e0c9a3f20dacadf5bbd75b02b63694bcde Mon Sep 17 00:00:00 2001 From: Xiong Chen Date: Mon, 13 Jan 2025 10:34:11 -0800 Subject: [PATCH 02/31] - adjust test examples based on the new generated sdk --- .../Sample1_AnalyzeConversation_ConversationPrediction.cs | 4 ++-- ...Sample2_AnalyzeConversation_OrchestrationPrediction.cs | 8 ++++---- .../Samples/Sample3_AnalyzeConversationWithOptions.cs | 4 ++-- .../Samples/Sample4_AnalyzeConversationWithLanguage.cs | 4 ++-- .../Sample5_AnalyzeConversation_ConversationPii.cs | 4 ++-- 5 files changed, 12 insertions(+), 12 deletions(-) diff --git a/sdk/cognitivelanguage/Azure.AI.Language.Conversations/tests/Samples/Sample1_AnalyzeConversation_ConversationPrediction.cs b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/tests/Samples/Sample1_AnalyzeConversation_ConversationPrediction.cs index 28ef2e350169..26d5b7034b82 100644 --- a/sdk/cognitivelanguage/Azure.AI.Language.Conversations/tests/Samples/Sample1_AnalyzeConversation_ConversationPrediction.cs +++ b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/tests/Samples/Sample1_AnalyzeConversation_ConversationPrediction.cs @@ -32,7 +32,7 @@ public void AnalyzeConversation() id: "1", participantId: "participant1", text: "Send an email to Carol about tomorrow's demo")), - new ConversationLanguageUnderstandingActionContent(projectName, deploymentName) + new ConversationActionContent(projectName, deploymentName) { // Use Utf16CodeUnit for strings in .NET. StringIndexType = StringIndexType.Utf16CodeUnit, @@ -96,7 +96,7 @@ public async Task AnalyzeConversationAsync() id: "1", participantId: "participant1", text: "Send an email to Carol about tomorrow's demo")), - new ConversationLanguageUnderstandingActionContent(projectName, deploymentName) + new ConversationActionContent(projectName, deploymentName) { StringIndexType = StringIndexType.Utf16CodeUnit, }); diff --git a/sdk/cognitivelanguage/Azure.AI.Language.Conversations/tests/Samples/Sample2_AnalyzeConversation_OrchestrationPrediction.cs b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/tests/Samples/Sample2_AnalyzeConversation_OrchestrationPrediction.cs index 6c57bbcf191d..d732aebe7c91 100644 --- a/sdk/cognitivelanguage/Azure.AI.Language.Conversations/tests/Samples/Sample2_AnalyzeConversation_OrchestrationPrediction.cs +++ b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/tests/Samples/Sample2_AnalyzeConversation_OrchestrationPrediction.cs @@ -33,7 +33,7 @@ public void AnalyzeConversationOrchestrationPredictionQuestionAnswering() id: "1", participantId: "participant1", text: "How are you?")), - new ConversationLanguageUnderstandingActionContent(projectName, deploymentName) + new ConversationActionContent(projectName, deploymentName) { StringIndexType = StringIndexType.Utf16CodeUnit, }); @@ -77,7 +77,7 @@ public void AnalyzeConversationOrchestrationPredictionConversation() id: "1", participantId: "1", text: "How are you?")), - new ConversationLanguageUnderstandingActionContent(projectName, deploymentName) + new ConversationActionContent(projectName, deploymentName) { // Use Utf16CodeUnit for strings in .NET. StringIndexType = StringIndexType.Utf16CodeUnit, @@ -174,7 +174,7 @@ public async Task AnalyzeConversationOrchestrationPredictionQuestionAnsweringAsy id: "1", participantId: "1", text: "How are you?")), - new ConversationLanguageUnderstandingActionContent(projectName, deploymentName) + new ConversationActionContent(projectName, deploymentName) { // Use Utf16CodeUnit for strings in .NET. StringIndexType = StringIndexType.Utf16CodeUnit, @@ -215,7 +215,7 @@ public async Task AnalyzeConversationOrchestrationPredictionConversationAsync() id: "1", participantId: "1", text: "Send an email to Carol about tomorrow's demo")), - new ConversationLanguageUnderstandingActionContent(TestEnvironment.OrchestrationProjectName, TestEnvironment.OrchestrationDeploymentName) + new ConversationActionContent(TestEnvironment.OrchestrationProjectName, TestEnvironment.OrchestrationDeploymentName) { StringIndexType = StringIndexType.Utf16CodeUnit, }); diff --git a/sdk/cognitivelanguage/Azure.AI.Language.Conversations/tests/Samples/Sample3_AnalyzeConversationWithOptions.cs b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/tests/Samples/Sample3_AnalyzeConversationWithOptions.cs index 8cf35eecbb43..ea62ec3f4f27 100644 --- a/sdk/cognitivelanguage/Azure.AI.Language.Conversations/tests/Samples/Sample3_AnalyzeConversationWithOptions.cs +++ b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/tests/Samples/Sample3_AnalyzeConversationWithOptions.cs @@ -32,7 +32,7 @@ public void AnalyzeConversationWithOptions() id: "1", participantId: "participant1", text: "Send an email to Carol about tomorrow's demo")), - new ConversationLanguageUnderstandingActionContent(projectName, deploymentName) + new ConversationActionContent(projectName, deploymentName) { // Use Utf16CodeUnit for strings in .NET. StringIndexType = StringIndexType.Utf16CodeUnit, @@ -97,7 +97,7 @@ public async Task AnalyzeConversationWithOptionsAsync() id: "1", participantId: "participant1", text: "Send an email to Carol about tomorrow's demo")), - new ConversationLanguageUnderstandingActionContent(projectName, deploymentName) + new ConversationActionContent(projectName, deploymentName) { // Use Utf16CodeUnit for strings in .NET. StringIndexType = StringIndexType.Utf16CodeUnit, diff --git a/sdk/cognitivelanguage/Azure.AI.Language.Conversations/tests/Samples/Sample4_AnalyzeConversationWithLanguage.cs b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/tests/Samples/Sample4_AnalyzeConversationWithLanguage.cs index ba2cdf218c44..702001793893 100644 --- a/sdk/cognitivelanguage/Azure.AI.Language.Conversations/tests/Samples/Sample4_AnalyzeConversationWithLanguage.cs +++ b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/tests/Samples/Sample4_AnalyzeConversationWithLanguage.cs @@ -36,7 +36,7 @@ public void AnalyzeConversationWithLanguage() { Language = "es" }), - new ConversationLanguageUnderstandingActionContent(projectName, deploymentName) + new ConversationActionContent(projectName, deploymentName) { // Use Utf16CodeUnit for strings in .NET. StringIndexType = StringIndexType.Utf16CodeUnit, @@ -105,7 +105,7 @@ public async Task AnalyzeConversationWithLanguageAsync() { Language = "es" }), - new ConversationLanguageUnderstandingActionContent(projectName, deploymentName) + new ConversationActionContent(projectName, deploymentName) { // Use Utf16CodeUnit for strings in .NET. StringIndexType = StringIndexType.Utf16CodeUnit, diff --git a/sdk/cognitivelanguage/Azure.AI.Language.Conversations/tests/Samples/Sample5_AnalyzeConversation_ConversationPii.cs b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/tests/Samples/Sample5_AnalyzeConversation_ConversationPii.cs index a63713e90bac..2d929365da9f 100644 --- a/sdk/cognitivelanguage/Azure.AI.Language.Conversations/tests/Samples/Sample5_AnalyzeConversation_ConversationPii.cs +++ b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/tests/Samples/Sample5_AnalyzeConversation_ConversationPii.cs @@ -35,7 +35,7 @@ public void AnalyzeConversation_ConversationPii() { new PiiOperationAction() { - ActionContent = new ConversationPiiActionContent(), + ActionContent = new PiiActionContent(), Name = "Conversation PII", } }; @@ -120,7 +120,7 @@ public async Task AnalyzeConversationAsync_ConversationPii() { new PiiOperationAction() { - ActionContent = new ConversationPiiActionContent(), + ActionContent = new PiiActionContent(), Name = "Conversation PII", } }; From 4eb9eaaa49b023cd57164d05762d4e3bf5cf4f9d Mon Sep 17 00:00:00 2001 From: Xiong Chen Date: Mon, 13 Jan 2025 11:11:13 -0800 Subject: [PATCH 03/31] updated samples and snippets --- .../Azure.AI.Language.Conversations/README.md | 10 +- .../Azure.AI.Language.Conversations.net8.0.cs | 129 ++++++++++++------ ...I.Language.Conversations.netstandard2.0.cs | 129 ++++++++++++------ ...lyzeConversation_ConversationPrediction.md | 2 +- ...yzeConversation_OrchestrationPrediction.md | 2 +- ...Sample3_AnalyzeConversationWithLanguage.md | 2 +- .../Sample4_AnalyzeConversationWithOptions.md | 2 +- ...le8_AnalyzeConversation_ConversationPii.md | 2 +- 8 files changed, 184 insertions(+), 94 deletions(-) diff --git a/sdk/cognitivelanguage/Azure.AI.Language.Conversations/README.md b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/README.md index b4c9ac591b90..cd5413d372f6 100644 --- a/sdk/cognitivelanguage/Azure.AI.Language.Conversations/README.md +++ b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/README.md @@ -165,7 +165,7 @@ AnalyzeConversationInput data = new ConversationLanguageUnderstandingInput( id: "1", participantId: "participant1", text: "Send an email to Carol about tomorrow's demo")), - new ConversationLanguageUnderstandingActionContent(projectName, deploymentName) + new ConversationActionContent(projectName, deploymentName) { // Use Utf16CodeUnit for strings in .NET. StringIndexType = StringIndexType.Utf16CodeUnit, @@ -223,7 +223,7 @@ AnalyzeConversationInput data = new ConversationLanguageUnderstandingInput( id: "1", participantId: "participant1", text: "Send an email to Carol about tomorrow's demo")), - new ConversationLanguageUnderstandingActionContent(projectName, deploymentName) + new ConversationActionContent(projectName, deploymentName) { // Use Utf16CodeUnit for strings in .NET. StringIndexType = StringIndexType.Utf16CodeUnit, @@ -251,7 +251,7 @@ AnalyzeConversationInput data = { Language = "es" }), - new ConversationLanguageUnderstandingActionContent(projectName, deploymentName) + new ConversationActionContent(projectName, deploymentName) { // Use Utf16CodeUnit for strings in .NET. StringIndexType = StringIndexType.Utf16CodeUnit, @@ -275,7 +275,7 @@ AnalyzeConversationInput data = new ConversationLanguageUnderstandingInput( id: "1", participantId: "participant1", text: "How are you?")), - new ConversationLanguageUnderstandingActionContent(projectName, deploymentName) + new ConversationActionContent(projectName, deploymentName) { StringIndexType = StringIndexType.Utf16CodeUnit, }); @@ -426,7 +426,7 @@ List actions = new List targetProjectParameters = null) { throw null; } public static Azure.AI.Language.Conversations.Models.ConversationActionResult ConversationActionResult(Azure.AI.Language.Conversations.Models.AnalyzeConversationResult result = null) { throw null; } public static Azure.AI.Language.Conversations.Models.ConversationActions ConversationActions(int completed = 0, int failed = 0, int inProgress = 0, int total = 0, System.Collections.Generic.IEnumerable items = null) { throw null; } public static Azure.AI.Language.Conversations.Models.ConversationalPiiResult ConversationalPiiResult(string id = null, System.Collections.Generic.IEnumerable warnings = null, Azure.AI.Language.Conversations.Models.ConversationStatistics statistics = null, System.Collections.Generic.IEnumerable conversationItems = null) { throw null; } @@ -58,8 +59,7 @@ public static partial class ConversationsModelFactory public static Azure.AI.Language.Conversations.Models.ConversationError ConversationError(Azure.AI.Language.Conversations.Models.ConversationErrorCode code = default(Azure.AI.Language.Conversations.Models.ConversationErrorCode), string message = null, string target = null, System.Collections.Generic.IEnumerable details = null, Azure.AI.Language.Conversations.Models.InnerErrorModel innererror = null) { throw null; } public static Azure.AI.Language.Conversations.Models.ConversationInput ConversationInput(string id = null, string language = null, string modality = null, Azure.AI.Language.Conversations.Models.ConversationDomain? domain = default(Azure.AI.Language.Conversations.Models.ConversationDomain?)) { throw null; } public static Azure.AI.Language.Conversations.Models.ConversationIntent ConversationIntent(string category = null, float confidence = 0f) { throw null; } - public static Azure.AI.Language.Conversations.Models.ConversationLanguageUnderstandingActionContent ConversationLanguageUnderstandingActionContent(string projectName = null, string deploymentName = null, bool? verbose = default(bool?), bool? isLoggingEnabled = default(bool?), Azure.AI.Language.Conversations.Models.StringIndexType? stringIndexType = default(Azure.AI.Language.Conversations.Models.StringIndexType?), string directTarget = null, System.Collections.Generic.IDictionary targetProjectParameters = null) { throw null; } - public static Azure.AI.Language.Conversations.Models.ConversationLanguageUnderstandingInput ConversationLanguageUnderstandingInput(Azure.AI.Language.Conversations.Models.ConversationAnalysisInput conversationInput = null, Azure.AI.Language.Conversations.Models.ConversationLanguageUnderstandingActionContent actionContent = null) { throw null; } + public static Azure.AI.Language.Conversations.Models.ConversationLanguageUnderstandingInput ConversationLanguageUnderstandingInput(Azure.AI.Language.Conversations.Models.ConversationAnalysisInput conversationInput = null, Azure.AI.Language.Conversations.Models.ConversationActionContent actionContent = null) { throw null; } public static Azure.AI.Language.Conversations.Models.ConversationPiiItemResult ConversationPiiItemResult(string id = null, Azure.AI.Language.Conversations.Models.RedactedTranscriptContent redactedContent = null, System.Collections.Generic.IEnumerable entities = null) { throw null; } public static Azure.AI.Language.Conversations.Models.ConversationPiiOperationResult ConversationPiiOperationResult(System.DateTimeOffset lastUpdateDateTime = default(System.DateTimeOffset), Azure.AI.Language.Conversations.Models.ConversationActionState status = default(Azure.AI.Language.Conversations.Models.ConversationActionState), string name = null, Azure.AI.Language.Conversations.Models.ConversationPiiResults results = null) { throw null; } public static Azure.AI.Language.Conversations.Models.ConversationPiiResults ConversationPiiResults(System.Collections.Generic.IEnumerable errors = null, Azure.AI.Language.Conversations.Models.RequestStatistics statistics = null, string modelVersion = null, System.Collections.Generic.IEnumerable conversations = null) { throw null; } @@ -89,7 +89,7 @@ public static partial class ConversationsModelFactory public static Azure.AI.Language.Conversations.Models.ListKey ListKey(string key = null) { throw null; } public static Azure.AI.Language.Conversations.Models.LuisResult LuisResult(System.Collections.Generic.IReadOnlyDictionary additionalProperties = null) { throw null; } public static Azure.AI.Language.Conversations.Models.LuisTargetIntentResult LuisTargetIntentResult(string apiVersion = null, double confidence = 0, Azure.AI.Language.Conversations.Models.LuisResult result = null) { throw null; } - public static Azure.AI.Language.Conversations.Models.NamedEntity NamedEntity(string text = null, string category = null, string subcategory = null, int offset = 0, int length = 0, double confidenceScore = 0) { throw null; } + public static Azure.AI.Language.Conversations.Models.NamedEntity NamedEntity(string text = null, string category = null, string subcategory = null, int offset = 0, int length = 0, double confidenceScore = 0, string mask = null, int? maskOffset = default(int?), int? maskLength = default(int?)) { throw null; } public static Azure.AI.Language.Conversations.Models.NoneLinkedTargetIntentResult NoneLinkedTargetIntentResult(string apiVersion = null, double confidence = 0, Azure.AI.Language.Conversations.Models.ConversationResult result = null) { throw null; } public static Azure.AI.Language.Conversations.Models.NumberResolution NumberResolution(Azure.AI.Language.Conversations.Models.NumberKind numberKind = default(Azure.AI.Language.Conversations.Models.NumberKind), double value = 0) { throw null; } public static Azure.AI.Language.Conversations.Models.NumericRangeResolution NumericRangeResolution(Azure.AI.Language.Conversations.Models.RangeKind rangeKind = default(Azure.AI.Language.Conversations.Models.RangeKind), double minimum = 0, double maximum = 0) { throw null; } @@ -407,6 +407,16 @@ protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } } + public abstract partial class BaseRedactionPolicy : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + protected BaseRedactionPolicy() { } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Language.Conversations.Models.BaseRedactionPolicy System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Language.Conversations.Models.BaseRedactionPolicy System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } public partial class BooleanResolution : Azure.AI.Language.Conversations.Models.ResolutionBase, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel { internal BooleanResolution() { } @@ -418,6 +428,23 @@ protected override void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter write string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } } + public partial class ConversationActionContent : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public ConversationActionContent(string projectName, string deploymentName) { } + public string DeploymentName { get { throw null; } } + public string DirectTarget { get { throw null; } set { } } + public bool? IsLoggingEnabled { get { throw null; } set { } } + public string ProjectName { get { throw null; } } + public Azure.AI.Language.Conversations.Models.StringIndexType? StringIndexType { get { throw null; } set { } } + public System.Collections.Generic.IDictionary TargetProjectParameters { get { throw null; } } + public bool? Verbose { get { throw null; } set { } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Language.Conversations.Models.ConversationActionContent System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Language.Conversations.Models.ConversationActionContent System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } public partial class ConversationActionResult : Azure.AI.Language.Conversations.Models.AnalyzeConversationActionResult, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel { internal ConversationActionResult() { } @@ -648,27 +675,10 @@ protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } } - public partial class ConversationLanguageUnderstandingActionContent : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel - { - public ConversationLanguageUnderstandingActionContent(string projectName, string deploymentName) { } - public string DeploymentName { get { throw null; } } - public string DirectTarget { get { throw null; } set { } } - public bool? IsLoggingEnabled { get { throw null; } set { } } - public string ProjectName { get { throw null; } } - public Azure.AI.Language.Conversations.Models.StringIndexType? StringIndexType { get { throw null; } set { } } - public System.Collections.Generic.IDictionary TargetProjectParameters { get { throw null; } } - public bool? Verbose { get { throw null; } set { } } - protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } - Azure.AI.Language.Conversations.Models.ConversationLanguageUnderstandingActionContent System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } - void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } - Azure.AI.Language.Conversations.Models.ConversationLanguageUnderstandingActionContent System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } - string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } - System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } - } public partial class ConversationLanguageUnderstandingInput : Azure.AI.Language.Conversations.Models.AnalyzeConversationInput, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel { - public ConversationLanguageUnderstandingInput(Azure.AI.Language.Conversations.Models.ConversationAnalysisInput conversationInput, Azure.AI.Language.Conversations.Models.ConversationLanguageUnderstandingActionContent actionContent) { } - public Azure.AI.Language.Conversations.Models.ConversationLanguageUnderstandingActionContent ActionContent { get { throw null; } } + public ConversationLanguageUnderstandingInput(Azure.AI.Language.Conversations.Models.ConversationAnalysisInput conversationInput, Azure.AI.Language.Conversations.Models.ConversationActionContent actionContent) { } + public Azure.AI.Language.Conversations.Models.ConversationActionContent ActionContent { get { throw null; } } public Azure.AI.Language.Conversations.Models.ConversationAnalysisInput ConversationInput { get { throw null; } } protected override void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.AI.Language.Conversations.Models.ConversationLanguageUnderstandingInput System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } @@ -677,23 +687,6 @@ protected override void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter write string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } } - public partial class ConversationPiiActionContent : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel - { - public ConversationPiiActionContent() { } - public System.Collections.Generic.IList ExcludePiiCategories { get { throw null; } } - public bool? LoggingOptOut { get { throw null; } set { } } - public string ModelVersion { get { throw null; } set { } } - public System.Collections.Generic.IList PiiCategories { get { throw null; } } - public bool? RedactAudioTiming { get { throw null; } set { } } - public Azure.AI.Language.Conversations.Models.RedactionCharacter? RedactionCharacter { get { throw null; } set { } } - public Azure.AI.Language.Conversations.Models.TranscriptContentType? RedactionSource { get { throw null; } set { } } - protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } - Azure.AI.Language.Conversations.Models.ConversationPiiActionContent System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } - void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } - Azure.AI.Language.Conversations.Models.ConversationPiiActionContent System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } - string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } - System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } - } [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] public readonly partial struct ConversationPiiCategories : System.IEquatable { @@ -989,6 +982,16 @@ protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } } + public partial class DoNotRedactPolicyType : Azure.AI.Language.Conversations.Models.BaseRedactionPolicy, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public DoNotRedactPolicyType() { } + protected override void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Language.Conversations.Models.DoNotRedactPolicyType System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Language.Conversations.Models.DoNotRedactPolicyType System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } public partial class EntitySubtype : Azure.AI.Language.Conversations.Models.ConversationEntityExtraInformation, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel { internal EntitySubtype() { } @@ -1322,6 +1325,27 @@ protected override void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter write string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } } + public partial class MaskWithEntityTypePolicyType : Azure.AI.Language.Conversations.Models.BaseRedactionPolicy, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public MaskWithEntityTypePolicyType() { } + protected override void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Language.Conversations.Models.MaskWithEntityTypePolicyType System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Language.Conversations.Models.MaskWithEntityTypePolicyType System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + public partial class MaskWithRedactionCharacterPolicyType : Azure.AI.Language.Conversations.Models.BaseRedactionPolicy, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public MaskWithRedactionCharacterPolicyType() { } + public Azure.AI.Language.Conversations.Models.RedactionCharacter? RedactionCharacter { get { throw null; } set { } } + protected override void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Language.Conversations.Models.MaskWithRedactionCharacterPolicyType System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Language.Conversations.Models.MaskWithRedactionCharacterPolicyType System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } public partial class MetadataFilter : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel { public MetadataFilter() { } @@ -1363,6 +1387,9 @@ internal NamedEntity() { } public string Category { get { throw null; } } public double ConfidenceScore { get { throw null; } } public int Length { get { throw null; } } + public string Mask { get { throw null; } } + public int? MaskLength { get { throw null; } } + public int? MaskOffset { get { throw null; } } public int Offset { get { throw null; } } public string Subcategory { get { throw null; } } public string Text { get { throw null; } } @@ -1474,10 +1501,28 @@ protected override void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter write public static bool operator !=(Azure.AI.Language.Conversations.Models.ParticipantRole left, Azure.AI.Language.Conversations.Models.ParticipantRole right) { throw null; } public override string ToString() { throw null; } } + public partial class PiiActionContent : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public PiiActionContent() { } + public System.Collections.Generic.IList ExcludePiiCategories { get { throw null; } } + public bool? LoggingOptOut { get { throw null; } set { } } + public string ModelVersion { get { throw null; } set { } } + public System.Collections.Generic.IList PiiCategories { get { throw null; } } + public bool? RedactAudioTiming { get { throw null; } set { } } + public Azure.AI.Language.Conversations.Models.RedactionCharacter? RedactionCharacter { get { throw null; } set { } } + public Azure.AI.Language.Conversations.Models.BaseRedactionPolicy RedactionPolicy { get { throw null; } set { } } + public Azure.AI.Language.Conversations.Models.TranscriptContentType? RedactionSource { get { throw null; } set { } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Language.Conversations.Models.PiiActionContent System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Language.Conversations.Models.PiiActionContent System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } public partial class PiiOperationAction : Azure.AI.Language.Conversations.Models.AnalyzeConversationOperationAction, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel { public PiiOperationAction() { } - public Azure.AI.Language.Conversations.Models.ConversationPiiActionContent ActionContent { get { throw null; } set { } } + public Azure.AI.Language.Conversations.Models.PiiActionContent ActionContent { get { throw null; } set { } } protected override void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.AI.Language.Conversations.Models.PiiOperationAction System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } diff --git a/sdk/cognitivelanguage/Azure.AI.Language.Conversations/api/Azure.AI.Language.Conversations.netstandard2.0.cs b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/api/Azure.AI.Language.Conversations.netstandard2.0.cs index 2a590fb10e78..4e499a09262b 100644 --- a/sdk/cognitivelanguage/Azure.AI.Language.Conversations/api/Azure.AI.Language.Conversations.netstandard2.0.cs +++ b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/api/Azure.AI.Language.Conversations.netstandard2.0.cs @@ -30,13 +30,13 @@ public ConversationAnalysisClient(System.Uri endpoint, Azure.Core.TokenCredentia } public partial class ConversationsClientOptions : Azure.Core.ClientOptions { - public ConversationsClientOptions(Azure.AI.Language.Conversations.ConversationsClientOptions.ServiceVersion version = Azure.AI.Language.Conversations.ConversationsClientOptions.ServiceVersion.V2024_05_15_Preview) { } + public ConversationsClientOptions(Azure.AI.Language.Conversations.ConversationsClientOptions.ServiceVersion version = Azure.AI.Language.Conversations.ConversationsClientOptions.ServiceVersion.V2024_11_15_Preview) { } public enum ServiceVersion { V2022_05_01 = 1, V2023_04_01 = 2, V2024_05_01 = 3, - V2024_05_15_Preview = 4, + V2024_11_15_Preview = 4, } } public static partial class ConversationsModelFactory @@ -51,6 +51,7 @@ public static partial class ConversationsModelFactory public static Azure.AI.Language.Conversations.Models.AreaResolution AreaResolution(double value = 0, Azure.AI.Language.Conversations.Models.AreaUnit unit = default(Azure.AI.Language.Conversations.Models.AreaUnit)) { throw null; } public static Azure.AI.Language.Conversations.Models.AudioTiming AudioTiming(long? offset = default(long?), long? duration = default(long?)) { throw null; } public static Azure.AI.Language.Conversations.Models.BooleanResolution BooleanResolution(bool value = false) { throw null; } + public static Azure.AI.Language.Conversations.Models.ConversationActionContent ConversationActionContent(string projectName = null, string deploymentName = null, bool? verbose = default(bool?), bool? isLoggingEnabled = default(bool?), Azure.AI.Language.Conversations.Models.StringIndexType? stringIndexType = default(Azure.AI.Language.Conversations.Models.StringIndexType?), string directTarget = null, System.Collections.Generic.IDictionary targetProjectParameters = null) { throw null; } public static Azure.AI.Language.Conversations.Models.ConversationActionResult ConversationActionResult(Azure.AI.Language.Conversations.Models.AnalyzeConversationResult result = null) { throw null; } public static Azure.AI.Language.Conversations.Models.ConversationActions ConversationActions(int completed = 0, int failed = 0, int inProgress = 0, int total = 0, System.Collections.Generic.IEnumerable items = null) { throw null; } public static Azure.AI.Language.Conversations.Models.ConversationalPiiResult ConversationalPiiResult(string id = null, System.Collections.Generic.IEnumerable warnings = null, Azure.AI.Language.Conversations.Models.ConversationStatistics statistics = null, System.Collections.Generic.IEnumerable conversationItems = null) { throw null; } @@ -58,8 +59,7 @@ public static partial class ConversationsModelFactory public static Azure.AI.Language.Conversations.Models.ConversationError ConversationError(Azure.AI.Language.Conversations.Models.ConversationErrorCode code = default(Azure.AI.Language.Conversations.Models.ConversationErrorCode), string message = null, string target = null, System.Collections.Generic.IEnumerable details = null, Azure.AI.Language.Conversations.Models.InnerErrorModel innererror = null) { throw null; } public static Azure.AI.Language.Conversations.Models.ConversationInput ConversationInput(string id = null, string language = null, string modality = null, Azure.AI.Language.Conversations.Models.ConversationDomain? domain = default(Azure.AI.Language.Conversations.Models.ConversationDomain?)) { throw null; } public static Azure.AI.Language.Conversations.Models.ConversationIntent ConversationIntent(string category = null, float confidence = 0f) { throw null; } - public static Azure.AI.Language.Conversations.Models.ConversationLanguageUnderstandingActionContent ConversationLanguageUnderstandingActionContent(string projectName = null, string deploymentName = null, bool? verbose = default(bool?), bool? isLoggingEnabled = default(bool?), Azure.AI.Language.Conversations.Models.StringIndexType? stringIndexType = default(Azure.AI.Language.Conversations.Models.StringIndexType?), string directTarget = null, System.Collections.Generic.IDictionary targetProjectParameters = null) { throw null; } - public static Azure.AI.Language.Conversations.Models.ConversationLanguageUnderstandingInput ConversationLanguageUnderstandingInput(Azure.AI.Language.Conversations.Models.ConversationAnalysisInput conversationInput = null, Azure.AI.Language.Conversations.Models.ConversationLanguageUnderstandingActionContent actionContent = null) { throw null; } + public static Azure.AI.Language.Conversations.Models.ConversationLanguageUnderstandingInput ConversationLanguageUnderstandingInput(Azure.AI.Language.Conversations.Models.ConversationAnalysisInput conversationInput = null, Azure.AI.Language.Conversations.Models.ConversationActionContent actionContent = null) { throw null; } public static Azure.AI.Language.Conversations.Models.ConversationPiiItemResult ConversationPiiItemResult(string id = null, Azure.AI.Language.Conversations.Models.RedactedTranscriptContent redactedContent = null, System.Collections.Generic.IEnumerable entities = null) { throw null; } public static Azure.AI.Language.Conversations.Models.ConversationPiiOperationResult ConversationPiiOperationResult(System.DateTimeOffset lastUpdateDateTime = default(System.DateTimeOffset), Azure.AI.Language.Conversations.Models.ConversationActionState status = default(Azure.AI.Language.Conversations.Models.ConversationActionState), string name = null, Azure.AI.Language.Conversations.Models.ConversationPiiResults results = null) { throw null; } public static Azure.AI.Language.Conversations.Models.ConversationPiiResults ConversationPiiResults(System.Collections.Generic.IEnumerable errors = null, Azure.AI.Language.Conversations.Models.RequestStatistics statistics = null, string modelVersion = null, System.Collections.Generic.IEnumerable conversations = null) { throw null; } @@ -89,7 +89,7 @@ public static partial class ConversationsModelFactory public static Azure.AI.Language.Conversations.Models.ListKey ListKey(string key = null) { throw null; } public static Azure.AI.Language.Conversations.Models.LuisResult LuisResult(System.Collections.Generic.IReadOnlyDictionary additionalProperties = null) { throw null; } public static Azure.AI.Language.Conversations.Models.LuisTargetIntentResult LuisTargetIntentResult(string apiVersion = null, double confidence = 0, Azure.AI.Language.Conversations.Models.LuisResult result = null) { throw null; } - public static Azure.AI.Language.Conversations.Models.NamedEntity NamedEntity(string text = null, string category = null, string subcategory = null, int offset = 0, int length = 0, double confidenceScore = 0) { throw null; } + public static Azure.AI.Language.Conversations.Models.NamedEntity NamedEntity(string text = null, string category = null, string subcategory = null, int offset = 0, int length = 0, double confidenceScore = 0, string mask = null, int? maskOffset = default(int?), int? maskLength = default(int?)) { throw null; } public static Azure.AI.Language.Conversations.Models.NoneLinkedTargetIntentResult NoneLinkedTargetIntentResult(string apiVersion = null, double confidence = 0, Azure.AI.Language.Conversations.Models.ConversationResult result = null) { throw null; } public static Azure.AI.Language.Conversations.Models.NumberResolution NumberResolution(Azure.AI.Language.Conversations.Models.NumberKind numberKind = default(Azure.AI.Language.Conversations.Models.NumberKind), double value = 0) { throw null; } public static Azure.AI.Language.Conversations.Models.NumericRangeResolution NumericRangeResolution(Azure.AI.Language.Conversations.Models.RangeKind rangeKind = default(Azure.AI.Language.Conversations.Models.RangeKind), double minimum = 0, double maximum = 0) { throw null; } @@ -407,6 +407,16 @@ protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } } + public abstract partial class BaseRedactionPolicy : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + protected BaseRedactionPolicy() { } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Language.Conversations.Models.BaseRedactionPolicy System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Language.Conversations.Models.BaseRedactionPolicy System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } public partial class BooleanResolution : Azure.AI.Language.Conversations.Models.ResolutionBase, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel { internal BooleanResolution() { } @@ -418,6 +428,23 @@ protected override void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter write string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } } + public partial class ConversationActionContent : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public ConversationActionContent(string projectName, string deploymentName) { } + public string DeploymentName { get { throw null; } } + public string DirectTarget { get { throw null; } set { } } + public bool? IsLoggingEnabled { get { throw null; } set { } } + public string ProjectName { get { throw null; } } + public Azure.AI.Language.Conversations.Models.StringIndexType? StringIndexType { get { throw null; } set { } } + public System.Collections.Generic.IDictionary TargetProjectParameters { get { throw null; } } + public bool? Verbose { get { throw null; } set { } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Language.Conversations.Models.ConversationActionContent System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Language.Conversations.Models.ConversationActionContent System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } public partial class ConversationActionResult : Azure.AI.Language.Conversations.Models.AnalyzeConversationActionResult, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel { internal ConversationActionResult() { } @@ -648,27 +675,10 @@ protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } } - public partial class ConversationLanguageUnderstandingActionContent : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel - { - public ConversationLanguageUnderstandingActionContent(string projectName, string deploymentName) { } - public string DeploymentName { get { throw null; } } - public string DirectTarget { get { throw null; } set { } } - public bool? IsLoggingEnabled { get { throw null; } set { } } - public string ProjectName { get { throw null; } } - public Azure.AI.Language.Conversations.Models.StringIndexType? StringIndexType { get { throw null; } set { } } - public System.Collections.Generic.IDictionary TargetProjectParameters { get { throw null; } } - public bool? Verbose { get { throw null; } set { } } - protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } - Azure.AI.Language.Conversations.Models.ConversationLanguageUnderstandingActionContent System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } - void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } - Azure.AI.Language.Conversations.Models.ConversationLanguageUnderstandingActionContent System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } - string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } - System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } - } public partial class ConversationLanguageUnderstandingInput : Azure.AI.Language.Conversations.Models.AnalyzeConversationInput, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel { - public ConversationLanguageUnderstandingInput(Azure.AI.Language.Conversations.Models.ConversationAnalysisInput conversationInput, Azure.AI.Language.Conversations.Models.ConversationLanguageUnderstandingActionContent actionContent) { } - public Azure.AI.Language.Conversations.Models.ConversationLanguageUnderstandingActionContent ActionContent { get { throw null; } } + public ConversationLanguageUnderstandingInput(Azure.AI.Language.Conversations.Models.ConversationAnalysisInput conversationInput, Azure.AI.Language.Conversations.Models.ConversationActionContent actionContent) { } + public Azure.AI.Language.Conversations.Models.ConversationActionContent ActionContent { get { throw null; } } public Azure.AI.Language.Conversations.Models.ConversationAnalysisInput ConversationInput { get { throw null; } } protected override void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.AI.Language.Conversations.Models.ConversationLanguageUnderstandingInput System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } @@ -677,23 +687,6 @@ protected override void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter write string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } } - public partial class ConversationPiiActionContent : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel - { - public ConversationPiiActionContent() { } - public System.Collections.Generic.IList ExcludePiiCategories { get { throw null; } } - public bool? LoggingOptOut { get { throw null; } set { } } - public string ModelVersion { get { throw null; } set { } } - public System.Collections.Generic.IList PiiCategories { get { throw null; } } - public bool? RedactAudioTiming { get { throw null; } set { } } - public Azure.AI.Language.Conversations.Models.RedactionCharacter? RedactionCharacter { get { throw null; } set { } } - public Azure.AI.Language.Conversations.Models.TranscriptContentType? RedactionSource { get { throw null; } set { } } - protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } - Azure.AI.Language.Conversations.Models.ConversationPiiActionContent System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } - void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } - Azure.AI.Language.Conversations.Models.ConversationPiiActionContent System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } - string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } - System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } - } [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] public readonly partial struct ConversationPiiCategories : System.IEquatable { @@ -989,6 +982,16 @@ protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } } + public partial class DoNotRedactPolicyType : Azure.AI.Language.Conversations.Models.BaseRedactionPolicy, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public DoNotRedactPolicyType() { } + protected override void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Language.Conversations.Models.DoNotRedactPolicyType System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Language.Conversations.Models.DoNotRedactPolicyType System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } public partial class EntitySubtype : Azure.AI.Language.Conversations.Models.ConversationEntityExtraInformation, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel { internal EntitySubtype() { } @@ -1322,6 +1325,27 @@ protected override void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter write string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } } + public partial class MaskWithEntityTypePolicyType : Azure.AI.Language.Conversations.Models.BaseRedactionPolicy, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public MaskWithEntityTypePolicyType() { } + protected override void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Language.Conversations.Models.MaskWithEntityTypePolicyType System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Language.Conversations.Models.MaskWithEntityTypePolicyType System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + public partial class MaskWithRedactionCharacterPolicyType : Azure.AI.Language.Conversations.Models.BaseRedactionPolicy, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public MaskWithRedactionCharacterPolicyType() { } + public Azure.AI.Language.Conversations.Models.RedactionCharacter? RedactionCharacter { get { throw null; } set { } } + protected override void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Language.Conversations.Models.MaskWithRedactionCharacterPolicyType System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Language.Conversations.Models.MaskWithRedactionCharacterPolicyType System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } public partial class MetadataFilter : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel { public MetadataFilter() { } @@ -1363,6 +1387,9 @@ internal NamedEntity() { } public string Category { get { throw null; } } public double ConfidenceScore { get { throw null; } } public int Length { get { throw null; } } + public string Mask { get { throw null; } } + public int? MaskLength { get { throw null; } } + public int? MaskOffset { get { throw null; } } public int Offset { get { throw null; } } public string Subcategory { get { throw null; } } public string Text { get { throw null; } } @@ -1474,10 +1501,28 @@ protected override void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter write public static bool operator !=(Azure.AI.Language.Conversations.Models.ParticipantRole left, Azure.AI.Language.Conversations.Models.ParticipantRole right) { throw null; } public override string ToString() { throw null; } } + public partial class PiiActionContent : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public PiiActionContent() { } + public System.Collections.Generic.IList ExcludePiiCategories { get { throw null; } } + public bool? LoggingOptOut { get { throw null; } set { } } + public string ModelVersion { get { throw null; } set { } } + public System.Collections.Generic.IList PiiCategories { get { throw null; } } + public bool? RedactAudioTiming { get { throw null; } set { } } + public Azure.AI.Language.Conversations.Models.RedactionCharacter? RedactionCharacter { get { throw null; } set { } } + public Azure.AI.Language.Conversations.Models.BaseRedactionPolicy RedactionPolicy { get { throw null; } set { } } + public Azure.AI.Language.Conversations.Models.TranscriptContentType? RedactionSource { get { throw null; } set { } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Language.Conversations.Models.PiiActionContent System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Language.Conversations.Models.PiiActionContent System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } public partial class PiiOperationAction : Azure.AI.Language.Conversations.Models.AnalyzeConversationOperationAction, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel { public PiiOperationAction() { } - public Azure.AI.Language.Conversations.Models.ConversationPiiActionContent ActionContent { get { throw null; } set { } } + public Azure.AI.Language.Conversations.Models.PiiActionContent ActionContent { get { throw null; } set { } } protected override void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.AI.Language.Conversations.Models.PiiOperationAction System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } diff --git a/sdk/cognitivelanguage/Azure.AI.Language.Conversations/samples/Sample1_AnalyzeConversation_ConversationPrediction.md b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/samples/Sample1_AnalyzeConversation_ConversationPrediction.md index 360527108ea0..556d681b87ef 100644 --- a/sdk/cognitivelanguage/Azure.AI.Language.Conversations/samples/Sample1_AnalyzeConversation_ConversationPrediction.md +++ b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/samples/Sample1_AnalyzeConversation_ConversationPrediction.md @@ -35,7 +35,7 @@ AnalyzeConversationInput data = new ConversationLanguageUnderstandingInput( id: "1", participantId: "participant1", text: "Send an email to Carol about tomorrow's demo")), - new ConversationLanguageUnderstandingActionContent(projectName, deploymentName) + new ConversationActionContent(projectName, deploymentName) { // Use Utf16CodeUnit for strings in .NET. StringIndexType = StringIndexType.Utf16CodeUnit, diff --git a/sdk/cognitivelanguage/Azure.AI.Language.Conversations/samples/Sample2_AnalyzeConversation_OrchestrationPrediction.md b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/samples/Sample2_AnalyzeConversation_OrchestrationPrediction.md index caa27ca1ee75..ea7a398981ba 100644 --- a/sdk/cognitivelanguage/Azure.AI.Language.Conversations/samples/Sample2_AnalyzeConversation_OrchestrationPrediction.md +++ b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/samples/Sample2_AnalyzeConversation_OrchestrationPrediction.md @@ -34,7 +34,7 @@ AnalyzeConversationInput data = new ConversationLanguageUnderstandingInput( id: "1", participantId: "participant1", text: "How are you?")), - new ConversationLanguageUnderstandingActionContent(projectName, deploymentName) + new ConversationActionContent(projectName, deploymentName) { StringIndexType = StringIndexType.Utf16CodeUnit, }); diff --git a/sdk/cognitivelanguage/Azure.AI.Language.Conversations/samples/Sample3_AnalyzeConversationWithLanguage.md b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/samples/Sample3_AnalyzeConversationWithLanguage.md index 31ab6ebdfd82..79b8273fcbf7 100644 --- a/sdk/cognitivelanguage/Azure.AI.Language.Conversations/samples/Sample3_AnalyzeConversationWithLanguage.md +++ b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/samples/Sample3_AnalyzeConversationWithLanguage.md @@ -39,7 +39,7 @@ AnalyzeConversationInput data = { Language = "es" }), - new ConversationLanguageUnderstandingActionContent(projectName, deploymentName) + new ConversationActionContent(projectName, deploymentName) { // Use Utf16CodeUnit for strings in .NET. StringIndexType = StringIndexType.Utf16CodeUnit, diff --git a/sdk/cognitivelanguage/Azure.AI.Language.Conversations/samples/Sample4_AnalyzeConversationWithOptions.md b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/samples/Sample4_AnalyzeConversationWithOptions.md index 04b27eabe7de..338aface5b04 100644 --- a/sdk/cognitivelanguage/Azure.AI.Language.Conversations/samples/Sample4_AnalyzeConversationWithOptions.md +++ b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/samples/Sample4_AnalyzeConversationWithOptions.md @@ -35,7 +35,7 @@ AnalyzeConversationInput data = new ConversationLanguageUnderstandingInput( id: "1", participantId: "participant1", text: "Send an email to Carol about tomorrow's demo")), - new ConversationLanguageUnderstandingActionContent(projectName, deploymentName) + new ConversationActionContent(projectName, deploymentName) { // Use Utf16CodeUnit for strings in .NET. StringIndexType = StringIndexType.Utf16CodeUnit, diff --git a/sdk/cognitivelanguage/Azure.AI.Language.Conversations/samples/Sample8_AnalyzeConversation_ConversationPii.md b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/samples/Sample8_AnalyzeConversation_ConversationPii.md index 666773152f58..3c8860221250 100644 --- a/sdk/cognitivelanguage/Azure.AI.Language.Conversations/samples/Sample8_AnalyzeConversation_ConversationPii.md +++ b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/samples/Sample8_AnalyzeConversation_ConversationPii.md @@ -38,7 +38,7 @@ List actions = new List Date: Mon, 13 Jan 2025 11:46:02 -0800 Subject: [PATCH 04/31] updated code based on new commit id --- .../Azure.AI.Language.Conversations.net8.0.cs | 60 ++-- ...I.Language.Conversations.netstandard2.0.cs | 60 ++-- .../Generated/ConversationsClientOptions.cs | 5 +- .../Generated/ConversationsModelFactory.cs | 328 +++++++++--------- .../Docs/ConversationAnalysisClient.xml | 76 ++-- .../BaseRedactionPolicy.Serialization.cs | 6 +- .../Generated/Models/BaseRedactionPolicy.cs | 2 +- ... CharacterMaskPolicyType.Serialization.cs} | 42 +-- ...licyType.cs => CharacterMaskPolicyType.cs} | 14 +- ...ummarizationActionContent.Serialization.cs | 12 + .../ConversationSummarizationActionContent.cs | 6 +- .../Generated/Models/DoNotRedactPolicyType.cs | 29 -- ...EntityMaskTypePolicyType.Serialization.cs} | 42 +-- .../Models/EntityMaskTypePolicyType.cs | 29 ++ .../Models/MaskWithEntityTypePolicyType.cs | 29 -- ...n.cs => NoMaskPolicyType.Serialization.cs} | 42 +-- .../src/Generated/Models/NoMaskPolicyType.cs | 29 ++ .../src/Generated/Models/PiiActionContent.cs | 4 +- .../Generated/Models/RedactionPolicyKind.cs | 20 +- .../Samples_ConversationAnalysisClient.cs | 140 ++++---- .../tsp-location.yaml | 2 +- 21 files changed, 500 insertions(+), 477 deletions(-) rename sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/{MaskWithRedactionCharacterPolicyType.Serialization.cs => CharacterMaskPolicyType.Serialization.cs} (62%) rename sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/{MaskWithRedactionCharacterPolicyType.cs => CharacterMaskPolicyType.cs} (58%) delete mode 100644 sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/DoNotRedactPolicyType.cs rename sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/{MaskWithEntityTypePolicyType.Serialization.cs => EntityMaskTypePolicyType.Serialization.cs} (60%) create mode 100644 sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/EntityMaskTypePolicyType.cs delete mode 100644 sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/MaskWithEntityTypePolicyType.cs rename sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/{DoNotRedactPolicyType.Serialization.cs => NoMaskPolicyType.Serialization.cs} (62%) create mode 100644 sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/NoMaskPolicyType.cs diff --git a/sdk/cognitivelanguage/Azure.AI.Language.Conversations/api/Azure.AI.Language.Conversations.net8.0.cs b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/api/Azure.AI.Language.Conversations.net8.0.cs index 4e499a09262b..52ca0e8836a6 100644 --- a/sdk/cognitivelanguage/Azure.AI.Language.Conversations/api/Azure.AI.Language.Conversations.net8.0.cs +++ b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/api/Azure.AI.Language.Conversations.net8.0.cs @@ -36,7 +36,8 @@ public enum ServiceVersion V2022_05_01 = 1, V2023_04_01 = 2, V2024_05_01 = 3, - V2024_11_15_Preview = 4, + V2024_11_01 = 4, + V2024_11_15_Preview = 5, } } public static partial class ConversationsModelFactory @@ -428,6 +429,17 @@ protected override void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter write string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } } + public partial class CharacterMaskPolicyType : Azure.AI.Language.Conversations.Models.BaseRedactionPolicy, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public CharacterMaskPolicyType() { } + public Azure.AI.Language.Conversations.Models.RedactionCharacter? RedactionCharacter { get { throw null; } set { } } + protected override void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Language.Conversations.Models.CharacterMaskPolicyType System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Language.Conversations.Models.CharacterMaskPolicyType System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } public partial class ConversationActionContent : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel { public ConversationActionContent(string projectName, string deploymentName) { } @@ -844,6 +856,7 @@ protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer public partial class ConversationSummarizationActionContent : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel { public ConversationSummarizationActionContent(System.Collections.Generic.IEnumerable summaryAspects) { } + public string Instruction { get { throw null; } set { } } public bool? LoggingOptOut { get { throw null; } set { } } public string ModelVersion { get { throw null; } set { } } public int? SentenceCount { get { throw null; } set { } } @@ -982,15 +995,15 @@ protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } } - public partial class DoNotRedactPolicyType : Azure.AI.Language.Conversations.Models.BaseRedactionPolicy, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + public partial class EntityMaskTypePolicyType : Azure.AI.Language.Conversations.Models.BaseRedactionPolicy, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel { - public DoNotRedactPolicyType() { } + public EntityMaskTypePolicyType() { } protected override void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } - Azure.AI.Language.Conversations.Models.DoNotRedactPolicyType System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } - void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } - Azure.AI.Language.Conversations.Models.DoNotRedactPolicyType System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } - string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } - System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + Azure.AI.Language.Conversations.Models.EntityMaskTypePolicyType System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Language.Conversations.Models.EntityMaskTypePolicyType System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } } public partial class EntitySubtype : Azure.AI.Language.Conversations.Models.ConversationEntityExtraInformation, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel { @@ -1325,27 +1338,6 @@ protected override void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter write string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } } - public partial class MaskWithEntityTypePolicyType : Azure.AI.Language.Conversations.Models.BaseRedactionPolicy, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel - { - public MaskWithEntityTypePolicyType() { } - protected override void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } - Azure.AI.Language.Conversations.Models.MaskWithEntityTypePolicyType System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } - void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } - Azure.AI.Language.Conversations.Models.MaskWithEntityTypePolicyType System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } - string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } - System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } - } - public partial class MaskWithRedactionCharacterPolicyType : Azure.AI.Language.Conversations.Models.BaseRedactionPolicy, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel - { - public MaskWithRedactionCharacterPolicyType() { } - public Azure.AI.Language.Conversations.Models.RedactionCharacter? RedactionCharacter { get { throw null; } set { } } - protected override void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } - Azure.AI.Language.Conversations.Models.MaskWithRedactionCharacterPolicyType System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } - void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } - Azure.AI.Language.Conversations.Models.MaskWithRedactionCharacterPolicyType System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } - string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } - System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } - } public partial class MetadataFilter : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel { public MetadataFilter() { } @@ -1400,6 +1392,16 @@ protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } } + public partial class NoMaskPolicyType : Azure.AI.Language.Conversations.Models.BaseRedactionPolicy, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public NoMaskPolicyType() { } + protected override void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Language.Conversations.Models.NoMaskPolicyType System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Language.Conversations.Models.NoMaskPolicyType System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } public partial class NoneLinkedTargetIntentResult : Azure.AI.Language.Conversations.Models.TargetIntentResult, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel { internal NoneLinkedTargetIntentResult() : base (default(double)) { } diff --git a/sdk/cognitivelanguage/Azure.AI.Language.Conversations/api/Azure.AI.Language.Conversations.netstandard2.0.cs b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/api/Azure.AI.Language.Conversations.netstandard2.0.cs index 4e499a09262b..52ca0e8836a6 100644 --- a/sdk/cognitivelanguage/Azure.AI.Language.Conversations/api/Azure.AI.Language.Conversations.netstandard2.0.cs +++ b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/api/Azure.AI.Language.Conversations.netstandard2.0.cs @@ -36,7 +36,8 @@ public enum ServiceVersion V2022_05_01 = 1, V2023_04_01 = 2, V2024_05_01 = 3, - V2024_11_15_Preview = 4, + V2024_11_01 = 4, + V2024_11_15_Preview = 5, } } public static partial class ConversationsModelFactory @@ -428,6 +429,17 @@ protected override void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter write string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } } + public partial class CharacterMaskPolicyType : Azure.AI.Language.Conversations.Models.BaseRedactionPolicy, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public CharacterMaskPolicyType() { } + public Azure.AI.Language.Conversations.Models.RedactionCharacter? RedactionCharacter { get { throw null; } set { } } + protected override void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Language.Conversations.Models.CharacterMaskPolicyType System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Language.Conversations.Models.CharacterMaskPolicyType System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } public partial class ConversationActionContent : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel { public ConversationActionContent(string projectName, string deploymentName) { } @@ -844,6 +856,7 @@ protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer public partial class ConversationSummarizationActionContent : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel { public ConversationSummarizationActionContent(System.Collections.Generic.IEnumerable summaryAspects) { } + public string Instruction { get { throw null; } set { } } public bool? LoggingOptOut { get { throw null; } set { } } public string ModelVersion { get { throw null; } set { } } public int? SentenceCount { get { throw null; } set { } } @@ -982,15 +995,15 @@ protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } } - public partial class DoNotRedactPolicyType : Azure.AI.Language.Conversations.Models.BaseRedactionPolicy, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + public partial class EntityMaskTypePolicyType : Azure.AI.Language.Conversations.Models.BaseRedactionPolicy, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel { - public DoNotRedactPolicyType() { } + public EntityMaskTypePolicyType() { } protected override void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } - Azure.AI.Language.Conversations.Models.DoNotRedactPolicyType System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } - void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } - Azure.AI.Language.Conversations.Models.DoNotRedactPolicyType System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } - string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } - System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + Azure.AI.Language.Conversations.Models.EntityMaskTypePolicyType System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Language.Conversations.Models.EntityMaskTypePolicyType System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } } public partial class EntitySubtype : Azure.AI.Language.Conversations.Models.ConversationEntityExtraInformation, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel { @@ -1325,27 +1338,6 @@ protected override void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter write string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } } - public partial class MaskWithEntityTypePolicyType : Azure.AI.Language.Conversations.Models.BaseRedactionPolicy, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel - { - public MaskWithEntityTypePolicyType() { } - protected override void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } - Azure.AI.Language.Conversations.Models.MaskWithEntityTypePolicyType System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } - void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } - Azure.AI.Language.Conversations.Models.MaskWithEntityTypePolicyType System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } - string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } - System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } - } - public partial class MaskWithRedactionCharacterPolicyType : Azure.AI.Language.Conversations.Models.BaseRedactionPolicy, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel - { - public MaskWithRedactionCharacterPolicyType() { } - public Azure.AI.Language.Conversations.Models.RedactionCharacter? RedactionCharacter { get { throw null; } set { } } - protected override void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } - Azure.AI.Language.Conversations.Models.MaskWithRedactionCharacterPolicyType System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } - void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } - Azure.AI.Language.Conversations.Models.MaskWithRedactionCharacterPolicyType System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } - string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } - System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } - } public partial class MetadataFilter : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel { public MetadataFilter() { } @@ -1400,6 +1392,16 @@ protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } } + public partial class NoMaskPolicyType : Azure.AI.Language.Conversations.Models.BaseRedactionPolicy, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public NoMaskPolicyType() { } + protected override void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Language.Conversations.Models.NoMaskPolicyType System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Language.Conversations.Models.NoMaskPolicyType System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } public partial class NoneLinkedTargetIntentResult : Azure.AI.Language.Conversations.Models.TargetIntentResult, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel { internal NoneLinkedTargetIntentResult() : base (default(double)) { } diff --git a/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/ConversationsClientOptions.cs b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/ConversationsClientOptions.cs index e0430ea44cd0..d44da9f8c426 100644 --- a/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/ConversationsClientOptions.cs +++ b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/ConversationsClientOptions.cs @@ -24,8 +24,10 @@ public enum ServiceVersion V2023_04_01 = 2, /// Service version "2024-05-01". V2024_05_01 = 3, + /// Service version "2024-11-01". + V2024_11_01 = 4, /// Service version "2024-11-15-preview". - V2024_11_15_Preview = 4, + V2024_11_15_Preview = 5, } internal string Version { get; } @@ -38,6 +40,7 @@ public ConversationsClientOptions(ServiceVersion version = LatestVersion) ServiceVersion.V2022_05_01 => "2022-05-01", ServiceVersion.V2023_04_01 => "2023-04-01", ServiceVersion.V2024_05_01 => "2024-05-01", + ServiceVersion.V2024_11_01 => "2024-11-01", ServiceVersion.V2024_11_15_Preview => "2024-11-15-preview", _ => throw new NotSupportedException() }; diff --git a/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/ConversationsModelFactory.cs b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/ConversationsModelFactory.cs index fe3dea411b99..c32db78f4b3a 100644 --- a/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/ConversationsModelFactory.cs +++ b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/ConversationsModelFactory.cs @@ -384,36 +384,6 @@ public static TargetIntentResult TargetIntentResult(string targetProjectKind = n return new UnknownTargetIntentResult(targetProjectKind == null ? default : new TargetProjectKind(targetProjectKind), apiVersion, confidence, serializedAdditionalRawData: null); } - /// Initializes a new instance of . - /// The API version used to call a target service. - /// The prediction score and it ranges from 0.0 to 1.0. - /// The actual response from a Conversation project. - /// A new instance for mocking. - public static NoneLinkedTargetIntentResult NoneLinkedTargetIntentResult(string apiVersion = null, double confidence = default, ConversationResult result = null) - { - return new NoneLinkedTargetIntentResult(TargetProjectKind.NonLinked, apiVersion, confidence, serializedAdditionalRawData: null, result); - } - - /// Initializes a new instance of . - /// The same query given in request. - /// The detected language from the query in BCP 47 language representation. - /// The predicted result for the query. - /// A new instance for mocking. - public static ConversationResult ConversationResult(string query = null, string detectedLanguage = null, ConversationPrediction prediction = null) - { - return new ConversationResult(query, detectedLanguage, prediction, serializedAdditionalRawData: null); - } - - /// Initializes a new instance of . - /// The API version used to call a target service. - /// The prediction score and it ranges from 0.0 to 1.0. - /// The actual response from a Conversation project. - /// A new instance for mocking. - public static ConversationTargetIntentResult ConversationTargetIntentResult(string apiVersion = null, double confidence = default, ConversationResult result = null) - { - return new ConversationTargetIntentResult(TargetProjectKind.Conversation, apiVersion, confidence, serializedAdditionalRawData: null, result); - } - /// Initializes a new instance of . /// The API version used to call a target service. /// The prediction score and it ranges from 0.0 to 1.0. @@ -513,6 +483,36 @@ public static AnswerSpan AnswerSpan(string text = null, double? confidenceScore return new AnswerSpan(text, confidenceScore, offset, length, serializedAdditionalRawData: null); } + /// Initializes a new instance of . + /// The API version used to call a target service. + /// The prediction score and it ranges from 0.0 to 1.0. + /// The actual response from a Conversation project. + /// A new instance for mocking. + public static NoneLinkedTargetIntentResult NoneLinkedTargetIntentResult(string apiVersion = null, double confidence = default, ConversationResult result = null) + { + return new NoneLinkedTargetIntentResult(TargetProjectKind.NonLinked, apiVersion, confidence, serializedAdditionalRawData: null, result); + } + + /// Initializes a new instance of . + /// The same query given in request. + /// The detected language from the query in BCP 47 language representation. + /// The predicted result for the query. + /// A new instance for mocking. + public static ConversationResult ConversationResult(string query = null, string detectedLanguage = null, ConversationPrediction prediction = null) + { + return new ConversationResult(query, detectedLanguage, prediction, serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// The API version used to call a target service. + /// The prediction score and it ranges from 0.0 to 1.0. + /// The actual response from a Conversation project. + /// A new instance for mocking. + public static ConversationTargetIntentResult ConversationTargetIntentResult(string apiVersion = null, double confidence = default, ConversationResult result = null) + { + return new ConversationTargetIntentResult(TargetProjectKind.Conversation, apiVersion, confidence, serializedAdditionalRawData: null, result); + } + /// Initializes a new instance of . /// One of a server-defined set of error codes. /// A human-readable representation of the error. @@ -618,35 +618,89 @@ public static AnalyzeConversationOperationResult AnalyzeConversationOperationRes return new UnknownAnalyzeConversationOperationResult(lastUpdateDateTime, status, name, kind == null ? default : new AnalyzeConversationOperationResultsKind(kind), serializedAdditionalRawData: null); } - /// Initializes a new instance of . + /// Initializes a new instance of . /// The last updated time in UTC for the task. /// The status of the task at the mentioned last update time. /// task name. /// results. - /// A new instance for mocking. - public static ConversationPiiOperationResult ConversationPiiOperationResult(DateTimeOffset lastUpdateDateTime = default, ConversationActionState status = default, string name = null, ConversationPiiResults results = null) + /// A new instance for mocking. + public static SummarizationOperationResult SummarizationOperationResult(DateTimeOffset lastUpdateDateTime = default, ConversationActionState status = default, string name = null, SummaryResult results = null) { - return new ConversationPiiOperationResult( + return new SummarizationOperationResult( lastUpdateDateTime, status, name, - AnalyzeConversationOperationResultsKind.PiiOperationResults, + AnalyzeConversationOperationResultsKind.SummarizationOperationResults, serializedAdditionalRawData: null, results); } - /// Initializes a new instance of . + /// Initializes a new instance of . + /// array of conversations. /// Errors by document id. /// statistics. /// This field indicates which model is used for scoring. - /// array of conversations. - /// A new instance for mocking. - public static ConversationPiiResults ConversationPiiResults(IEnumerable errors = null, RequestStatistics statistics = null, string modelVersion = null, IEnumerable conversations = null) + /// A new instance for mocking. + public static SummaryResult SummaryResult(IEnumerable conversations = null, IEnumerable errors = null, RequestStatistics statistics = null, string modelVersion = null) { + conversations ??= new List(); errors ??= new List(); - conversations ??= new List(); - return new ConversationPiiResults(errors?.ToList(), statistics, modelVersion, conversations?.ToList(), serializedAdditionalRawData: null); + return new SummaryResult(conversations?.ToList(), errors?.ToList(), statistics, modelVersion, serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// Unique, non-empty conversation identifier. + /// Warnings encountered in processing the document. + /// If showStats=true was specified in the request this field will contain information about the conversation payload. + /// array of summaries. + /// A new instance for mocking. + public static ConversationsSummaryResult ConversationsSummaryResult(string id = null, IEnumerable warnings = null, ConversationStatistics statistics = null, IEnumerable summaries = null) + { + warnings ??= new List(); + summaries ??= new List(); + + return new ConversationsSummaryResult(id, warnings?.ToList(), statistics, summaries?.ToList(), serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// Warning code. + /// Warning message. + /// A JSON pointer reference indicating the target object. + /// A new instance for mocking. + public static InputWarning InputWarning(string code = null, string message = null, string targetRef = null) + { + return new InputWarning(code, message, targetRef, serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// Number of text units for the request. + /// A new instance for mocking. + public static ConversationStatistics ConversationStatistics(int transactionsCount = default) + { + return new ConversationStatistics(transactionsCount, serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// aspect. + /// text. + /// Context list of the summary. + /// A new instance for mocking. + public static SummaryResultItem SummaryResultItem(string aspect = null, string text = null, IEnumerable contexts = null) + { + contexts ??= new List(); + + return new SummaryResultItem(aspect, text, contexts?.ToList(), serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// Start position for the context. Use of different 'stringIndexType' values can affect the offset returned. + /// The length of the context. Use of different 'stringIndexType' values can affect the length returned. + /// Reference to the ID of ConversationItem. + /// A new instance for mocking. + public static ItemizedSummaryContext ItemizedSummaryContext(int offset = default, int length = default, string conversationItemId = null) + { + return new ItemizedSummaryContext(offset, length, conversationItemId, serializedAdditionalRawData: null); } /// Initializes a new instance of . @@ -669,6 +723,75 @@ public static RequestStatistics RequestStatistics(int documentsCount = default, return new RequestStatistics(documentsCount, validDocumentsCount, erroneousDocumentsCount, transactionsCount, serializedAdditionalRawData: null); } + /// Initializes a new instance of . + /// The last updated time in UTC for the task. + /// The status of the task at the mentioned last update time. + /// task name. + /// Custom Summary Result. + /// A new instance for mocking. + public static CustomSummarizationOperationResult CustomSummarizationOperationResult(DateTimeOffset lastUpdateDateTime = default, ConversationActionState status = default, string name = null, CustomSummaryResult results = null) + { + return new CustomSummarizationOperationResult( + lastUpdateDateTime, + status, + name, + AnalyzeConversationOperationResultsKind.CustomSummarizationOperationResults, + serializedAdditionalRawData: null, + results); + } + + /// Initializes a new instance of . + /// array of conversations. + /// Errors by document id. + /// if showStats=true was specified in the request this field will contain information about the request payload. + /// This field indicates the project name for the model. + /// This field indicates the deployment name for the model. + /// A new instance for mocking. + public static CustomSummaryResult CustomSummaryResult(IEnumerable conversations = null, IEnumerable errors = null, RequestStatistics statistics = null, string projectName = null, string deploymentName = null) + { + conversations ??= new List(); + errors ??= new List(); + + return new CustomSummaryResult( + conversations?.ToList(), + errors?.ToList(), + statistics, + projectName, + deploymentName, + serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// The last updated time in UTC for the task. + /// The status of the task at the mentioned last update time. + /// task name. + /// results. + /// A new instance for mocking. + public static ConversationPiiOperationResult ConversationPiiOperationResult(DateTimeOffset lastUpdateDateTime = default, ConversationActionState status = default, string name = null, ConversationPiiResults results = null) + { + return new ConversationPiiOperationResult( + lastUpdateDateTime, + status, + name, + AnalyzeConversationOperationResultsKind.PiiOperationResults, + serializedAdditionalRawData: null, + results); + } + + /// Initializes a new instance of . + /// Errors by document id. + /// statistics. + /// This field indicates which model is used for scoring. + /// array of conversations. + /// A new instance for mocking. + public static ConversationPiiResults ConversationPiiResults(IEnumerable errors = null, RequestStatistics statistics = null, string modelVersion = null, IEnumerable conversations = null) + { + errors ??= new List(); + conversations ??= new List(); + + return new ConversationPiiResults(errors?.ToList(), statistics, modelVersion, conversations?.ToList(), serializedAdditionalRawData: null); + } + /// Initializes a new instance of . /// Unique, non-empty conversation identifier. /// Warnings encountered in processing the document. @@ -683,24 +806,6 @@ public static ConversationalPiiResult ConversationalPiiResult(string id = null, return new ConversationalPiiResult(id, warnings?.ToList(), statistics, conversationItems?.ToList(), serializedAdditionalRawData: null); } - /// Initializes a new instance of . - /// Warning code. - /// Warning message. - /// A JSON pointer reference indicating the target object. - /// A new instance for mocking. - public static InputWarning InputWarning(string code = null, string message = null, string targetRef = null) - { - return new InputWarning(code, message, targetRef, serializedAdditionalRawData: null); - } - - /// Initializes a new instance of . - /// Number of text units for the request. - /// A new instance for mocking. - public static ConversationStatistics ConversationStatistics(int transactionsCount = default) - { - return new ConversationStatistics(transactionsCount, serializedAdditionalRawData: null); - } - /// Initializes a new instance of . /// Id of the result. /// Transcript content response that the service generates, with all necessary personally identifiable information redacted. @@ -768,111 +873,6 @@ public static NamedEntity NamedEntity(string text = null, string category = null serializedAdditionalRawData: null); } - /// Initializes a new instance of . - /// The last updated time in UTC for the task. - /// The status of the task at the mentioned last update time. - /// task name. - /// results. - /// A new instance for mocking. - public static SummarizationOperationResult SummarizationOperationResult(DateTimeOffset lastUpdateDateTime = default, ConversationActionState status = default, string name = null, SummaryResult results = null) - { - return new SummarizationOperationResult( - lastUpdateDateTime, - status, - name, - AnalyzeConversationOperationResultsKind.SummarizationOperationResults, - serializedAdditionalRawData: null, - results); - } - - /// Initializes a new instance of . - /// array of conversations. - /// Errors by document id. - /// statistics. - /// This field indicates which model is used for scoring. - /// A new instance for mocking. - public static SummaryResult SummaryResult(IEnumerable conversations = null, IEnumerable errors = null, RequestStatistics statistics = null, string modelVersion = null) - { - conversations ??= new List(); - errors ??= new List(); - - return new SummaryResult(conversations?.ToList(), errors?.ToList(), statistics, modelVersion, serializedAdditionalRawData: null); - } - - /// Initializes a new instance of . - /// Unique, non-empty conversation identifier. - /// Warnings encountered in processing the document. - /// If showStats=true was specified in the request this field will contain information about the conversation payload. - /// array of summaries. - /// A new instance for mocking. - public static ConversationsSummaryResult ConversationsSummaryResult(string id = null, IEnumerable warnings = null, ConversationStatistics statistics = null, IEnumerable summaries = null) - { - warnings ??= new List(); - summaries ??= new List(); - - return new ConversationsSummaryResult(id, warnings?.ToList(), statistics, summaries?.ToList(), serializedAdditionalRawData: null); - } - - /// Initializes a new instance of . - /// aspect. - /// text. - /// Context list of the summary. - /// A new instance for mocking. - public static SummaryResultItem SummaryResultItem(string aspect = null, string text = null, IEnumerable contexts = null) - { - contexts ??= new List(); - - return new SummaryResultItem(aspect, text, contexts?.ToList(), serializedAdditionalRawData: null); - } - - /// Initializes a new instance of . - /// Start position for the context. Use of different 'stringIndexType' values can affect the offset returned. - /// The length of the context. Use of different 'stringIndexType' values can affect the length returned. - /// Reference to the ID of ConversationItem. - /// A new instance for mocking. - public static ItemizedSummaryContext ItemizedSummaryContext(int offset = default, int length = default, string conversationItemId = null) - { - return new ItemizedSummaryContext(offset, length, conversationItemId, serializedAdditionalRawData: null); - } - - /// Initializes a new instance of . - /// The last updated time in UTC for the task. - /// The status of the task at the mentioned last update time. - /// task name. - /// Custom Summary Result. - /// A new instance for mocking. - public static CustomSummarizationOperationResult CustomSummarizationOperationResult(DateTimeOffset lastUpdateDateTime = default, ConversationActionState status = default, string name = null, CustomSummaryResult results = null) - { - return new CustomSummarizationOperationResult( - lastUpdateDateTime, - status, - name, - AnalyzeConversationOperationResultsKind.CustomSummarizationOperationResults, - serializedAdditionalRawData: null, - results); - } - - /// Initializes a new instance of . - /// array of conversations. - /// Errors by document id. - /// if showStats=true was specified in the request this field will contain information about the request payload. - /// This field indicates the project name for the model. - /// This field indicates the deployment name for the model. - /// A new instance for mocking. - public static CustomSummaryResult CustomSummaryResult(IEnumerable conversations = null, IEnumerable errors = null, RequestStatistics statistics = null, string projectName = null, string deploymentName = null) - { - conversations ??= new List(); - errors ??= new List(); - - return new CustomSummaryResult( - conversations?.ToList(), - errors?.ToList(), - statistics, - projectName, - deploymentName, - serializedAdditionalRawData: null); - } - /// Initializes a new instance of . /// Number of documents submitted in the request. /// Number of valid documents. This excludes empty, over-size limit or non-supported languages documents. diff --git a/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Docs/ConversationAnalysisClient.xml b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Docs/ConversationAnalysisClient.xml index 2143e58afdb5..ca3b90fddb87 100644 --- a/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Docs/ConversationAnalysisClient.xml +++ b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Docs/ConversationAnalysisClient.xml @@ -873,7 +873,10 @@ AnalyzeConversationOperationInput analyzeConversationOperationInput = new Analyz PiiCategories = {ConversationPiiCategories.All}, RedactAudioTiming = true, RedactionSource = TranscriptContentType.Lexical, - RedactionPolicy = new DoNotRedactPolicyType(), + RedactionPolicy = new CharacterMaskPolicyType + { + RedactionCharacter = RedactionCharacter.Minus, + }, }, Name = "Conversation PII", } @@ -934,9 +937,10 @@ AnalyzeConversationOperationInput analyzeConversationOperationInput = new Analyz ActionContent = new PiiActionContent { ModelVersion = "latest", + PiiCategories = {ConversationPiiCategories.All}, RedactAudioTiming = true, RedactionSource = TranscriptContentType.Lexical, - ExcludePiiCategories = {ConversationPiiCategoryExclusions.Person}, + RedactionPolicy = new EntityMaskTypePolicyType(), }, Name = "Conversation PII", } @@ -997,10 +1001,9 @@ AnalyzeConversationOperationInput analyzeConversationOperationInput = new Analyz ActionContent = new PiiActionContent { ModelVersion = "latest", - PiiCategories = {ConversationPiiCategories.All}, RedactAudioTiming = true, RedactionSource = TranscriptContentType.Lexical, - RedactionPolicy = new MaskWithEntityTypePolicyType(), + ExcludePiiCategories = {ConversationPiiCategoryExclusions.Person}, }, Name = "Conversation PII", } @@ -1064,10 +1067,7 @@ AnalyzeConversationOperationInput analyzeConversationOperationInput = new Analyz PiiCategories = {ConversationPiiCategories.All}, RedactAudioTiming = true, RedactionSource = TranscriptContentType.Lexical, - RedactionPolicy = new MaskWithRedactionCharacterPolicyType - { - RedactionCharacter = RedactionCharacter.Minus, - }, + RedactionPolicy = new NoMaskPolicyType(), }, Name = "Conversation PII", } @@ -1435,7 +1435,10 @@ AnalyzeConversationOperationInput analyzeConversationOperationInput = new Analyz PiiCategories = {ConversationPiiCategories.All}, RedactAudioTiming = true, RedactionSource = TranscriptContentType.Lexical, - RedactionPolicy = new DoNotRedactPolicyType(), + RedactionPolicy = new CharacterMaskPolicyType + { + RedactionCharacter = RedactionCharacter.Minus, + }, }, Name = "Conversation PII", } @@ -1496,9 +1499,10 @@ AnalyzeConversationOperationInput analyzeConversationOperationInput = new Analyz ActionContent = new PiiActionContent { ModelVersion = "latest", + PiiCategories = {ConversationPiiCategories.All}, RedactAudioTiming = true, RedactionSource = TranscriptContentType.Lexical, - ExcludePiiCategories = {ConversationPiiCategoryExclusions.Person}, + RedactionPolicy = new EntityMaskTypePolicyType(), }, Name = "Conversation PII", } @@ -1559,10 +1563,9 @@ AnalyzeConversationOperationInput analyzeConversationOperationInput = new Analyz ActionContent = new PiiActionContent { ModelVersion = "latest", - PiiCategories = {ConversationPiiCategories.All}, RedactAudioTiming = true, RedactionSource = TranscriptContentType.Lexical, - RedactionPolicy = new MaskWithEntityTypePolicyType(), + ExcludePiiCategories = {ConversationPiiCategoryExclusions.Person}, }, Name = "Conversation PII", } @@ -1626,10 +1629,7 @@ AnalyzeConversationOperationInput analyzeConversationOperationInput = new Analyz PiiCategories = {ConversationPiiCategories.All}, RedactAudioTiming = true, RedactionSource = TranscriptContentType.Lexical, - RedactionPolicy = new MaskWithRedactionCharacterPolicyType - { - RedactionCharacter = RedactionCharacter.Minus, - }, + RedactionPolicy = new NoMaskPolicyType(), }, Name = "Conversation PII", } @@ -2019,7 +2019,8 @@ using RequestContent content = RequestContent.Create(new }, redactionPolicy = new { - policyKind = "DoNotRedact", + policyKind = "characterMask", + redactionCharacter = "-", }, redactionSource = "lexical", redactAudioTiming = true, @@ -2099,9 +2100,13 @@ using RequestContent content = RequestContent.Create(new parameters = new { modelVersion = "latest", - excludePiiCategories = new object[] + piiCategories = new object[] { - "Person" + "All" + }, + redactionPolicy = new + { + policyKind = "entityMask", }, redactionSource = "lexical", redactAudioTiming = true, @@ -2181,13 +2186,9 @@ using RequestContent content = RequestContent.Create(new parameters = new { modelVersion = "latest", - piiCategories = new object[] - { - "All" - }, - redactionPolicy = new + excludePiiCategories = new object[] { - policyKind = "MaskWithEntityType", + "Person" }, redactionSource = "lexical", redactAudioTiming = true, @@ -2273,8 +2274,7 @@ using RequestContent content = RequestContent.Create(new }, redactionPolicy = new { - policyKind = "MaskWithRedactionCharacter", - redactionCharacter = "-", + policyKind = "noMask", }, redactionSource = "lexical", redactAudioTiming = true, @@ -2765,7 +2765,8 @@ using RequestContent content = RequestContent.Create(new }, redactionPolicy = new { - policyKind = "DoNotRedact", + policyKind = "characterMask", + redactionCharacter = "-", }, redactionSource = "lexical", redactAudioTiming = true, @@ -2845,9 +2846,13 @@ using RequestContent content = RequestContent.Create(new parameters = new { modelVersion = "latest", - excludePiiCategories = new object[] + piiCategories = new object[] { - "Person" + "All" + }, + redactionPolicy = new + { + policyKind = "entityMask", }, redactionSource = "lexical", redactAudioTiming = true, @@ -2927,13 +2932,9 @@ using RequestContent content = RequestContent.Create(new parameters = new { modelVersion = "latest", - piiCategories = new object[] - { - "All" - }, - redactionPolicy = new + excludePiiCategories = new object[] { - policyKind = "MaskWithEntityType", + "Person" }, redactionSource = "lexical", redactAudioTiming = true, @@ -3019,8 +3020,7 @@ using RequestContent content = RequestContent.Create(new }, redactionPolicy = new { - policyKind = "MaskWithRedactionCharacter", - redactionCharacter = "-", + policyKind = "noMask", }, redactionSource = "lexical", redactAudioTiming = true, diff --git a/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/BaseRedactionPolicy.Serialization.cs b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/BaseRedactionPolicy.Serialization.cs index 486879f9da8c..a288f89dcb70 100644 --- a/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/BaseRedactionPolicy.Serialization.cs +++ b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/BaseRedactionPolicy.Serialization.cs @@ -77,9 +77,9 @@ internal static BaseRedactionPolicy DeserializeBaseRedactionPolicy(JsonElement e { switch (discriminator.GetString()) { - case "DoNotRedact": return DoNotRedactPolicyType.DeserializeDoNotRedactPolicyType(element, options); - case "MaskWithEntityType": return MaskWithEntityTypePolicyType.DeserializeMaskWithEntityTypePolicyType(element, options); - case "MaskWithRedactionCharacter": return MaskWithRedactionCharacterPolicyType.DeserializeMaskWithRedactionCharacterPolicyType(element, options); + case "characterMask": return CharacterMaskPolicyType.DeserializeCharacterMaskPolicyType(element, options); + case "entityMask": return EntityMaskTypePolicyType.DeserializeEntityMaskTypePolicyType(element, options); + case "noMask": return NoMaskPolicyType.DeserializeNoMaskPolicyType(element, options); } } return UnknownBaseRedactionPolicy.DeserializeUnknownBaseRedactionPolicy(element, options); diff --git a/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/BaseRedactionPolicy.cs b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/BaseRedactionPolicy.cs index cdb2c5d1ee29..2396509fe391 100644 --- a/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/BaseRedactionPolicy.cs +++ b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/BaseRedactionPolicy.cs @@ -13,7 +13,7 @@ namespace Azure.AI.Language.Conversations.Models /// /// The abstract base class for RedactionPolicy. /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. - /// The available derived classes include , and . + /// The available derived classes include , and . /// public abstract partial class BaseRedactionPolicy { diff --git a/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/MaskWithRedactionCharacterPolicyType.Serialization.cs b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/CharacterMaskPolicyType.Serialization.cs similarity index 62% rename from sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/MaskWithRedactionCharacterPolicyType.Serialization.cs rename to sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/CharacterMaskPolicyType.Serialization.cs index d4125c5601f2..33b75230a156 100644 --- a/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/MaskWithRedactionCharacterPolicyType.Serialization.cs +++ b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/CharacterMaskPolicyType.Serialization.cs @@ -13,11 +13,11 @@ namespace Azure.AI.Language.Conversations.Models { - public partial class MaskWithRedactionCharacterPolicyType : IUtf8JsonSerializable, IJsonModel + public partial class CharacterMaskPolicyType : IUtf8JsonSerializable, IJsonModel { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); - void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) { writer.WriteStartObject(); JsonModelWriteCore(writer, options); @@ -28,10 +28,10 @@ void IJsonModel.Write(Utf8JsonWriter write /// The client options for reading and writing models. protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") { - throw new FormatException($"The model {nameof(MaskWithRedactionCharacterPolicyType)} does not support writing '{format}' format."); + throw new FormatException($"The model {nameof(CharacterMaskPolicyType)} does not support writing '{format}' format."); } base.JsonModelWriteCore(writer, options); @@ -42,19 +42,19 @@ protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWri } } - MaskWithRedactionCharacterPolicyType IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + CharacterMaskPolicyType IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") { - throw new FormatException($"The model {nameof(MaskWithRedactionCharacterPolicyType)} does not support reading '{format}' format."); + throw new FormatException($"The model {nameof(CharacterMaskPolicyType)} does not support reading '{format}' format."); } using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeMaskWithRedactionCharacterPolicyType(document.RootElement, options); + return DeserializeCharacterMaskPolicyType(document.RootElement, options); } - internal static MaskWithRedactionCharacterPolicyType DeserializeMaskWithRedactionCharacterPolicyType(JsonElement element, ModelReaderWriterOptions options = null) + internal static CharacterMaskPolicyType DeserializeCharacterMaskPolicyType(JsonElement element, ModelReaderWriterOptions options = null) { options ??= ModelSerializationExtensions.WireOptions; @@ -88,46 +88,46 @@ internal static MaskWithRedactionCharacterPolicyType DeserializeMaskWithRedactio } } serializedAdditionalRawData = rawDataDictionary; - return new MaskWithRedactionCharacterPolicyType(policyKind, serializedAdditionalRawData, redactionCharacter); + return new CharacterMaskPolicyType(policyKind, serializedAdditionalRawData, redactionCharacter); } - BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; switch (format) { case "J": return ModelReaderWriter.Write(this, options); default: - throw new FormatException($"The model {nameof(MaskWithRedactionCharacterPolicyType)} does not support writing '{options.Format}' format."); + throw new FormatException($"The model {nameof(CharacterMaskPolicyType)} does not support writing '{options.Format}' format."); } } - MaskWithRedactionCharacterPolicyType IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + CharacterMaskPolicyType IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; switch (format) { case "J": { using JsonDocument document = JsonDocument.Parse(data); - return DeserializeMaskWithRedactionCharacterPolicyType(document.RootElement, options); + return DeserializeCharacterMaskPolicyType(document.RootElement, options); } default: - throw new FormatException($"The model {nameof(MaskWithRedactionCharacterPolicyType)} does not support reading '{options.Format}' format."); + throw new FormatException($"The model {nameof(CharacterMaskPolicyType)} does not support reading '{options.Format}' format."); } } - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; /// Deserializes the model from a raw response. /// The response to deserialize the model from. - internal static new MaskWithRedactionCharacterPolicyType FromResponse(Response response) + internal static new CharacterMaskPolicyType FromResponse(Response response) { using var document = JsonDocument.Parse(response.Content); - return DeserializeMaskWithRedactionCharacterPolicyType(document.RootElement); + return DeserializeCharacterMaskPolicyType(document.RootElement); } /// Convert into a . diff --git a/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/MaskWithRedactionCharacterPolicyType.cs b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/CharacterMaskPolicyType.cs similarity index 58% rename from sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/MaskWithRedactionCharacterPolicyType.cs rename to sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/CharacterMaskPolicyType.cs index 2ffe65cff585..141dee29a3d2 100644 --- a/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/MaskWithRedactionCharacterPolicyType.cs +++ b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/CharacterMaskPolicyType.cs @@ -10,20 +10,20 @@ namespace Azure.AI.Language.Conversations.Models { - /// Represents the policy of redacting with a redaction character. - public partial class MaskWithRedactionCharacterPolicyType : BaseRedactionPolicy + /// Represents the policy of masking with a redaction character. + public partial class CharacterMaskPolicyType : BaseRedactionPolicy { - /// Initializes a new instance of . - public MaskWithRedactionCharacterPolicyType() + /// Initializes a new instance of . + public CharacterMaskPolicyType() { - PolicyKind = RedactionPolicyKind.MaskWithRedactionCharacter; + PolicyKind = RedactionPolicyKind.CharacterMask; } - /// Initializes a new instance of . + /// Initializes a new instance of . /// The entity RedactionPolicy object kind. /// Keeps track of any properties unknown to the library. /// Optional parameter to use a Custom Character to be used for redaction in PII responses. Default character will be * as before. We allow specific ascii characters for redaction. - internal MaskWithRedactionCharacterPolicyType(RedactionPolicyKind policyKind, IDictionary serializedAdditionalRawData, RedactionCharacter? redactionCharacter) : base(policyKind, serializedAdditionalRawData) + internal CharacterMaskPolicyType(RedactionPolicyKind policyKind, IDictionary serializedAdditionalRawData, RedactionCharacter? redactionCharacter) : base(policyKind, serializedAdditionalRawData) { RedactionCharacter = redactionCharacter; } diff --git a/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/ConversationSummarizationActionContent.Serialization.cs b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/ConversationSummarizationActionContent.Serialization.cs index 3f164373f622..5fe1c4007498 100644 --- a/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/ConversationSummarizationActionContent.Serialization.cs +++ b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/ConversationSummarizationActionContent.Serialization.cs @@ -66,6 +66,11 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit writer.WriteStringValue(item.ToString()); } writer.WriteEndArray(); + if (Optional.IsDefined(Instruction)) + { + writer.WritePropertyName("instruction"u8); + writer.WriteStringValue(Instruction); + } if (options.Format != "W" && _serializedAdditionalRawData != null) { foreach (var item in _serializedAdditionalRawData) @@ -109,6 +114,7 @@ internal static ConversationSummarizationActionContent DeserializeConversationSu StringIndexType? stringIndexType = default; SummaryLengthBucket? summaryLength = default; IList summaryAspects = default; + string instruction = default; IDictionary serializedAdditionalRawData = default; Dictionary rawDataDictionary = new Dictionary(); foreach (var property in element.EnumerateObject()) @@ -164,6 +170,11 @@ internal static ConversationSummarizationActionContent DeserializeConversationSu summaryAspects = array; continue; } + if (property.NameEquals("instruction"u8)) + { + instruction = property.Value.GetString(); + continue; + } if (options.Format != "W") { rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); @@ -177,6 +188,7 @@ internal static ConversationSummarizationActionContent DeserializeConversationSu stringIndexType, summaryLength, summaryAspects, + instruction, serializedAdditionalRawData); } diff --git a/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/ConversationSummarizationActionContent.cs b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/ConversationSummarizationActionContent.cs index 30e6964d7584..178dadaf413f 100644 --- a/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/ConversationSummarizationActionContent.cs +++ b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/ConversationSummarizationActionContent.cs @@ -63,8 +63,9 @@ public ConversationSummarizationActionContent(IEnumerable summary /// String index type. /// (NOTE: Recommended to use summaryLength over sentenceCount) Controls the approximate length of the output summaries. /// Array of Summary Aspects. + /// a text field to allow customers to use natural language to describe their needs for summarization. /// Keeps track of any properties unknown to the library. - internal ConversationSummarizationActionContent(bool? loggingOptOut, string modelVersion, int? sentenceCount, StringIndexType? stringIndexType, SummaryLengthBucket? summaryLength, IList summaryAspects, IDictionary serializedAdditionalRawData) + internal ConversationSummarizationActionContent(bool? loggingOptOut, string modelVersion, int? sentenceCount, StringIndexType? stringIndexType, SummaryLengthBucket? summaryLength, IList summaryAspects, string instruction, IDictionary serializedAdditionalRawData) { LoggingOptOut = loggingOptOut; ModelVersion = modelVersion; @@ -72,6 +73,7 @@ internal ConversationSummarizationActionContent(bool? loggingOptOut, string mode StringIndexType = stringIndexType; SummaryLength = summaryLength; SummaryAspects = summaryAspects; + Instruction = instruction; _serializedAdditionalRawData = serializedAdditionalRawData; } @@ -92,5 +94,7 @@ internal ConversationSummarizationActionContent() public SummaryLengthBucket? SummaryLength { get; set; } /// Array of Summary Aspects. public IList SummaryAspects { get; } + /// a text field to allow customers to use natural language to describe their needs for summarization. + public string Instruction { get; set; } } } diff --git a/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/DoNotRedactPolicyType.cs b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/DoNotRedactPolicyType.cs deleted file mode 100644 index 99b7497c83c7..000000000000 --- a/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/DoNotRedactPolicyType.cs +++ /dev/null @@ -1,29 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Collections.Generic; - -namespace Azure.AI.Language.Conversations.Models -{ - /// Represents the policy of not redacting found PII. - public partial class DoNotRedactPolicyType : BaseRedactionPolicy - { - /// Initializes a new instance of . - public DoNotRedactPolicyType() - { - PolicyKind = RedactionPolicyKind.DoNotRedact; - } - - /// Initializes a new instance of . - /// The entity RedactionPolicy object kind. - /// Keeps track of any properties unknown to the library. - internal DoNotRedactPolicyType(RedactionPolicyKind policyKind, IDictionary serializedAdditionalRawData) : base(policyKind, serializedAdditionalRawData) - { - } - } -} diff --git a/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/MaskWithEntityTypePolicyType.Serialization.cs b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/EntityMaskTypePolicyType.Serialization.cs similarity index 60% rename from sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/MaskWithEntityTypePolicyType.Serialization.cs rename to sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/EntityMaskTypePolicyType.Serialization.cs index aac1644aacbe..05ac369ffc42 100644 --- a/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/MaskWithEntityTypePolicyType.Serialization.cs +++ b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/EntityMaskTypePolicyType.Serialization.cs @@ -13,11 +13,11 @@ namespace Azure.AI.Language.Conversations.Models { - public partial class MaskWithEntityTypePolicyType : IUtf8JsonSerializable, IJsonModel + public partial class EntityMaskTypePolicyType : IUtf8JsonSerializable, IJsonModel { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); - void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) { writer.WriteStartObject(); JsonModelWriteCore(writer, options); @@ -28,28 +28,28 @@ void IJsonModel.Write(Utf8JsonWriter writer, Model /// The client options for reading and writing models. protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") { - throw new FormatException($"The model {nameof(MaskWithEntityTypePolicyType)} does not support writing '{format}' format."); + throw new FormatException($"The model {nameof(EntityMaskTypePolicyType)} does not support writing '{format}' format."); } base.JsonModelWriteCore(writer, options); } - MaskWithEntityTypePolicyType IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + EntityMaskTypePolicyType IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") { - throw new FormatException($"The model {nameof(MaskWithEntityTypePolicyType)} does not support reading '{format}' format."); + throw new FormatException($"The model {nameof(EntityMaskTypePolicyType)} does not support reading '{format}' format."); } using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeMaskWithEntityTypePolicyType(document.RootElement, options); + return DeserializeEntityMaskTypePolicyType(document.RootElement, options); } - internal static MaskWithEntityTypePolicyType DeserializeMaskWithEntityTypePolicyType(JsonElement element, ModelReaderWriterOptions options = null) + internal static EntityMaskTypePolicyType DeserializeEntityMaskTypePolicyType(JsonElement element, ModelReaderWriterOptions options = null) { options ??= ModelSerializationExtensions.WireOptions; @@ -73,46 +73,46 @@ internal static MaskWithEntityTypePolicyType DeserializeMaskWithEntityTypePolicy } } serializedAdditionalRawData = rawDataDictionary; - return new MaskWithEntityTypePolicyType(policyKind, serializedAdditionalRawData); + return new EntityMaskTypePolicyType(policyKind, serializedAdditionalRawData); } - BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; switch (format) { case "J": return ModelReaderWriter.Write(this, options); default: - throw new FormatException($"The model {nameof(MaskWithEntityTypePolicyType)} does not support writing '{options.Format}' format."); + throw new FormatException($"The model {nameof(EntityMaskTypePolicyType)} does not support writing '{options.Format}' format."); } } - MaskWithEntityTypePolicyType IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + EntityMaskTypePolicyType IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; switch (format) { case "J": { using JsonDocument document = JsonDocument.Parse(data); - return DeserializeMaskWithEntityTypePolicyType(document.RootElement, options); + return DeserializeEntityMaskTypePolicyType(document.RootElement, options); } default: - throw new FormatException($"The model {nameof(MaskWithEntityTypePolicyType)} does not support reading '{options.Format}' format."); + throw new FormatException($"The model {nameof(EntityMaskTypePolicyType)} does not support reading '{options.Format}' format."); } } - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; /// Deserializes the model from a raw response. /// The response to deserialize the model from. - internal static new MaskWithEntityTypePolicyType FromResponse(Response response) + internal static new EntityMaskTypePolicyType FromResponse(Response response) { using var document = JsonDocument.Parse(response.Content); - return DeserializeMaskWithEntityTypePolicyType(document.RootElement); + return DeserializeEntityMaskTypePolicyType(document.RootElement); } /// Convert into a . diff --git a/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/EntityMaskTypePolicyType.cs b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/EntityMaskTypePolicyType.cs new file mode 100644 index 000000000000..2345cff7d3f5 --- /dev/null +++ b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/EntityMaskTypePolicyType.cs @@ -0,0 +1,29 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.AI.Language.Conversations.Models +{ + /// Represents the policy of masking PII with the entity type. + public partial class EntityMaskTypePolicyType : BaseRedactionPolicy + { + /// Initializes a new instance of . + public EntityMaskTypePolicyType() + { + PolicyKind = RedactionPolicyKind.EntityMask; + } + + /// Initializes a new instance of . + /// The entity RedactionPolicy object kind. + /// Keeps track of any properties unknown to the library. + internal EntityMaskTypePolicyType(RedactionPolicyKind policyKind, IDictionary serializedAdditionalRawData) : base(policyKind, serializedAdditionalRawData) + { + } + } +} diff --git a/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/MaskWithEntityTypePolicyType.cs b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/MaskWithEntityTypePolicyType.cs deleted file mode 100644 index e5f7efad55fc..000000000000 --- a/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/MaskWithEntityTypePolicyType.cs +++ /dev/null @@ -1,29 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Collections.Generic; - -namespace Azure.AI.Language.Conversations.Models -{ - /// Represents the policy of redacting PII with the entity type. - public partial class MaskWithEntityTypePolicyType : BaseRedactionPolicy - { - /// Initializes a new instance of . - public MaskWithEntityTypePolicyType() - { - PolicyKind = RedactionPolicyKind.MaskWithEntityType; - } - - /// Initializes a new instance of . - /// The entity RedactionPolicy object kind. - /// Keeps track of any properties unknown to the library. - internal MaskWithEntityTypePolicyType(RedactionPolicyKind policyKind, IDictionary serializedAdditionalRawData) : base(policyKind, serializedAdditionalRawData) - { - } - } -} diff --git a/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/DoNotRedactPolicyType.Serialization.cs b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/NoMaskPolicyType.Serialization.cs similarity index 62% rename from sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/DoNotRedactPolicyType.Serialization.cs rename to sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/NoMaskPolicyType.Serialization.cs index c54c187fd7f4..dfad59816695 100644 --- a/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/DoNotRedactPolicyType.Serialization.cs +++ b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/NoMaskPolicyType.Serialization.cs @@ -13,11 +13,11 @@ namespace Azure.AI.Language.Conversations.Models { - public partial class DoNotRedactPolicyType : IUtf8JsonSerializable, IJsonModel + public partial class NoMaskPolicyType : IUtf8JsonSerializable, IJsonModel { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); - void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) { writer.WriteStartObject(); JsonModelWriteCore(writer, options); @@ -28,28 +28,28 @@ void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderW /// The client options for reading and writing models. protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") { - throw new FormatException($"The model {nameof(DoNotRedactPolicyType)} does not support writing '{format}' format."); + throw new FormatException($"The model {nameof(NoMaskPolicyType)} does not support writing '{format}' format."); } base.JsonModelWriteCore(writer, options); } - DoNotRedactPolicyType IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + NoMaskPolicyType IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") { - throw new FormatException($"The model {nameof(DoNotRedactPolicyType)} does not support reading '{format}' format."); + throw new FormatException($"The model {nameof(NoMaskPolicyType)} does not support reading '{format}' format."); } using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeDoNotRedactPolicyType(document.RootElement, options); + return DeserializeNoMaskPolicyType(document.RootElement, options); } - internal static DoNotRedactPolicyType DeserializeDoNotRedactPolicyType(JsonElement element, ModelReaderWriterOptions options = null) + internal static NoMaskPolicyType DeserializeNoMaskPolicyType(JsonElement element, ModelReaderWriterOptions options = null) { options ??= ModelSerializationExtensions.WireOptions; @@ -73,46 +73,46 @@ internal static DoNotRedactPolicyType DeserializeDoNotRedactPolicyType(JsonEleme } } serializedAdditionalRawData = rawDataDictionary; - return new DoNotRedactPolicyType(policyKind, serializedAdditionalRawData); + return new NoMaskPolicyType(policyKind, serializedAdditionalRawData); } - BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; switch (format) { case "J": return ModelReaderWriter.Write(this, options); default: - throw new FormatException($"The model {nameof(DoNotRedactPolicyType)} does not support writing '{options.Format}' format."); + throw new FormatException($"The model {nameof(NoMaskPolicyType)} does not support writing '{options.Format}' format."); } } - DoNotRedactPolicyType IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + NoMaskPolicyType IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; switch (format) { case "J": { using JsonDocument document = JsonDocument.Parse(data); - return DeserializeDoNotRedactPolicyType(document.RootElement, options); + return DeserializeNoMaskPolicyType(document.RootElement, options); } default: - throw new FormatException($"The model {nameof(DoNotRedactPolicyType)} does not support reading '{options.Format}' format."); + throw new FormatException($"The model {nameof(NoMaskPolicyType)} does not support reading '{options.Format}' format."); } } - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; /// Deserializes the model from a raw response. /// The response to deserialize the model from. - internal static new DoNotRedactPolicyType FromResponse(Response response) + internal static new NoMaskPolicyType FromResponse(Response response) { using var document = JsonDocument.Parse(response.Content); - return DeserializeDoNotRedactPolicyType(document.RootElement); + return DeserializeNoMaskPolicyType(document.RootElement); } /// Convert into a . diff --git a/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/NoMaskPolicyType.cs b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/NoMaskPolicyType.cs new file mode 100644 index 000000000000..2ccc30399781 --- /dev/null +++ b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/NoMaskPolicyType.cs @@ -0,0 +1,29 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.AI.Language.Conversations.Models +{ + /// Represents the policy of not masking found PII. + public partial class NoMaskPolicyType : BaseRedactionPolicy + { + /// Initializes a new instance of . + public NoMaskPolicyType() + { + PolicyKind = RedactionPolicyKind.NoMask; + } + + /// Initializes a new instance of . + /// The entity RedactionPolicy object kind. + /// Keeps track of any properties unknown to the library. + internal NoMaskPolicyType(RedactionPolicyKind policyKind, IDictionary serializedAdditionalRawData) : base(policyKind, serializedAdditionalRawData) + { + } + } +} diff --git a/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/PiiActionContent.cs b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/PiiActionContent.cs index 0bd98f978abe..9444720549af 100644 --- a/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/PiiActionContent.cs +++ b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/PiiActionContent.cs @@ -63,7 +63,7 @@ public PiiActionContent() /// /// Optional parameter determine what type of redaction to use. /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. - /// The available derived classes include , and . + /// The available derived classes include , and . /// /// Keeps track of any properties unknown to the library. internal PiiActionContent(bool? loggingOptOut, string modelVersion, IList piiCategories, bool? redactAudioTiming, TranscriptContentType? redactionSource, RedactionCharacter? redactionCharacter, IList excludePiiCategories, BaseRedactionPolicy redactionPolicy, IDictionary serializedAdditionalRawData) @@ -96,7 +96,7 @@ internal PiiActionContent(bool? loggingOptOut, string modelVersion, IList /// Optional parameter determine what type of redaction to use. /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. - /// The available derived classes include , and . + /// The available derived classes include , and . /// public BaseRedactionPolicy RedactionPolicy { get; set; } } diff --git a/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/RedactionPolicyKind.cs b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/RedactionPolicyKind.cs index 3b624e95f4bb..18f75a5d2d9a 100644 --- a/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/RedactionPolicyKind.cs +++ b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/RedactionPolicyKind.cs @@ -22,16 +22,16 @@ public RedactionPolicyKind(string value) _value = value ?? throw new ArgumentNullException(nameof(value)); } - private const string DoNotRedactValue = "DoNotRedact"; - private const string MaskWithRedactionCharacterValue = "MaskWithRedactionCharacter"; - private const string MaskWithEntityTypeValue = "MaskWithEntityType"; - - /// Do not redact detected entities. - public static RedactionPolicyKind DoNotRedact { get; } = new RedactionPolicyKind(DoNotRedactValue); - /// Redact detected entities with redaction character. - public static RedactionPolicyKind MaskWithRedactionCharacter { get; } = new RedactionPolicyKind(MaskWithRedactionCharacterValue); - /// Redact detected entities with entity type. - public static RedactionPolicyKind MaskWithEntityType { get; } = new RedactionPolicyKind(MaskWithEntityTypeValue); + private const string NoMaskValue = "noMask"; + private const string CharacterMaskValue = "characterMask"; + private const string EntityMaskValue = "entityMask"; + + /// Do not mask detected entities. + public static RedactionPolicyKind NoMask { get; } = new RedactionPolicyKind(NoMaskValue); + /// Mask detected entities with redaction character. + public static RedactionPolicyKind CharacterMask { get; } = new RedactionPolicyKind(CharacterMaskValue); + /// Mask detected entities with entity type. + public static RedactionPolicyKind EntityMask { get; } = new RedactionPolicyKind(EntityMaskValue); /// Determines if two values are the same. public static bool operator ==(RedactionPolicyKind left, RedactionPolicyKind right) => left.Equals(right); /// Determines if two values are not the same. diff --git a/sdk/cognitivelanguage/Azure.AI.Language.Conversations/tests/Generated/Samples/Samples_ConversationAnalysisClient.cs b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/tests/Generated/Samples/Samples_ConversationAnalysisClient.cs index cf945509eaf1..17837d3eda76 100644 --- a/sdk/cognitivelanguage/Azure.AI.Language.Conversations/tests/Generated/Samples/Samples_ConversationAnalysisClient.cs +++ b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/tests/Generated/Samples/Samples_ConversationAnalysisClient.cs @@ -379,7 +379,7 @@ public async Task Example_Conversations_AnalyzeConversation_SuccessfulAnalyzeCon [Test] [Ignore("Only validating compilation of examples")] - public void Example_AnalyzeConversationJobState_GetAnalyzeConversationJobStatus_SuccessfulConversationPIIDoNotRedactTaskStatusRequest() + public void Example_AnalyzeConversationJobState_GetAnalyzeConversationJobStatus_SuccessfulConversationPIICharacterMaskTaskStatusRequest() { Uri endpoint = new Uri(""); AzureKeyCredential credential = new AzureKeyCredential(""); @@ -400,7 +400,7 @@ public void Example_AnalyzeConversationJobState_GetAnalyzeConversationJobStatus_ [Test] [Ignore("Only validating compilation of examples")] - public async Task Example_AnalyzeConversationJobState_GetAnalyzeConversationJobStatus_SuccessfulConversationPIIDoNotRedactTaskStatusRequest_Async() + public async Task Example_AnalyzeConversationJobState_GetAnalyzeConversationJobStatus_SuccessfulConversationPIICharacterMaskTaskStatusRequest_Async() { Uri endpoint = new Uri(""); AzureKeyCredential credential = new AzureKeyCredential(""); @@ -421,7 +421,7 @@ public async Task Example_AnalyzeConversationJobState_GetAnalyzeConversationJobS [Test] [Ignore("Only validating compilation of examples")] - public void Example_AnalyzeConversationJobState_GetAnalyzeConversationJobStatus_SuccessfulConversationPIIDoNotRedactTaskStatusRequest_Convenience() + public void Example_AnalyzeConversationJobState_GetAnalyzeConversationJobStatus_SuccessfulConversationPIICharacterMaskTaskStatusRequest_Convenience() { Uri endpoint = new Uri(""); AzureKeyCredential credential = new AzureKeyCredential(""); @@ -432,7 +432,7 @@ public void Example_AnalyzeConversationJobState_GetAnalyzeConversationJobStatus_ [Test] [Ignore("Only validating compilation of examples")] - public async Task Example_AnalyzeConversationJobState_GetAnalyzeConversationJobStatus_SuccessfulConversationPIIDoNotRedactTaskStatusRequest_Convenience_Async() + public async Task Example_AnalyzeConversationJobState_GetAnalyzeConversationJobStatus_SuccessfulConversationPIICharacterMaskTaskStatusRequest_Convenience_Async() { Uri endpoint = new Uri(""); AzureKeyCredential credential = new AzureKeyCredential(""); @@ -443,7 +443,7 @@ public async Task Example_AnalyzeConversationJobState_GetAnalyzeConversationJobS [Test] [Ignore("Only validating compilation of examples")] - public void Example_AnalyzeConversationJobState_GetAnalyzeConversationJobStatus_SuccessfulConversationPIIExclusionTaskStatusRequest() + public void Example_AnalyzeConversationJobState_GetAnalyzeConversationJobStatus_SuccessfulConversationPIIEntityMaskTaskStatusRequest() { Uri endpoint = new Uri(""); AzureKeyCredential credential = new AzureKeyCredential(""); @@ -464,7 +464,7 @@ public void Example_AnalyzeConversationJobState_GetAnalyzeConversationJobStatus_ [Test] [Ignore("Only validating compilation of examples")] - public async Task Example_AnalyzeConversationJobState_GetAnalyzeConversationJobStatus_SuccessfulConversationPIIExclusionTaskStatusRequest_Async() + public async Task Example_AnalyzeConversationJobState_GetAnalyzeConversationJobStatus_SuccessfulConversationPIIEntityMaskTaskStatusRequest_Async() { Uri endpoint = new Uri(""); AzureKeyCredential credential = new AzureKeyCredential(""); @@ -485,7 +485,7 @@ public async Task Example_AnalyzeConversationJobState_GetAnalyzeConversationJobS [Test] [Ignore("Only validating compilation of examples")] - public void Example_AnalyzeConversationJobState_GetAnalyzeConversationJobStatus_SuccessfulConversationPIIExclusionTaskStatusRequest_Convenience() + public void Example_AnalyzeConversationJobState_GetAnalyzeConversationJobStatus_SuccessfulConversationPIIEntityMaskTaskStatusRequest_Convenience() { Uri endpoint = new Uri(""); AzureKeyCredential credential = new AzureKeyCredential(""); @@ -496,7 +496,7 @@ public void Example_AnalyzeConversationJobState_GetAnalyzeConversationJobStatus_ [Test] [Ignore("Only validating compilation of examples")] - public async Task Example_AnalyzeConversationJobState_GetAnalyzeConversationJobStatus_SuccessfulConversationPIIExclusionTaskStatusRequest_Convenience_Async() + public async Task Example_AnalyzeConversationJobState_GetAnalyzeConversationJobStatus_SuccessfulConversationPIIEntityMaskTaskStatusRequest_Convenience_Async() { Uri endpoint = new Uri(""); AzureKeyCredential credential = new AzureKeyCredential(""); @@ -507,7 +507,7 @@ public async Task Example_AnalyzeConversationJobState_GetAnalyzeConversationJobS [Test] [Ignore("Only validating compilation of examples")] - public void Example_AnalyzeConversationJobState_GetAnalyzeConversationJobStatus_SuccessfulConversationPIIMaskWithEntityTypeTaskStatusRequest() + public void Example_AnalyzeConversationJobState_GetAnalyzeConversationJobStatus_SuccessfulConversationPIIExclusionTaskStatusRequest() { Uri endpoint = new Uri(""); AzureKeyCredential credential = new AzureKeyCredential(""); @@ -528,7 +528,7 @@ public void Example_AnalyzeConversationJobState_GetAnalyzeConversationJobStatus_ [Test] [Ignore("Only validating compilation of examples")] - public async Task Example_AnalyzeConversationJobState_GetAnalyzeConversationJobStatus_SuccessfulConversationPIIMaskWithEntityTypeTaskStatusRequest_Async() + public async Task Example_AnalyzeConversationJobState_GetAnalyzeConversationJobStatus_SuccessfulConversationPIIExclusionTaskStatusRequest_Async() { Uri endpoint = new Uri(""); AzureKeyCredential credential = new AzureKeyCredential(""); @@ -549,7 +549,7 @@ public async Task Example_AnalyzeConversationJobState_GetAnalyzeConversationJobS [Test] [Ignore("Only validating compilation of examples")] - public void Example_AnalyzeConversationJobState_GetAnalyzeConversationJobStatus_SuccessfulConversationPIIMaskWithEntityTypeTaskStatusRequest_Convenience() + public void Example_AnalyzeConversationJobState_GetAnalyzeConversationJobStatus_SuccessfulConversationPIIExclusionTaskStatusRequest_Convenience() { Uri endpoint = new Uri(""); AzureKeyCredential credential = new AzureKeyCredential(""); @@ -560,7 +560,7 @@ public void Example_AnalyzeConversationJobState_GetAnalyzeConversationJobStatus_ [Test] [Ignore("Only validating compilation of examples")] - public async Task Example_AnalyzeConversationJobState_GetAnalyzeConversationJobStatus_SuccessfulConversationPIIMaskWithEntityTypeTaskStatusRequest_Convenience_Async() + public async Task Example_AnalyzeConversationJobState_GetAnalyzeConversationJobStatus_SuccessfulConversationPIIExclusionTaskStatusRequest_Convenience_Async() { Uri endpoint = new Uri(""); AzureKeyCredential credential = new AzureKeyCredential(""); @@ -571,7 +571,7 @@ public async Task Example_AnalyzeConversationJobState_GetAnalyzeConversationJobS [Test] [Ignore("Only validating compilation of examples")] - public void Example_AnalyzeConversationJobState_GetAnalyzeConversationJobStatus_SuccessfulConversationPIIMaskWithRedactionTaskStatusRequest() + public void Example_AnalyzeConversationJobState_GetAnalyzeConversationJobStatus_SuccessfulConversationPIINoMaskTaskStatusRequest() { Uri endpoint = new Uri(""); AzureKeyCredential credential = new AzureKeyCredential(""); @@ -592,7 +592,7 @@ public void Example_AnalyzeConversationJobState_GetAnalyzeConversationJobStatus_ [Test] [Ignore("Only validating compilation of examples")] - public async Task Example_AnalyzeConversationJobState_GetAnalyzeConversationJobStatus_SuccessfulConversationPIIMaskWithRedactionTaskStatusRequest_Async() + public async Task Example_AnalyzeConversationJobState_GetAnalyzeConversationJobStatus_SuccessfulConversationPIINoMaskTaskStatusRequest_Async() { Uri endpoint = new Uri(""); AzureKeyCredential credential = new AzureKeyCredential(""); @@ -613,7 +613,7 @@ public async Task Example_AnalyzeConversationJobState_GetAnalyzeConversationJobS [Test] [Ignore("Only validating compilation of examples")] - public void Example_AnalyzeConversationJobState_GetAnalyzeConversationJobStatus_SuccessfulConversationPIIMaskWithRedactionTaskStatusRequest_Convenience() + public void Example_AnalyzeConversationJobState_GetAnalyzeConversationJobStatus_SuccessfulConversationPIINoMaskTaskStatusRequest_Convenience() { Uri endpoint = new Uri(""); AzureKeyCredential credential = new AzureKeyCredential(""); @@ -624,7 +624,7 @@ public void Example_AnalyzeConversationJobState_GetAnalyzeConversationJobStatus_ [Test] [Ignore("Only validating compilation of examples")] - public async Task Example_AnalyzeConversationJobState_GetAnalyzeConversationJobStatus_SuccessfulConversationPIIMaskWithRedactionTaskStatusRequest_Convenience_Async() + public async Task Example_AnalyzeConversationJobState_GetAnalyzeConversationJobStatus_SuccessfulConversationPIINoMaskTaskStatusRequest_Convenience_Async() { Uri endpoint = new Uri(""); AzureKeyCredential credential = new AzureKeyCredential(""); @@ -955,7 +955,7 @@ public async Task Example_AnalyzeConversationJobState_GetAnalyzeConversationJobS [Test] [Ignore("Only validating compilation of examples")] - public void Example_Conversations_AnalyzeConversationSubmitOperation_SuccessfulConversationPIIDoNotRedact() + public void Example_Conversations_AnalyzeConversationSubmitOperation_SuccessfulConversationPIICharacterMask() { Uri endpoint = new Uri(""); AzureKeyCredential credential = new AzureKeyCredential(""); @@ -1031,7 +1031,8 @@ public void Example_Conversations_AnalyzeConversationSubmitOperation_SuccessfulC }, redactionPolicy = new { -policyKind = "DoNotRedact", +policyKind = "characterMask", +redactionCharacter = "-", }, redactionSource = "lexical", redactAudioTiming = true, @@ -1044,7 +1045,7 @@ public void Example_Conversations_AnalyzeConversationSubmitOperation_SuccessfulC [Test] [Ignore("Only validating compilation of examples")] - public async Task Example_Conversations_AnalyzeConversationSubmitOperation_SuccessfulConversationPIIDoNotRedact_Async() + public async Task Example_Conversations_AnalyzeConversationSubmitOperation_SuccessfulConversationPIICharacterMask_Async() { Uri endpoint = new Uri(""); AzureKeyCredential credential = new AzureKeyCredential(""); @@ -1120,7 +1121,8 @@ public async Task Example_Conversations_AnalyzeConversationSubmitOperation_Succe }, redactionPolicy = new { -policyKind = "DoNotRedact", +policyKind = "characterMask", +redactionCharacter = "-", }, redactionSource = "lexical", redactAudioTiming = true, @@ -1133,7 +1135,7 @@ public async Task Example_Conversations_AnalyzeConversationSubmitOperation_Succe [Test] [Ignore("Only validating compilation of examples")] - public void Example_Conversations_AnalyzeConversationSubmitOperation_SuccessfulConversationPIIDoNotRedact_Convenience() + public void Example_Conversations_AnalyzeConversationSubmitOperation_SuccessfulConversationPIICharacterMask_Convenience() { Uri endpoint = new Uri(""); AzureKeyCredential credential = new AzureKeyCredential(""); @@ -1187,7 +1189,10 @@ public void Example_Conversations_AnalyzeConversationSubmitOperation_SuccessfulC PiiCategories = {ConversationPiiCategories.All}, RedactAudioTiming = true, RedactionSource = TranscriptContentType.Lexical, -RedactionPolicy = new DoNotRedactPolicyType(), +RedactionPolicy = new CharacterMaskPolicyType +{ +RedactionCharacter = RedactionCharacter.Minus, +}, }, Name = "Conversation PII", } @@ -1200,7 +1205,7 @@ public void Example_Conversations_AnalyzeConversationSubmitOperation_SuccessfulC [Test] [Ignore("Only validating compilation of examples")] - public async Task Example_Conversations_AnalyzeConversationSubmitOperation_SuccessfulConversationPIIDoNotRedact_Convenience_Async() + public async Task Example_Conversations_AnalyzeConversationSubmitOperation_SuccessfulConversationPIICharacterMask_Convenience_Async() { Uri endpoint = new Uri(""); AzureKeyCredential credential = new AzureKeyCredential(""); @@ -1254,7 +1259,10 @@ public async Task Example_Conversations_AnalyzeConversationSubmitOperation_Succe PiiCategories = {ConversationPiiCategories.All}, RedactAudioTiming = true, RedactionSource = TranscriptContentType.Lexical, -RedactionPolicy = new DoNotRedactPolicyType(), +RedactionPolicy = new CharacterMaskPolicyType +{ +RedactionCharacter = RedactionCharacter.Minus, +}, }, Name = "Conversation PII", } @@ -1267,7 +1275,7 @@ public async Task Example_Conversations_AnalyzeConversationSubmitOperation_Succe [Test] [Ignore("Only validating compilation of examples")] - public void Example_Conversations_AnalyzeConversationSubmitOperation_SuccessfulConversationPIIExclusionSubmit() + public void Example_Conversations_AnalyzeConversationSubmitOperation_SuccessfulConversationPIIEntityMask() { Uri endpoint = new Uri(""); AzureKeyCredential credential = new AzureKeyCredential(""); @@ -1337,9 +1345,13 @@ public void Example_Conversations_AnalyzeConversationSubmitOperation_SuccessfulC parameters = new { modelVersion = "latest", -excludePiiCategories = new object[] +piiCategories = new object[] { -"Person" +"All" +}, +redactionPolicy = new +{ +policyKind = "entityMask", }, redactionSource = "lexical", redactAudioTiming = true, @@ -1352,7 +1364,7 @@ public void Example_Conversations_AnalyzeConversationSubmitOperation_SuccessfulC [Test] [Ignore("Only validating compilation of examples")] - public async Task Example_Conversations_AnalyzeConversationSubmitOperation_SuccessfulConversationPIIExclusionSubmit_Async() + public async Task Example_Conversations_AnalyzeConversationSubmitOperation_SuccessfulConversationPIIEntityMask_Async() { Uri endpoint = new Uri(""); AzureKeyCredential credential = new AzureKeyCredential(""); @@ -1422,9 +1434,13 @@ public async Task Example_Conversations_AnalyzeConversationSubmitOperation_Succe parameters = new { modelVersion = "latest", -excludePiiCategories = new object[] +piiCategories = new object[] { -"Person" +"All" +}, +redactionPolicy = new +{ +policyKind = "entityMask", }, redactionSource = "lexical", redactAudioTiming = true, @@ -1437,7 +1453,7 @@ public async Task Example_Conversations_AnalyzeConversationSubmitOperation_Succe [Test] [Ignore("Only validating compilation of examples")] - public void Example_Conversations_AnalyzeConversationSubmitOperation_SuccessfulConversationPIIExclusionSubmit_Convenience() + public void Example_Conversations_AnalyzeConversationSubmitOperation_SuccessfulConversationPIIEntityMask_Convenience() { Uri endpoint = new Uri(""); AzureKeyCredential credential = new AzureKeyCredential(""); @@ -1488,9 +1504,10 @@ public void Example_Conversations_AnalyzeConversationSubmitOperation_SuccessfulC ActionContent = new PiiActionContent { ModelVersion = "latest", +PiiCategories = {ConversationPiiCategories.All}, RedactAudioTiming = true, RedactionSource = TranscriptContentType.Lexical, -ExcludePiiCategories = {ConversationPiiCategoryExclusions.Person}, +RedactionPolicy = new EntityMaskTypePolicyType(), }, Name = "Conversation PII", } @@ -1503,7 +1520,7 @@ public void Example_Conversations_AnalyzeConversationSubmitOperation_SuccessfulC [Test] [Ignore("Only validating compilation of examples")] - public async Task Example_Conversations_AnalyzeConversationSubmitOperation_SuccessfulConversationPIIExclusionSubmit_Convenience_Async() + public async Task Example_Conversations_AnalyzeConversationSubmitOperation_SuccessfulConversationPIIEntityMask_Convenience_Async() { Uri endpoint = new Uri(""); AzureKeyCredential credential = new AzureKeyCredential(""); @@ -1554,9 +1571,10 @@ public async Task Example_Conversations_AnalyzeConversationSubmitOperation_Succe ActionContent = new PiiActionContent { ModelVersion = "latest", +PiiCategories = {ConversationPiiCategories.All}, RedactAudioTiming = true, RedactionSource = TranscriptContentType.Lexical, -ExcludePiiCategories = {ConversationPiiCategoryExclusions.Person}, +RedactionPolicy = new EntityMaskTypePolicyType(), }, Name = "Conversation PII", } @@ -1569,7 +1587,7 @@ public async Task Example_Conversations_AnalyzeConversationSubmitOperation_Succe [Test] [Ignore("Only validating compilation of examples")] - public void Example_Conversations_AnalyzeConversationSubmitOperation_SuccessfulConversationPIIMaskWithEntityType() + public void Example_Conversations_AnalyzeConversationSubmitOperation_SuccessfulConversationPIIExclusionSubmit() { Uri endpoint = new Uri(""); AzureKeyCredential credential = new AzureKeyCredential(""); @@ -1639,13 +1657,9 @@ public void Example_Conversations_AnalyzeConversationSubmitOperation_SuccessfulC parameters = new { modelVersion = "latest", -piiCategories = new object[] -{ -"All" -}, -redactionPolicy = new +excludePiiCategories = new object[] { -policyKind = "MaskWithEntityType", +"Person" }, redactionSource = "lexical", redactAudioTiming = true, @@ -1658,7 +1672,7 @@ public void Example_Conversations_AnalyzeConversationSubmitOperation_SuccessfulC [Test] [Ignore("Only validating compilation of examples")] - public async Task Example_Conversations_AnalyzeConversationSubmitOperation_SuccessfulConversationPIIMaskWithEntityType_Async() + public async Task Example_Conversations_AnalyzeConversationSubmitOperation_SuccessfulConversationPIIExclusionSubmit_Async() { Uri endpoint = new Uri(""); AzureKeyCredential credential = new AzureKeyCredential(""); @@ -1728,13 +1742,9 @@ public async Task Example_Conversations_AnalyzeConversationSubmitOperation_Succe parameters = new { modelVersion = "latest", -piiCategories = new object[] -{ -"All" -}, -redactionPolicy = new +excludePiiCategories = new object[] { -policyKind = "MaskWithEntityType", +"Person" }, redactionSource = "lexical", redactAudioTiming = true, @@ -1747,7 +1757,7 @@ public async Task Example_Conversations_AnalyzeConversationSubmitOperation_Succe [Test] [Ignore("Only validating compilation of examples")] - public void Example_Conversations_AnalyzeConversationSubmitOperation_SuccessfulConversationPIIMaskWithEntityType_Convenience() + public void Example_Conversations_AnalyzeConversationSubmitOperation_SuccessfulConversationPIIExclusionSubmit_Convenience() { Uri endpoint = new Uri(""); AzureKeyCredential credential = new AzureKeyCredential(""); @@ -1798,10 +1808,9 @@ public void Example_Conversations_AnalyzeConversationSubmitOperation_SuccessfulC ActionContent = new PiiActionContent { ModelVersion = "latest", -PiiCategories = {ConversationPiiCategories.All}, RedactAudioTiming = true, RedactionSource = TranscriptContentType.Lexical, -RedactionPolicy = new MaskWithEntityTypePolicyType(), +ExcludePiiCategories = {ConversationPiiCategoryExclusions.Person}, }, Name = "Conversation PII", } @@ -1814,7 +1823,7 @@ public void Example_Conversations_AnalyzeConversationSubmitOperation_SuccessfulC [Test] [Ignore("Only validating compilation of examples")] - public async Task Example_Conversations_AnalyzeConversationSubmitOperation_SuccessfulConversationPIIMaskWithEntityType_Convenience_Async() + public async Task Example_Conversations_AnalyzeConversationSubmitOperation_SuccessfulConversationPIIExclusionSubmit_Convenience_Async() { Uri endpoint = new Uri(""); AzureKeyCredential credential = new AzureKeyCredential(""); @@ -1865,10 +1874,9 @@ public async Task Example_Conversations_AnalyzeConversationSubmitOperation_Succe ActionContent = new PiiActionContent { ModelVersion = "latest", -PiiCategories = {ConversationPiiCategories.All}, RedactAudioTiming = true, RedactionSource = TranscriptContentType.Lexical, -RedactionPolicy = new MaskWithEntityTypePolicyType(), +ExcludePiiCategories = {ConversationPiiCategoryExclusions.Person}, }, Name = "Conversation PII", } @@ -1881,7 +1889,7 @@ public async Task Example_Conversations_AnalyzeConversationSubmitOperation_Succe [Test] [Ignore("Only validating compilation of examples")] - public void Example_Conversations_AnalyzeConversationSubmitOperation_SuccessfulConversationPIIMaskWithRedactionCharacter() + public void Example_Conversations_AnalyzeConversationSubmitOperation_SuccessfulConversationPIINoMask() { Uri endpoint = new Uri(""); AzureKeyCredential credential = new AzureKeyCredential(""); @@ -1957,8 +1965,7 @@ public void Example_Conversations_AnalyzeConversationSubmitOperation_SuccessfulC }, redactionPolicy = new { -policyKind = "MaskWithRedactionCharacter", -redactionCharacter = "-", +policyKind = "noMask", }, redactionSource = "lexical", redactAudioTiming = true, @@ -1971,7 +1978,7 @@ public void Example_Conversations_AnalyzeConversationSubmitOperation_SuccessfulC [Test] [Ignore("Only validating compilation of examples")] - public async Task Example_Conversations_AnalyzeConversationSubmitOperation_SuccessfulConversationPIIMaskWithRedactionCharacter_Async() + public async Task Example_Conversations_AnalyzeConversationSubmitOperation_SuccessfulConversationPIINoMask_Async() { Uri endpoint = new Uri(""); AzureKeyCredential credential = new AzureKeyCredential(""); @@ -2047,8 +2054,7 @@ public async Task Example_Conversations_AnalyzeConversationSubmitOperation_Succe }, redactionPolicy = new { -policyKind = "MaskWithRedactionCharacter", -redactionCharacter = "-", +policyKind = "noMask", }, redactionSource = "lexical", redactAudioTiming = true, @@ -2061,7 +2067,7 @@ public async Task Example_Conversations_AnalyzeConversationSubmitOperation_Succe [Test] [Ignore("Only validating compilation of examples")] - public void Example_Conversations_AnalyzeConversationSubmitOperation_SuccessfulConversationPIIMaskWithRedactionCharacter_Convenience() + public void Example_Conversations_AnalyzeConversationSubmitOperation_SuccessfulConversationPIINoMask_Convenience() { Uri endpoint = new Uri(""); AzureKeyCredential credential = new AzureKeyCredential(""); @@ -2115,10 +2121,7 @@ public void Example_Conversations_AnalyzeConversationSubmitOperation_SuccessfulC PiiCategories = {ConversationPiiCategories.All}, RedactAudioTiming = true, RedactionSource = TranscriptContentType.Lexical, -RedactionPolicy = new MaskWithRedactionCharacterPolicyType -{ -RedactionCharacter = RedactionCharacter.Minus, -}, +RedactionPolicy = new NoMaskPolicyType(), }, Name = "Conversation PII", } @@ -2131,7 +2134,7 @@ public void Example_Conversations_AnalyzeConversationSubmitOperation_SuccessfulC [Test] [Ignore("Only validating compilation of examples")] - public async Task Example_Conversations_AnalyzeConversationSubmitOperation_SuccessfulConversationPIIMaskWithRedactionCharacter_Convenience_Async() + public async Task Example_Conversations_AnalyzeConversationSubmitOperation_SuccessfulConversationPIINoMask_Convenience_Async() { Uri endpoint = new Uri(""); AzureKeyCredential credential = new AzureKeyCredential(""); @@ -2185,10 +2188,7 @@ public async Task Example_Conversations_AnalyzeConversationSubmitOperation_Succe PiiCategories = {ConversationPiiCategories.All}, RedactAudioTiming = true, RedactionSource = TranscriptContentType.Lexical, -RedactionPolicy = new MaskWithRedactionCharacterPolicyType -{ -RedactionCharacter = RedactionCharacter.Minus, -}, +RedactionPolicy = new NoMaskPolicyType(), }, Name = "Conversation PII", } diff --git a/sdk/cognitivelanguage/Azure.AI.Language.Conversations/tsp-location.yaml b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/tsp-location.yaml index 67bf525c2f06..8688a17d2239 100644 --- a/sdk/cognitivelanguage/Azure.AI.Language.Conversations/tsp-location.yaml +++ b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/tsp-location.yaml @@ -1,3 +1,3 @@ directory: specification/cognitiveservices/Language.Conversations -commit: 6e8e566a596fb72581c26696c88e88c6990c3924 +commit: 12f55505d123bc93fa51cf9d8ea6246d62e2a555 repo: Azure/azure-rest-api-specs From 49d076638392ec93a240b5af556801983814a34f Mon Sep 17 00:00:00 2001 From: Xiong Chen Date: Mon, 13 Jan 2025 14:17:08 -0800 Subject: [PATCH 05/31] modified the ChangeLog --- .../Azure.AI.Language.Conversations/CHANGELOG.md | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/sdk/cognitivelanguage/Azure.AI.Language.Conversations/CHANGELOG.md b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/CHANGELOG.md index 8f1715702251..bb960545ca8e 100644 --- a/sdk/cognitivelanguage/Azure.AI.Language.Conversations/CHANGELOG.md +++ b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/CHANGELOG.md @@ -1,16 +1,20 @@ # Release History -## 2.0.0-beta.2 (Unreleased) +## 2.0.0-beta.2 (2025-01-13) ### Features Added - Exposed `JsonModelWriteCore` for model serialization procedure. - +- Added support for analyze-conversation API Versions + - 2024-11-01 + - 2024-11-15-preview ### Breaking Changes ### Bugs Fixed ### Other Changes +- Removed support for analyze-conversation API Versions + - 2023-11-15-preview ## 2.0.0-beta.1 (2024-08-01) From c036a00d3ac23825eedc86adf42726b7a081f160 Mon Sep 17 00:00:00 2001 From: Xiong Chen Date: Mon, 13 Jan 2025 14:32:30 -0800 Subject: [PATCH 06/31] remove breaking changes and Bugs Fixed sections --- .../Azure.AI.Language.Conversations/CHANGELOG.md | 3 --- 1 file changed, 3 deletions(-) diff --git a/sdk/cognitivelanguage/Azure.AI.Language.Conversations/CHANGELOG.md b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/CHANGELOG.md index bb960545ca8e..5c7d97bc0506 100644 --- a/sdk/cognitivelanguage/Azure.AI.Language.Conversations/CHANGELOG.md +++ b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/CHANGELOG.md @@ -8,9 +8,6 @@ - Added support for analyze-conversation API Versions - 2024-11-01 - 2024-11-15-preview -### Breaking Changes - -### Bugs Fixed ### Other Changes - Removed support for analyze-conversation API Versions From 476e07097bb0f11603ecf8fcce3ee75fb24da008 Mon Sep 17 00:00:00 2001 From: Xiong Chen Date: Mon, 27 Jan 2025 13:23:34 -0800 Subject: [PATCH 07/31] update sdk based on the latest commit id --- .../Generated/ConversationsModelFactory.cs | 12 +++--- .../Docs/ConversationAnalysisClient.xml | 36 ++++++++-------- ...derstandingActionContent.Serialization.cs} | 42 +++++++++---------- ...tionLanguageUnderstandingActionContent.cs} | 14 +++---- ...anguageUnderstandingInput.Serialization.cs | 4 +- .../ConversationLanguageUnderstandingInput.cs | 6 +-- ...ersationPiiActionContent.Serialization.cs} | 42 +++++++++---------- ...ent.cs => ConversationPiiActionContent.cs} | 10 ++--- .../Models/ConversationPiiCategories.cs | 15 +++---- .../ConversationPiiCategoryExclusions.cs | 12 +++--- .../PiiOperationAction.Serialization.cs | 4 +- .../Generated/Models/PiiOperationAction.cs | 4 +- .../src/Generated/Models/RegexKey.cs | 4 +- .../Samples_ConversationAnalysisClient.cs | 36 ++++++++-------- .../tsp-location.yaml | 2 +- 15 files changed, 120 insertions(+), 123 deletions(-) rename sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/{ConversationActionContent.Serialization.cs => ConversationLanguageUnderstandingActionContent.Serialization.cs} (76%) rename sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/{ConversationActionContent.cs => ConversationLanguageUnderstandingActionContent.cs} (88%) rename sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/{PiiActionContent.Serialization.cs => ConversationPiiActionContent.Serialization.cs} (82%) rename sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/{PiiActionContent.cs => ConversationPiiActionContent.cs} (89%) diff --git a/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/ConversationsModelFactory.cs b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/ConversationsModelFactory.cs index c32db78f4b3a..969afa1b41ec 100644 --- a/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/ConversationsModelFactory.cs +++ b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/ConversationsModelFactory.cs @@ -19,7 +19,7 @@ public static partial class ConversationsModelFactory /// The input ConversationItem and its optional parameters. /// Input parameters necessary for a Conversation language understanding task. /// A new instance for mocking. - public static ConversationLanguageUnderstandingInput ConversationLanguageUnderstandingInput(ConversationAnalysisInput conversationInput = null, ConversationActionContent actionContent = null) + public static ConversationLanguageUnderstandingInput ConversationLanguageUnderstandingInput(ConversationAnalysisInput conversationInput = null, ConversationLanguageUnderstandingActionContent actionContent = null) { return new ConversationLanguageUnderstandingInput(AnalyzeConversationInputKind.Conversation, serializedAdditionalRawData: null, conversationInput, actionContent); } @@ -44,7 +44,7 @@ public static TextConversationItem TextConversationItem(string id = null, string serializedAdditionalRawData: null); } - /// Initializes a new instance of . + /// Initializes a new instance of . /// The name of the project to use. /// The name of the deployment to use. /// If true, the service will return more detailed information in the response. @@ -56,12 +56,12 @@ public static TextConversationItem TextConversationItem(string id = null, string /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. /// The available derived classes include , and . /// - /// A new instance for mocking. - public static ConversationActionContent ConversationActionContent(string projectName = null, string deploymentName = null, bool? verbose = null, bool? isLoggingEnabled = null, StringIndexType? stringIndexType = null, string directTarget = null, IDictionary targetProjectParameters = null) + /// A new instance for mocking. + public static ConversationLanguageUnderstandingActionContent ConversationLanguageUnderstandingActionContent(string projectName = null, string deploymentName = null, bool? verbose = null, bool? isLoggingEnabled = null, StringIndexType? stringIndexType = null, string directTarget = null, IDictionary targetProjectParameters = null) { targetProjectParameters ??= new Dictionary(); - return new ConversationActionContent( + return new ConversationLanguageUnderstandingActionContent( projectName, deploymentName, verbose, @@ -352,7 +352,7 @@ public static ListKey ListKey(string key = null) /// Initializes a new instance of . /// The key of the regex pattern used in extracting the entity. - /// The .NET regex pattern used in extracting the entity. Please visit https://docs.microsoft.com/dotnet/standard/base-types/regular-expressions for more information about .NET regular expressions. + /// The .NET regex pattern used in extracting the entity. Please visit https://learn.microsoft.com/dotnet/standard/base-types/regular-expressions for more information about .NET regular expressions. /// A new instance for mocking. public static RegexKey RegexKey(string key = null, string regexPattern = null) { diff --git a/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Docs/ConversationAnalysisClient.xml b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Docs/ConversationAnalysisClient.xml index ca3b90fddb87..572bedf8b8a2 100644 --- a/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Docs/ConversationAnalysisClient.xml +++ b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Docs/ConversationAnalysisClient.xml @@ -9,7 +9,7 @@ Uri endpoint = new Uri(""); AzureKeyCredential credential = new AzureKeyCredential(""); ConversationAnalysisClient client = new ConversationAnalysisClient(endpoint, credential); -AnalyzeConversationInput analyzeConversationInput = new ConversationLanguageUnderstandingInput(new ConversationAnalysisInput(new TextConversationItem("1", "1", "Book a flight to Seattle on Oct 10th")), new ConversationActionContent("{project-name}", "{deployment-name}")); +AnalyzeConversationInput analyzeConversationInput = new ConversationLanguageUnderstandingInput(new ConversationAnalysisInput(new TextConversationItem("1", "1", "Book a flight to Seattle on Oct 10th")), new ConversationLanguageUnderstandingActionContent("{project-name}", "{deployment-name}")); Response response = await client.AnalyzeConversationAsync(analyzeConversationInput); ]]> This sample shows how to call AnalyzeConversationAsync. @@ -22,7 +22,7 @@ AnalyzeConversationInput analyzeConversationInput = new ConversationLanguageUnde { Language = "en-GB", Modality = InputModality.Text, -}), new ConversationActionContent("{project-name}", "{deployment-name}") +}), new ConversationLanguageUnderstandingActionContent("{project-name}", "{deployment-name}") { Verbose = true, IsLoggingEnabled = false, @@ -35,7 +35,7 @@ Uri endpoint = new Uri(""); AzureKeyCredential credential = new AzureKeyCredential(""); ConversationAnalysisClient client = new ConversationAnalysisClient(endpoint, credential); -AnalyzeConversationInput analyzeConversationInput = new ConversationLanguageUnderstandingInput(new ConversationAnalysisInput(new TextConversationItem("1", "1", "Ports and connectors")), new ConversationActionContent("prj1", "dep1") +AnalyzeConversationInput analyzeConversationInput = new ConversationLanguageUnderstandingInput(new ConversationAnalysisInput(new TextConversationItem("1", "1", "Ports and connectors")), new ConversationLanguageUnderstandingActionContent("prj1", "dep1") { DirectTarget = "qnaProject", TargetProjectParameters = @@ -65,7 +65,7 @@ Uri endpoint = new Uri(""); AzureKeyCredential credential = new AzureKeyCredential(""); ConversationAnalysisClient client = new ConversationAnalysisClient(endpoint, credential); -AnalyzeConversationInput analyzeConversationInput = new ConversationLanguageUnderstandingInput(new ConversationAnalysisInput(new TextConversationItem("1", "1", "Book a flight to Seattle on Oct 10th")), new ConversationActionContent("{project-name}", "{deployment-name}")); +AnalyzeConversationInput analyzeConversationInput = new ConversationLanguageUnderstandingInput(new ConversationAnalysisInput(new TextConversationItem("1", "1", "Book a flight to Seattle on Oct 10th")), new ConversationLanguageUnderstandingActionContent("{project-name}", "{deployment-name}")); Response response = client.AnalyzeConversation(analyzeConversationInput); ]]> This sample shows how to call AnalyzeConversation. @@ -78,7 +78,7 @@ AnalyzeConversationInput analyzeConversationInput = new ConversationLanguageUnde { Language = "en-GB", Modality = InputModality.Text, -}), new ConversationActionContent("{project-name}", "{deployment-name}") +}), new ConversationLanguageUnderstandingActionContent("{project-name}", "{deployment-name}") { Verbose = true, IsLoggingEnabled = false, @@ -91,7 +91,7 @@ Uri endpoint = new Uri(""); AzureKeyCredential credential = new AzureKeyCredential(""); ConversationAnalysisClient client = new ConversationAnalysisClient(endpoint, credential); -AnalyzeConversationInput analyzeConversationInput = new ConversationLanguageUnderstandingInput(new ConversationAnalysisInput(new TextConversationItem("1", "1", "Ports and connectors")), new ConversationActionContent("prj1", "dep1") +AnalyzeConversationInput analyzeConversationInput = new ConversationLanguageUnderstandingInput(new ConversationAnalysisInput(new TextConversationItem("1", "1", "Ports and connectors")), new ConversationLanguageUnderstandingActionContent("prj1", "dep1") { DirectTarget = "qnaProject", TargetProjectParameters = @@ -867,7 +867,7 @@ AnalyzeConversationOperationInput analyzeConversationOperationInput = new Analyz { new PiiOperationAction { - ActionContent = new PiiActionContent + ActionContent = new ConversationPiiActionContent { ModelVersion = "latest", PiiCategories = {ConversationPiiCategories.All}, @@ -934,7 +934,7 @@ AnalyzeConversationOperationInput analyzeConversationOperationInput = new Analyz { new PiiOperationAction { - ActionContent = new PiiActionContent + ActionContent = new ConversationPiiActionContent { ModelVersion = "latest", PiiCategories = {ConversationPiiCategories.All}, @@ -998,7 +998,7 @@ AnalyzeConversationOperationInput analyzeConversationOperationInput = new Analyz { new PiiOperationAction { - ActionContent = new PiiActionContent + ActionContent = new ConversationPiiActionContent { ModelVersion = "latest", RedactAudioTiming = true, @@ -1061,7 +1061,7 @@ AnalyzeConversationOperationInput analyzeConversationOperationInput = new Analyz { new PiiOperationAction { - ActionContent = new PiiActionContent + ActionContent = new ConversationPiiActionContent { ModelVersion = "latest", PiiCategories = {ConversationPiiCategories.All}, @@ -1125,7 +1125,7 @@ AnalyzeConversationOperationInput analyzeConversationOperationInput = new Analyz { new PiiOperationAction { - ActionContent = new PiiActionContent + ActionContent = new ConversationPiiActionContent { ModelVersion = "latest", PiiCategories = {ConversationPiiCategories.All}, @@ -1189,7 +1189,7 @@ AnalyzeConversationOperationInput analyzeConversationOperationInput = new Analyz { new PiiOperationAction { - ActionContent = new PiiActionContent + ActionContent = new ConversationPiiActionContent { ModelVersion = "latest", PiiCategories = {ConversationPiiCategories.All}, @@ -1429,7 +1429,7 @@ AnalyzeConversationOperationInput analyzeConversationOperationInput = new Analyz { new PiiOperationAction { - ActionContent = new PiiActionContent + ActionContent = new ConversationPiiActionContent { ModelVersion = "latest", PiiCategories = {ConversationPiiCategories.All}, @@ -1496,7 +1496,7 @@ AnalyzeConversationOperationInput analyzeConversationOperationInput = new Analyz { new PiiOperationAction { - ActionContent = new PiiActionContent + ActionContent = new ConversationPiiActionContent { ModelVersion = "latest", PiiCategories = {ConversationPiiCategories.All}, @@ -1560,7 +1560,7 @@ AnalyzeConversationOperationInput analyzeConversationOperationInput = new Analyz { new PiiOperationAction { - ActionContent = new PiiActionContent + ActionContent = new ConversationPiiActionContent { ModelVersion = "latest", RedactAudioTiming = true, @@ -1623,7 +1623,7 @@ AnalyzeConversationOperationInput analyzeConversationOperationInput = new Analyz { new PiiOperationAction { - ActionContent = new PiiActionContent + ActionContent = new ConversationPiiActionContent { ModelVersion = "latest", PiiCategories = {ConversationPiiCategories.All}, @@ -1687,7 +1687,7 @@ AnalyzeConversationOperationInput analyzeConversationOperationInput = new Analyz { new PiiOperationAction { - ActionContent = new PiiActionContent + ActionContent = new ConversationPiiActionContent { ModelVersion = "latest", PiiCategories = {ConversationPiiCategories.All}, @@ -1751,7 +1751,7 @@ AnalyzeConversationOperationInput analyzeConversationOperationInput = new Analyz { new PiiOperationAction { - ActionContent = new PiiActionContent + ActionContent = new ConversationPiiActionContent { ModelVersion = "latest", PiiCategories = {ConversationPiiCategories.All}, diff --git a/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/ConversationActionContent.Serialization.cs b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/ConversationLanguageUnderstandingActionContent.Serialization.cs similarity index 76% rename from sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/ConversationActionContent.Serialization.cs rename to sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/ConversationLanguageUnderstandingActionContent.Serialization.cs index 718e2a950608..fb1b2203c25d 100644 --- a/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/ConversationActionContent.Serialization.cs +++ b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/ConversationLanguageUnderstandingActionContent.Serialization.cs @@ -13,11 +13,11 @@ namespace Azure.AI.Language.Conversations.Models { - public partial class ConversationActionContent : IUtf8JsonSerializable, IJsonModel + public partial class ConversationLanguageUnderstandingActionContent : IUtf8JsonSerializable, IJsonModel { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); - void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) { writer.WriteStartObject(); JsonModelWriteCore(writer, options); @@ -28,10 +28,10 @@ void IJsonModel.Write(Utf8JsonWriter writer, ModelRea /// The client options for reading and writing models. protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") { - throw new FormatException($"The model {nameof(ConversationActionContent)} does not support writing '{format}' format."); + throw new FormatException($"The model {nameof(ConversationLanguageUnderstandingActionContent)} does not support writing '{format}' format."); } writer.WritePropertyName("projectName"u8); @@ -86,19 +86,19 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit } } - ConversationActionContent IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + ConversationLanguageUnderstandingActionContent IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") { - throw new FormatException($"The model {nameof(ConversationActionContent)} does not support reading '{format}' format."); + throw new FormatException($"The model {nameof(ConversationLanguageUnderstandingActionContent)} does not support reading '{format}' format."); } using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeConversationActionContent(document.RootElement, options); + return DeserializeConversationLanguageUnderstandingActionContent(document.RootElement, options); } - internal static ConversationActionContent DeserializeConversationActionContent(JsonElement element, ModelReaderWriterOptions options = null) + internal static ConversationLanguageUnderstandingActionContent DeserializeConversationLanguageUnderstandingActionContent(JsonElement element, ModelReaderWriterOptions options = null) { options ??= ModelSerializationExtensions.WireOptions; @@ -179,7 +179,7 @@ internal static ConversationActionContent DeserializeConversationActionContent(J } } serializedAdditionalRawData = rawDataDictionary; - return new ConversationActionContent( + return new ConversationLanguageUnderstandingActionContent( projectName, deploymentName, verbose, @@ -190,43 +190,43 @@ internal static ConversationActionContent DeserializeConversationActionContent(J serializedAdditionalRawData); } - BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; switch (format) { case "J": return ModelReaderWriter.Write(this, options); default: - throw new FormatException($"The model {nameof(ConversationActionContent)} does not support writing '{options.Format}' format."); + throw new FormatException($"The model {nameof(ConversationLanguageUnderstandingActionContent)} does not support writing '{options.Format}' format."); } } - ConversationActionContent IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + ConversationLanguageUnderstandingActionContent IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; switch (format) { case "J": { using JsonDocument document = JsonDocument.Parse(data); - return DeserializeConversationActionContent(document.RootElement, options); + return DeserializeConversationLanguageUnderstandingActionContent(document.RootElement, options); } default: - throw new FormatException($"The model {nameof(ConversationActionContent)} does not support reading '{options.Format}' format."); + throw new FormatException($"The model {nameof(ConversationLanguageUnderstandingActionContent)} does not support reading '{options.Format}' format."); } } - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; /// Deserializes the model from a raw response. /// The response to deserialize the model from. - internal static ConversationActionContent FromResponse(Response response) + internal static ConversationLanguageUnderstandingActionContent FromResponse(Response response) { using var document = JsonDocument.Parse(response.Content); - return DeserializeConversationActionContent(document.RootElement); + return DeserializeConversationLanguageUnderstandingActionContent(document.RootElement); } /// Convert into a . diff --git a/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/ConversationActionContent.cs b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/ConversationLanguageUnderstandingActionContent.cs similarity index 88% rename from sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/ConversationActionContent.cs rename to sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/ConversationLanguageUnderstandingActionContent.cs index 84b590eb52f5..f2bda2bab4e6 100644 --- a/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/ConversationActionContent.cs +++ b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/ConversationLanguageUnderstandingActionContent.cs @@ -11,7 +11,7 @@ namespace Azure.AI.Language.Conversations.Models { /// Input parameters necessary for a Conversation task. - public partial class ConversationActionContent + public partial class ConversationLanguageUnderstandingActionContent { /// /// Keeps track of any properties unknown to the library. @@ -45,11 +45,11 @@ public partial class ConversationActionContent /// private IDictionary _serializedAdditionalRawData; - /// Initializes a new instance of . + /// Initializes a new instance of . /// The name of the project to use. /// The name of the deployment to use. /// or is null. - public ConversationActionContent(string projectName, string deploymentName) + public ConversationLanguageUnderstandingActionContent(string projectName, string deploymentName) { Argument.AssertNotNull(projectName, nameof(projectName)); Argument.AssertNotNull(deploymentName, nameof(deploymentName)); @@ -59,7 +59,7 @@ public ConversationActionContent(string projectName, string deploymentName) TargetProjectParameters = new ChangeTrackingDictionary(); } - /// Initializes a new instance of . + /// Initializes a new instance of . /// The name of the project to use. /// The name of the deployment to use. /// If true, the service will return more detailed information in the response. @@ -72,7 +72,7 @@ public ConversationActionContent(string projectName, string deploymentName) /// The available derived classes include , and . /// /// Keeps track of any properties unknown to the library. - internal ConversationActionContent(string projectName, string deploymentName, bool? verbose, bool? isLoggingEnabled, StringIndexType? stringIndexType, string directTarget, IDictionary targetProjectParameters, IDictionary serializedAdditionalRawData) + internal ConversationLanguageUnderstandingActionContent(string projectName, string deploymentName, bool? verbose, bool? isLoggingEnabled, StringIndexType? stringIndexType, string directTarget, IDictionary targetProjectParameters, IDictionary serializedAdditionalRawData) { ProjectName = projectName; DeploymentName = deploymentName; @@ -84,8 +84,8 @@ internal ConversationActionContent(string projectName, string deploymentName, bo _serializedAdditionalRawData = serializedAdditionalRawData; } - /// Initializes a new instance of for deserialization. - internal ConversationActionContent() + /// Initializes a new instance of for deserialization. + internal ConversationLanguageUnderstandingActionContent() { } diff --git a/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/ConversationLanguageUnderstandingInput.Serialization.cs b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/ConversationLanguageUnderstandingInput.Serialization.cs index 58f10004bfc4..65a0873b21fd 100644 --- a/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/ConversationLanguageUnderstandingInput.Serialization.cs +++ b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/ConversationLanguageUnderstandingInput.Serialization.cs @@ -62,7 +62,7 @@ internal static ConversationLanguageUnderstandingInput DeserializeConversationLa return null; } ConversationAnalysisInput analysisInput = default; - ConversationActionContent parameters = default; + ConversationLanguageUnderstandingActionContent parameters = default; AnalyzeConversationInputKind kind = default; IDictionary serializedAdditionalRawData = default; Dictionary rawDataDictionary = new Dictionary(); @@ -75,7 +75,7 @@ internal static ConversationLanguageUnderstandingInput DeserializeConversationLa } if (property.NameEquals("parameters"u8)) { - parameters = ConversationActionContent.DeserializeConversationActionContent(property.Value, options); + parameters = ConversationLanguageUnderstandingActionContent.DeserializeConversationLanguageUnderstandingActionContent(property.Value, options); continue; } if (property.NameEquals("kind"u8)) diff --git a/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/ConversationLanguageUnderstandingInput.cs b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/ConversationLanguageUnderstandingInput.cs index 870c70b61e56..95872fc6fca7 100644 --- a/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/ConversationLanguageUnderstandingInput.cs +++ b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/ConversationLanguageUnderstandingInput.cs @@ -17,7 +17,7 @@ public partial class ConversationLanguageUnderstandingInput : AnalyzeConversatio /// The input ConversationItem and its optional parameters. /// Input parameters necessary for a Conversation language understanding task. /// or is null. - public ConversationLanguageUnderstandingInput(ConversationAnalysisInput conversationInput, ConversationActionContent actionContent) + public ConversationLanguageUnderstandingInput(ConversationAnalysisInput conversationInput, ConversationLanguageUnderstandingActionContent actionContent) { Argument.AssertNotNull(conversationInput, nameof(conversationInput)); Argument.AssertNotNull(actionContent, nameof(actionContent)); @@ -32,7 +32,7 @@ public ConversationLanguageUnderstandingInput(ConversationAnalysisInput conversa /// Keeps track of any properties unknown to the library. /// The input ConversationItem and its optional parameters. /// Input parameters necessary for a Conversation language understanding task. - internal ConversationLanguageUnderstandingInput(AnalyzeConversationInputKind kind, IDictionary serializedAdditionalRawData, ConversationAnalysisInput conversationInput, ConversationActionContent actionContent) : base(kind, serializedAdditionalRawData) + internal ConversationLanguageUnderstandingInput(AnalyzeConversationInputKind kind, IDictionary serializedAdditionalRawData, ConversationAnalysisInput conversationInput, ConversationLanguageUnderstandingActionContent actionContent) : base(kind, serializedAdditionalRawData) { ConversationInput = conversationInput; ActionContent = actionContent; @@ -46,6 +46,6 @@ internal ConversationLanguageUnderstandingInput() /// The input ConversationItem and its optional parameters. public ConversationAnalysisInput ConversationInput { get; } /// Input parameters necessary for a Conversation language understanding task. - public ConversationActionContent ActionContent { get; } + public ConversationLanguageUnderstandingActionContent ActionContent { get; } } } diff --git a/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/PiiActionContent.Serialization.cs b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/ConversationPiiActionContent.Serialization.cs similarity index 82% rename from sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/PiiActionContent.Serialization.cs rename to sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/ConversationPiiActionContent.Serialization.cs index 88ead554ea32..88fa41fba49e 100644 --- a/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/PiiActionContent.Serialization.cs +++ b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/ConversationPiiActionContent.Serialization.cs @@ -13,11 +13,11 @@ namespace Azure.AI.Language.Conversations.Models { - public partial class PiiActionContent : IUtf8JsonSerializable, IJsonModel + public partial class ConversationPiiActionContent : IUtf8JsonSerializable, IJsonModel { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); - void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) { writer.WriteStartObject(); JsonModelWriteCore(writer, options); @@ -28,10 +28,10 @@ void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriter /// The client options for reading and writing models. protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") { - throw new FormatException($"The model {nameof(PiiActionContent)} does not support writing '{format}' format."); + throw new FormatException($"The model {nameof(ConversationPiiActionContent)} does not support writing '{format}' format."); } if (Optional.IsDefined(LoggingOptOut)) @@ -101,19 +101,19 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit } } - PiiActionContent IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + ConversationPiiActionContent IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") { - throw new FormatException($"The model {nameof(PiiActionContent)} does not support reading '{format}' format."); + throw new FormatException($"The model {nameof(ConversationPiiActionContent)} does not support reading '{format}' format."); } using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializePiiActionContent(document.RootElement, options); + return DeserializeConversationPiiActionContent(document.RootElement, options); } - internal static PiiActionContent DeserializePiiActionContent(JsonElement element, ModelReaderWriterOptions options = null) + internal static ConversationPiiActionContent DeserializeConversationPiiActionContent(JsonElement element, ModelReaderWriterOptions options = null) { options ??= ModelSerializationExtensions.WireOptions; @@ -217,7 +217,7 @@ internal static PiiActionContent DeserializePiiActionContent(JsonElement element } } serializedAdditionalRawData = rawDataDictionary; - return new PiiActionContent( + return new ConversationPiiActionContent( loggingOptOut, modelVersion, piiCategories ?? new ChangeTrackingList(), @@ -229,43 +229,43 @@ internal static PiiActionContent DeserializePiiActionContent(JsonElement element serializedAdditionalRawData); } - BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; switch (format) { case "J": return ModelReaderWriter.Write(this, options); default: - throw new FormatException($"The model {nameof(PiiActionContent)} does not support writing '{options.Format}' format."); + throw new FormatException($"The model {nameof(ConversationPiiActionContent)} does not support writing '{options.Format}' format."); } } - PiiActionContent IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + ConversationPiiActionContent IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; switch (format) { case "J": { using JsonDocument document = JsonDocument.Parse(data); - return DeserializePiiActionContent(document.RootElement, options); + return DeserializeConversationPiiActionContent(document.RootElement, options); } default: - throw new FormatException($"The model {nameof(PiiActionContent)} does not support reading '{options.Format}' format."); + throw new FormatException($"The model {nameof(ConversationPiiActionContent)} does not support reading '{options.Format}' format."); } } - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; /// Deserializes the model from a raw response. /// The response to deserialize the model from. - internal static PiiActionContent FromResponse(Response response) + internal static ConversationPiiActionContent FromResponse(Response response) { using var document = JsonDocument.Parse(response.Content); - return DeserializePiiActionContent(document.RootElement); + return DeserializeConversationPiiActionContent(document.RootElement); } /// Convert into a . diff --git a/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/PiiActionContent.cs b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/ConversationPiiActionContent.cs similarity index 89% rename from sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/PiiActionContent.cs rename to sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/ConversationPiiActionContent.cs index 9444720549af..d1e3038d7711 100644 --- a/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/PiiActionContent.cs +++ b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/ConversationPiiActionContent.cs @@ -11,7 +11,7 @@ namespace Azure.AI.Language.Conversations.Models { /// Supported parameters for a conversational pii task. - public partial class PiiActionContent + public partial class ConversationPiiActionContent { /// /// Keeps track of any properties unknown to the library. @@ -45,14 +45,14 @@ public partial class PiiActionContent /// private IDictionary _serializedAdditionalRawData; - /// Initializes a new instance of . - public PiiActionContent() + /// Initializes a new instance of . + public ConversationPiiActionContent() { PiiCategories = new ChangeTrackingList(); ExcludePiiCategories = new ChangeTrackingList(); } - /// Initializes a new instance of . + /// Initializes a new instance of . /// logging opt out. /// model version. /// Array of ConversationPIICategories. @@ -66,7 +66,7 @@ public PiiActionContent() /// The available derived classes include , and . /// /// Keeps track of any properties unknown to the library. - internal PiiActionContent(bool? loggingOptOut, string modelVersion, IList piiCategories, bool? redactAudioTiming, TranscriptContentType? redactionSource, RedactionCharacter? redactionCharacter, IList excludePiiCategories, BaseRedactionPolicy redactionPolicy, IDictionary serializedAdditionalRawData) + internal ConversationPiiActionContent(bool? loggingOptOut, string modelVersion, IList piiCategories, bool? redactAudioTiming, TranscriptContentType? redactionSource, RedactionCharacter? redactionCharacter, IList excludePiiCategories, BaseRedactionPolicy redactionPolicy, IDictionary serializedAdditionalRawData) { LoggingOptOut = loggingOptOut; ModelVersion = modelVersion; diff --git a/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/ConversationPiiCategories.cs b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/ConversationPiiCategories.cs index 39882f7570de..faa8d28a24fd 100644 --- a/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/ConversationPiiCategories.cs +++ b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/ConversationPiiCategories.cs @@ -23,32 +23,29 @@ public ConversationPiiCategories(string value) } private const string AddressValue = "Address"; - private const string CreditCardNumberValue = "CreditCardNumber"; + private const string CreditCardValue = "CreditCard"; private const string EmailValue = "Email"; private const string PersonValue = "Person"; private const string NumericIdentifierValue = "NumericIdentifier"; - private const string PhoneNumberValue = "PhoneNumber"; + private const string PhoneValue = "Phone"; private const string UsSocialSecurityNumberValue = "USSocialSecurityNumber"; - private const string MiscellaneousValue = "Miscellaneous"; private const string AllValue = "All"; private const string DefaultValue = "Default"; /// Address category. public static ConversationPiiCategories Address { get; } = new ConversationPiiCategories(AddressValue); - /// Credit card number category. - public static ConversationPiiCategories CreditCardNumber { get; } = new ConversationPiiCategories(CreditCardNumberValue); + /// Credit card category. + public static ConversationPiiCategories CreditCard { get; } = new ConversationPiiCategories(CreditCardValue); /// Email category. public static ConversationPiiCategories Email { get; } = new ConversationPiiCategories(EmailValue); /// Person category. public static ConversationPiiCategories Person { get; } = new ConversationPiiCategories(PersonValue); /// Numeric identifier category. public static ConversationPiiCategories NumericIdentifier { get; } = new ConversationPiiCategories(NumericIdentifierValue); - /// Phone number category. - public static ConversationPiiCategories PhoneNumber { get; } = new ConversationPiiCategories(PhoneNumberValue); + /// Phone category. + public static ConversationPiiCategories Phone { get; } = new ConversationPiiCategories(PhoneValue); /// US social security number category. public static ConversationPiiCategories UsSocialSecurityNumber { get; } = new ConversationPiiCategories(UsSocialSecurityNumberValue); - /// Miscellaneous category. - public static ConversationPiiCategories Miscellaneous { get; } = new ConversationPiiCategories(MiscellaneousValue); /// All categories. public static ConversationPiiCategories All { get; } = new ConversationPiiCategories(AllValue); /// Default categories. diff --git a/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/ConversationPiiCategoryExclusions.cs b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/ConversationPiiCategoryExclusions.cs index a7cf7787186b..3ba61006b2ad 100644 --- a/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/ConversationPiiCategoryExclusions.cs +++ b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/ConversationPiiCategoryExclusions.cs @@ -23,25 +23,25 @@ public ConversationPiiCategoryExclusions(string value) } private const string AddressValue = "Address"; - private const string CreditCardNumberValue = "CreditCardNumber"; + private const string CreditCardValue = "CreditCard"; private const string EmailValue = "Email"; private const string PersonValue = "Person"; private const string NumericIdentifierValue = "NumericIdentifier"; - private const string PhoneNumberValue = "PhoneNumber"; + private const string PhoneValue = "Phone"; private const string UsSocialSecurityNumberValue = "USSocialSecurityNumber"; /// Address category. public static ConversationPiiCategoryExclusions Address { get; } = new ConversationPiiCategoryExclusions(AddressValue); - /// Credit card number category. - public static ConversationPiiCategoryExclusions CreditCardNumber { get; } = new ConversationPiiCategoryExclusions(CreditCardNumberValue); + /// Credit card category. + public static ConversationPiiCategoryExclusions CreditCard { get; } = new ConversationPiiCategoryExclusions(CreditCardValue); /// Email category. public static ConversationPiiCategoryExclusions Email { get; } = new ConversationPiiCategoryExclusions(EmailValue); /// Person category. public static ConversationPiiCategoryExclusions Person { get; } = new ConversationPiiCategoryExclusions(PersonValue); /// Numeric identifier category. public static ConversationPiiCategoryExclusions NumericIdentifier { get; } = new ConversationPiiCategoryExclusions(NumericIdentifierValue); - /// Phone number category. - public static ConversationPiiCategoryExclusions PhoneNumber { get; } = new ConversationPiiCategoryExclusions(PhoneNumberValue); + /// Phone category. + public static ConversationPiiCategoryExclusions Phone { get; } = new ConversationPiiCategoryExclusions(PhoneValue); /// US social security number category. public static ConversationPiiCategoryExclusions UsSocialSecurityNumber { get; } = new ConversationPiiCategoryExclusions(UsSocialSecurityNumberValue); /// Determines if two values are the same. diff --git a/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/PiiOperationAction.Serialization.cs b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/PiiOperationAction.Serialization.cs index 64ac880e4940..4a3d0516e4f7 100644 --- a/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/PiiOperationAction.Serialization.cs +++ b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/PiiOperationAction.Serialization.cs @@ -62,7 +62,7 @@ internal static PiiOperationAction DeserializePiiOperationAction(JsonElement ele { return null; } - PiiActionContent parameters = default; + ConversationPiiActionContent parameters = default; string taskName = default; AnalyzeConversationOperationActionKind kind = default; IDictionary serializedAdditionalRawData = default; @@ -75,7 +75,7 @@ internal static PiiOperationAction DeserializePiiOperationAction(JsonElement ele { continue; } - parameters = PiiActionContent.DeserializePiiActionContent(property.Value, options); + parameters = ConversationPiiActionContent.DeserializeConversationPiiActionContent(property.Value, options); continue; } if (property.NameEquals("taskName"u8)) diff --git a/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/PiiOperationAction.cs b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/PiiOperationAction.cs index b77a4105a311..60d95bc1ccb1 100644 --- a/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/PiiOperationAction.cs +++ b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/PiiOperationAction.cs @@ -24,12 +24,12 @@ public PiiOperationAction() /// Enumeration of supported analysis tasks on a collection of conversations. /// Keeps track of any properties unknown to the library. /// parameters. - internal PiiOperationAction(string name, AnalyzeConversationOperationActionKind kind, IDictionary serializedAdditionalRawData, PiiActionContent actionContent) : base(name, kind, serializedAdditionalRawData) + internal PiiOperationAction(string name, AnalyzeConversationOperationActionKind kind, IDictionary serializedAdditionalRawData, ConversationPiiActionContent actionContent) : base(name, kind, serializedAdditionalRawData) { ActionContent = actionContent; } /// parameters. - public PiiActionContent ActionContent { get; set; } + public ConversationPiiActionContent ActionContent { get; set; } } } diff --git a/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/RegexKey.cs b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/RegexKey.cs index d0c65e7179d8..0df90d9a22ac 100644 --- a/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/RegexKey.cs +++ b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/RegexKey.cs @@ -23,7 +23,7 @@ internal RegexKey() /// The extra information object kind. /// Keeps track of any properties unknown to the library. /// The key of the regex pattern used in extracting the entity. - /// The .NET regex pattern used in extracting the entity. Please visit https://docs.microsoft.com/dotnet/standard/base-types/regular-expressions for more information about .NET regular expressions. + /// The .NET regex pattern used in extracting the entity. Please visit https://learn.microsoft.com/dotnet/standard/base-types/regular-expressions for more information about .NET regular expressions. internal RegexKey(ExtraInformationKind extraInformationKind, IDictionary serializedAdditionalRawData, string key, string regexPattern) : base(extraInformationKind, serializedAdditionalRawData) { Key = key; @@ -32,7 +32,7 @@ internal RegexKey(ExtraInformationKind extraInformationKind, IDictionary The key of the regex pattern used in extracting the entity. public string Key { get; } - /// The .NET regex pattern used in extracting the entity. Please visit https://docs.microsoft.com/dotnet/standard/base-types/regular-expressions for more information about .NET regular expressions. + /// The .NET regex pattern used in extracting the entity. Please visit https://learn.microsoft.com/dotnet/standard/base-types/regular-expressions for more information about .NET regular expressions. public string RegexPattern { get; } } } diff --git a/sdk/cognitivelanguage/Azure.AI.Language.Conversations/tests/Generated/Samples/Samples_ConversationAnalysisClient.cs b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/tests/Generated/Samples/Samples_ConversationAnalysisClient.cs index 17837d3eda76..3f584ad613a7 100644 --- a/sdk/cognitivelanguage/Azure.AI.Language.Conversations/tests/Generated/Samples/Samples_ConversationAnalysisClient.cs +++ b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/tests/Generated/Samples/Samples_ConversationAnalysisClient.cs @@ -89,7 +89,7 @@ public void Example_Conversations_AnalyzeConversation_SuccessfulAnalyzeConversat AzureKeyCredential credential = new AzureKeyCredential(""); ConversationAnalysisClient client = new ConversationAnalysisClient(endpoint, credential); - AnalyzeConversationInput analyzeConversationInput = new ConversationLanguageUnderstandingInput(new ConversationAnalysisInput(new TextConversationItem("1", "1", "Book a flight to Seattle on Oct 10th")), new ConversationActionContent("{project-name}", "{deployment-name}")); + AnalyzeConversationInput analyzeConversationInput = new ConversationLanguageUnderstandingInput(new ConversationAnalysisInput(new TextConversationItem("1", "1", "Book a flight to Seattle on Oct 10th")), new ConversationLanguageUnderstandingActionContent("{project-name}", "{deployment-name}")); Response response = client.AnalyzeConversation(analyzeConversationInput); } @@ -101,7 +101,7 @@ public async Task Example_Conversations_AnalyzeConversation_SuccessfulAnalyzeCon AzureKeyCredential credential = new AzureKeyCredential(""); ConversationAnalysisClient client = new ConversationAnalysisClient(endpoint, credential); - AnalyzeConversationInput analyzeConversationInput = new ConversationLanguageUnderstandingInput(new ConversationAnalysisInput(new TextConversationItem("1", "1", "Book a flight to Seattle on Oct 10th")), new ConversationActionContent("{project-name}", "{deployment-name}")); + AnalyzeConversationInput analyzeConversationInput = new ConversationLanguageUnderstandingInput(new ConversationAnalysisInput(new TextConversationItem("1", "1", "Book a flight to Seattle on Oct 10th")), new ConversationLanguageUnderstandingActionContent("{project-name}", "{deployment-name}")); Response response = await client.AnalyzeConversationAsync(analyzeConversationInput); } @@ -189,7 +189,7 @@ public void Example_Conversations_AnalyzeConversation_SuccessfulAnalyzeConversat { Language = "en-GB", Modality = InputModality.Text, - }), new ConversationActionContent("{project-name}", "{deployment-name}") + }), new ConversationLanguageUnderstandingActionContent("{project-name}", "{deployment-name}") { Verbose = true, IsLoggingEnabled = false, @@ -209,7 +209,7 @@ public async Task Example_Conversations_AnalyzeConversation_SuccessfulAnalyzeCon { Language = "en-GB", Modality = InputModality.Text, - }), new ConversationActionContent("{project-name}", "{deployment-name}") + }), new ConversationLanguageUnderstandingActionContent("{project-name}", "{deployment-name}") { Verbose = true, IsLoggingEnabled = false, @@ -325,7 +325,7 @@ public void Example_Conversations_AnalyzeConversation_SuccessfulAnalyzeConversat AzureKeyCredential credential = new AzureKeyCredential(""); ConversationAnalysisClient client = new ConversationAnalysisClient(endpoint, credential); - AnalyzeConversationInput analyzeConversationInput = new ConversationLanguageUnderstandingInput(new ConversationAnalysisInput(new TextConversationItem("1", "1", "Ports and connectors")), new ConversationActionContent("prj1", "dep1") + AnalyzeConversationInput analyzeConversationInput = new ConversationLanguageUnderstandingInput(new ConversationAnalysisInput(new TextConversationItem("1", "1", "Ports and connectors")), new ConversationLanguageUnderstandingActionContent("prj1", "dep1") { DirectTarget = "qnaProject", TargetProjectParameters = @@ -355,7 +355,7 @@ public async Task Example_Conversations_AnalyzeConversation_SuccessfulAnalyzeCon AzureKeyCredential credential = new AzureKeyCredential(""); ConversationAnalysisClient client = new ConversationAnalysisClient(endpoint, credential); - AnalyzeConversationInput analyzeConversationInput = new ConversationLanguageUnderstandingInput(new ConversationAnalysisInput(new TextConversationItem("1", "1", "Ports and connectors")), new ConversationActionContent("prj1", "dep1") + AnalyzeConversationInput analyzeConversationInput = new ConversationLanguageUnderstandingInput(new ConversationAnalysisInput(new TextConversationItem("1", "1", "Ports and connectors")), new ConversationLanguageUnderstandingActionContent("prj1", "dep1") { DirectTarget = "qnaProject", TargetProjectParameters = @@ -1183,7 +1183,7 @@ public void Example_Conversations_AnalyzeConversationSubmitOperation_SuccessfulC { new PiiOperationAction { -ActionContent = new PiiActionContent +ActionContent = new ConversationPiiActionContent { ModelVersion = "latest", PiiCategories = {ConversationPiiCategories.All}, @@ -1253,7 +1253,7 @@ public async Task Example_Conversations_AnalyzeConversationSubmitOperation_Succe { new PiiOperationAction { -ActionContent = new PiiActionContent +ActionContent = new ConversationPiiActionContent { ModelVersion = "latest", PiiCategories = {ConversationPiiCategories.All}, @@ -1501,7 +1501,7 @@ public void Example_Conversations_AnalyzeConversationSubmitOperation_SuccessfulC { new PiiOperationAction { -ActionContent = new PiiActionContent +ActionContent = new ConversationPiiActionContent { ModelVersion = "latest", PiiCategories = {ConversationPiiCategories.All}, @@ -1568,7 +1568,7 @@ public async Task Example_Conversations_AnalyzeConversationSubmitOperation_Succe { new PiiOperationAction { -ActionContent = new PiiActionContent +ActionContent = new ConversationPiiActionContent { ModelVersion = "latest", PiiCategories = {ConversationPiiCategories.All}, @@ -1805,7 +1805,7 @@ public void Example_Conversations_AnalyzeConversationSubmitOperation_SuccessfulC { new PiiOperationAction { -ActionContent = new PiiActionContent +ActionContent = new ConversationPiiActionContent { ModelVersion = "latest", RedactAudioTiming = true, @@ -1871,7 +1871,7 @@ public async Task Example_Conversations_AnalyzeConversationSubmitOperation_Succe { new PiiOperationAction { -ActionContent = new PiiActionContent +ActionContent = new ConversationPiiActionContent { ModelVersion = "latest", RedactAudioTiming = true, @@ -2115,7 +2115,7 @@ public void Example_Conversations_AnalyzeConversationSubmitOperation_SuccessfulC { new PiiOperationAction { -ActionContent = new PiiActionContent +ActionContent = new ConversationPiiActionContent { ModelVersion = "latest", PiiCategories = {ConversationPiiCategories.All}, @@ -2182,7 +2182,7 @@ public async Task Example_Conversations_AnalyzeConversationSubmitOperation_Succe { new PiiOperationAction { -ActionContent = new PiiActionContent +ActionContent = new ConversationPiiActionContent { ModelVersion = "latest", PiiCategories = {ConversationPiiCategories.All}, @@ -2421,7 +2421,7 @@ public void Example_Conversations_AnalyzeConversationSubmitOperation_SuccessfulC { new PiiOperationAction { -ActionContent = new PiiActionContent +ActionContent = new ConversationPiiActionContent { ModelVersion = "latest", PiiCategories = {ConversationPiiCategories.All}, @@ -2488,7 +2488,7 @@ public async Task Example_Conversations_AnalyzeConversationSubmitOperation_Succe { new PiiOperationAction { -ActionContent = new PiiActionContent +ActionContent = new ConversationPiiActionContent { ModelVersion = "latest", PiiCategories = {ConversationPiiCategories.All}, @@ -2725,7 +2725,7 @@ public void Example_Conversations_AnalyzeConversationSubmitOperation_SuccessfulC { new PiiOperationAction { -ActionContent = new PiiActionContent +ActionContent = new ConversationPiiActionContent { ModelVersion = "latest", PiiCategories = {ConversationPiiCategories.All}, @@ -2791,7 +2791,7 @@ public async Task Example_Conversations_AnalyzeConversationSubmitOperation_Succe { new PiiOperationAction { -ActionContent = new PiiActionContent +ActionContent = new ConversationPiiActionContent { ModelVersion = "latest", PiiCategories = {ConversationPiiCategories.All}, diff --git a/sdk/cognitivelanguage/Azure.AI.Language.Conversations/tsp-location.yaml b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/tsp-location.yaml index 8688a17d2239..ee690a9b1f05 100644 --- a/sdk/cognitivelanguage/Azure.AI.Language.Conversations/tsp-location.yaml +++ b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/tsp-location.yaml @@ -1,3 +1,3 @@ directory: specification/cognitiveservices/Language.Conversations -commit: 12f55505d123bc93fa51cf9d8ea6246d62e2a555 +commit: c9a4dc04527f7fdb4a944e2c392f2de280ef7cae repo: Azure/azure-rest-api-specs From 60723fdb7db8c29e9ef9096a40f71442067ce9c8 Mon Sep 17 00:00:00 2001 From: Xiong Chen Date: Mon, 27 Jan 2025 13:54:08 -0800 Subject: [PATCH 08/31] updated class name based on new commit id --- .../Sample1_AnalyzeConversation_ConversationPrediction.cs | 4 ++-- ...Sample2_AnalyzeConversation_OrchestrationPrediction.cs | 8 ++++---- .../Samples/Sample3_AnalyzeConversationWithOptions.cs | 4 ++-- .../Samples/Sample4_AnalyzeConversationWithLanguage.cs | 4 ++-- .../Sample5_AnalyzeConversation_ConversationPii.cs | 4 ++-- 5 files changed, 12 insertions(+), 12 deletions(-) diff --git a/sdk/cognitivelanguage/Azure.AI.Language.Conversations/tests/Samples/Sample1_AnalyzeConversation_ConversationPrediction.cs b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/tests/Samples/Sample1_AnalyzeConversation_ConversationPrediction.cs index 26d5b7034b82..28ef2e350169 100644 --- a/sdk/cognitivelanguage/Azure.AI.Language.Conversations/tests/Samples/Sample1_AnalyzeConversation_ConversationPrediction.cs +++ b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/tests/Samples/Sample1_AnalyzeConversation_ConversationPrediction.cs @@ -32,7 +32,7 @@ public void AnalyzeConversation() id: "1", participantId: "participant1", text: "Send an email to Carol about tomorrow's demo")), - new ConversationActionContent(projectName, deploymentName) + new ConversationLanguageUnderstandingActionContent(projectName, deploymentName) { // Use Utf16CodeUnit for strings in .NET. StringIndexType = StringIndexType.Utf16CodeUnit, @@ -96,7 +96,7 @@ public async Task AnalyzeConversationAsync() id: "1", participantId: "participant1", text: "Send an email to Carol about tomorrow's demo")), - new ConversationActionContent(projectName, deploymentName) + new ConversationLanguageUnderstandingActionContent(projectName, deploymentName) { StringIndexType = StringIndexType.Utf16CodeUnit, }); diff --git a/sdk/cognitivelanguage/Azure.AI.Language.Conversations/tests/Samples/Sample2_AnalyzeConversation_OrchestrationPrediction.cs b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/tests/Samples/Sample2_AnalyzeConversation_OrchestrationPrediction.cs index d732aebe7c91..6c57bbcf191d 100644 --- a/sdk/cognitivelanguage/Azure.AI.Language.Conversations/tests/Samples/Sample2_AnalyzeConversation_OrchestrationPrediction.cs +++ b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/tests/Samples/Sample2_AnalyzeConversation_OrchestrationPrediction.cs @@ -33,7 +33,7 @@ public void AnalyzeConversationOrchestrationPredictionQuestionAnswering() id: "1", participantId: "participant1", text: "How are you?")), - new ConversationActionContent(projectName, deploymentName) + new ConversationLanguageUnderstandingActionContent(projectName, deploymentName) { StringIndexType = StringIndexType.Utf16CodeUnit, }); @@ -77,7 +77,7 @@ public void AnalyzeConversationOrchestrationPredictionConversation() id: "1", participantId: "1", text: "How are you?")), - new ConversationActionContent(projectName, deploymentName) + new ConversationLanguageUnderstandingActionContent(projectName, deploymentName) { // Use Utf16CodeUnit for strings in .NET. StringIndexType = StringIndexType.Utf16CodeUnit, @@ -174,7 +174,7 @@ public async Task AnalyzeConversationOrchestrationPredictionQuestionAnsweringAsy id: "1", participantId: "1", text: "How are you?")), - new ConversationActionContent(projectName, deploymentName) + new ConversationLanguageUnderstandingActionContent(projectName, deploymentName) { // Use Utf16CodeUnit for strings in .NET. StringIndexType = StringIndexType.Utf16CodeUnit, @@ -215,7 +215,7 @@ public async Task AnalyzeConversationOrchestrationPredictionConversationAsync() id: "1", participantId: "1", text: "Send an email to Carol about tomorrow's demo")), - new ConversationActionContent(TestEnvironment.OrchestrationProjectName, TestEnvironment.OrchestrationDeploymentName) + new ConversationLanguageUnderstandingActionContent(TestEnvironment.OrchestrationProjectName, TestEnvironment.OrchestrationDeploymentName) { StringIndexType = StringIndexType.Utf16CodeUnit, }); diff --git a/sdk/cognitivelanguage/Azure.AI.Language.Conversations/tests/Samples/Sample3_AnalyzeConversationWithOptions.cs b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/tests/Samples/Sample3_AnalyzeConversationWithOptions.cs index ea62ec3f4f27..8cf35eecbb43 100644 --- a/sdk/cognitivelanguage/Azure.AI.Language.Conversations/tests/Samples/Sample3_AnalyzeConversationWithOptions.cs +++ b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/tests/Samples/Sample3_AnalyzeConversationWithOptions.cs @@ -32,7 +32,7 @@ public void AnalyzeConversationWithOptions() id: "1", participantId: "participant1", text: "Send an email to Carol about tomorrow's demo")), - new ConversationActionContent(projectName, deploymentName) + new ConversationLanguageUnderstandingActionContent(projectName, deploymentName) { // Use Utf16CodeUnit for strings in .NET. StringIndexType = StringIndexType.Utf16CodeUnit, @@ -97,7 +97,7 @@ public async Task AnalyzeConversationWithOptionsAsync() id: "1", participantId: "participant1", text: "Send an email to Carol about tomorrow's demo")), - new ConversationActionContent(projectName, deploymentName) + new ConversationLanguageUnderstandingActionContent(projectName, deploymentName) { // Use Utf16CodeUnit for strings in .NET. StringIndexType = StringIndexType.Utf16CodeUnit, diff --git a/sdk/cognitivelanguage/Azure.AI.Language.Conversations/tests/Samples/Sample4_AnalyzeConversationWithLanguage.cs b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/tests/Samples/Sample4_AnalyzeConversationWithLanguage.cs index 702001793893..ba2cdf218c44 100644 --- a/sdk/cognitivelanguage/Azure.AI.Language.Conversations/tests/Samples/Sample4_AnalyzeConversationWithLanguage.cs +++ b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/tests/Samples/Sample4_AnalyzeConversationWithLanguage.cs @@ -36,7 +36,7 @@ public void AnalyzeConversationWithLanguage() { Language = "es" }), - new ConversationActionContent(projectName, deploymentName) + new ConversationLanguageUnderstandingActionContent(projectName, deploymentName) { // Use Utf16CodeUnit for strings in .NET. StringIndexType = StringIndexType.Utf16CodeUnit, @@ -105,7 +105,7 @@ public async Task AnalyzeConversationWithLanguageAsync() { Language = "es" }), - new ConversationActionContent(projectName, deploymentName) + new ConversationLanguageUnderstandingActionContent(projectName, deploymentName) { // Use Utf16CodeUnit for strings in .NET. StringIndexType = StringIndexType.Utf16CodeUnit, diff --git a/sdk/cognitivelanguage/Azure.AI.Language.Conversations/tests/Samples/Sample5_AnalyzeConversation_ConversationPii.cs b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/tests/Samples/Sample5_AnalyzeConversation_ConversationPii.cs index 2d929365da9f..a63713e90bac 100644 --- a/sdk/cognitivelanguage/Azure.AI.Language.Conversations/tests/Samples/Sample5_AnalyzeConversation_ConversationPii.cs +++ b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/tests/Samples/Sample5_AnalyzeConversation_ConversationPii.cs @@ -35,7 +35,7 @@ public void AnalyzeConversation_ConversationPii() { new PiiOperationAction() { - ActionContent = new PiiActionContent(), + ActionContent = new ConversationPiiActionContent(), Name = "Conversation PII", } }; @@ -120,7 +120,7 @@ public async Task AnalyzeConversationAsync_ConversationPii() { new PiiOperationAction() { - ActionContent = new PiiActionContent(), + ActionContent = new ConversationPiiActionContent(), Name = "Conversation PII", } }; From e9c770f3f6a3b71fe8dca39f56a038cfce4debf0 Mon Sep 17 00:00:00 2001 From: Xiong Chen Date: Mon, 27 Jan 2025 14:13:03 -0800 Subject: [PATCH 09/31] updated the snippets --- .../Azure.AI.Language.Conversations/README.md | 10 +-- .../Azure.AI.Language.Conversations.net8.0.cs | 89 +++++++++---------- ...I.Language.Conversations.netstandard2.0.cs | 89 +++++++++---------- ...lyzeConversation_ConversationPrediction.md | 2 +- ...yzeConversation_OrchestrationPrediction.md | 2 +- ...Sample3_AnalyzeConversationWithLanguage.md | 2 +- .../Sample4_AnalyzeConversationWithOptions.md | 2 +- ...le8_AnalyzeConversation_ConversationPii.md | 2 +- 8 files changed, 98 insertions(+), 100 deletions(-) diff --git a/sdk/cognitivelanguage/Azure.AI.Language.Conversations/README.md b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/README.md index cd5413d372f6..b4c9ac591b90 100644 --- a/sdk/cognitivelanguage/Azure.AI.Language.Conversations/README.md +++ b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/README.md @@ -165,7 +165,7 @@ AnalyzeConversationInput data = new ConversationLanguageUnderstandingInput( id: "1", participantId: "participant1", text: "Send an email to Carol about tomorrow's demo")), - new ConversationActionContent(projectName, deploymentName) + new ConversationLanguageUnderstandingActionContent(projectName, deploymentName) { // Use Utf16CodeUnit for strings in .NET. StringIndexType = StringIndexType.Utf16CodeUnit, @@ -223,7 +223,7 @@ AnalyzeConversationInput data = new ConversationLanguageUnderstandingInput( id: "1", participantId: "participant1", text: "Send an email to Carol about tomorrow's demo")), - new ConversationActionContent(projectName, deploymentName) + new ConversationLanguageUnderstandingActionContent(projectName, deploymentName) { // Use Utf16CodeUnit for strings in .NET. StringIndexType = StringIndexType.Utf16CodeUnit, @@ -251,7 +251,7 @@ AnalyzeConversationInput data = { Language = "es" }), - new ConversationActionContent(projectName, deploymentName) + new ConversationLanguageUnderstandingActionContent(projectName, deploymentName) { // Use Utf16CodeUnit for strings in .NET. StringIndexType = StringIndexType.Utf16CodeUnit, @@ -275,7 +275,7 @@ AnalyzeConversationInput data = new ConversationLanguageUnderstandingInput( id: "1", participantId: "participant1", text: "How are you?")), - new ConversationActionContent(projectName, deploymentName) + new ConversationLanguageUnderstandingActionContent(projectName, deploymentName) { StringIndexType = StringIndexType.Utf16CodeUnit, }); @@ -426,7 +426,7 @@ List actions = new List targetProjectParameters = null) { throw null; } public static Azure.AI.Language.Conversations.Models.ConversationActionResult ConversationActionResult(Azure.AI.Language.Conversations.Models.AnalyzeConversationResult result = null) { throw null; } public static Azure.AI.Language.Conversations.Models.ConversationActions ConversationActions(int completed = 0, int failed = 0, int inProgress = 0, int total = 0, System.Collections.Generic.IEnumerable items = null) { throw null; } public static Azure.AI.Language.Conversations.Models.ConversationalPiiResult ConversationalPiiResult(string id = null, System.Collections.Generic.IEnumerable warnings = null, Azure.AI.Language.Conversations.Models.ConversationStatistics statistics = null, System.Collections.Generic.IEnumerable conversationItems = null) { throw null; } @@ -60,7 +59,8 @@ public static partial class ConversationsModelFactory public static Azure.AI.Language.Conversations.Models.ConversationError ConversationError(Azure.AI.Language.Conversations.Models.ConversationErrorCode code = default(Azure.AI.Language.Conversations.Models.ConversationErrorCode), string message = null, string target = null, System.Collections.Generic.IEnumerable details = null, Azure.AI.Language.Conversations.Models.InnerErrorModel innererror = null) { throw null; } public static Azure.AI.Language.Conversations.Models.ConversationInput ConversationInput(string id = null, string language = null, string modality = null, Azure.AI.Language.Conversations.Models.ConversationDomain? domain = default(Azure.AI.Language.Conversations.Models.ConversationDomain?)) { throw null; } public static Azure.AI.Language.Conversations.Models.ConversationIntent ConversationIntent(string category = null, float confidence = 0f) { throw null; } - public static Azure.AI.Language.Conversations.Models.ConversationLanguageUnderstandingInput ConversationLanguageUnderstandingInput(Azure.AI.Language.Conversations.Models.ConversationAnalysisInput conversationInput = null, Azure.AI.Language.Conversations.Models.ConversationActionContent actionContent = null) { throw null; } + public static Azure.AI.Language.Conversations.Models.ConversationLanguageUnderstandingActionContent ConversationLanguageUnderstandingActionContent(string projectName = null, string deploymentName = null, bool? verbose = default(bool?), bool? isLoggingEnabled = default(bool?), Azure.AI.Language.Conversations.Models.StringIndexType? stringIndexType = default(Azure.AI.Language.Conversations.Models.StringIndexType?), string directTarget = null, System.Collections.Generic.IDictionary targetProjectParameters = null) { throw null; } + public static Azure.AI.Language.Conversations.Models.ConversationLanguageUnderstandingInput ConversationLanguageUnderstandingInput(Azure.AI.Language.Conversations.Models.ConversationAnalysisInput conversationInput = null, Azure.AI.Language.Conversations.Models.ConversationLanguageUnderstandingActionContent actionContent = null) { throw null; } public static Azure.AI.Language.Conversations.Models.ConversationPiiItemResult ConversationPiiItemResult(string id = null, Azure.AI.Language.Conversations.Models.RedactedTranscriptContent redactedContent = null, System.Collections.Generic.IEnumerable entities = null) { throw null; } public static Azure.AI.Language.Conversations.Models.ConversationPiiOperationResult ConversationPiiOperationResult(System.DateTimeOffset lastUpdateDateTime = default(System.DateTimeOffset), Azure.AI.Language.Conversations.Models.ConversationActionState status = default(Azure.AI.Language.Conversations.Models.ConversationActionState), string name = null, Azure.AI.Language.Conversations.Models.ConversationPiiResults results = null) { throw null; } public static Azure.AI.Language.Conversations.Models.ConversationPiiResults ConversationPiiResults(System.Collections.Generic.IEnumerable errors = null, Azure.AI.Language.Conversations.Models.RequestStatistics statistics = null, string modelVersion = null, System.Collections.Generic.IEnumerable conversations = null) { throw null; } @@ -440,23 +440,6 @@ protected override void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter write string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } } - public partial class ConversationActionContent : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel - { - public ConversationActionContent(string projectName, string deploymentName) { } - public string DeploymentName { get { throw null; } } - public string DirectTarget { get { throw null; } set { } } - public bool? IsLoggingEnabled { get { throw null; } set { } } - public string ProjectName { get { throw null; } } - public Azure.AI.Language.Conversations.Models.StringIndexType? StringIndexType { get { throw null; } set { } } - public System.Collections.Generic.IDictionary TargetProjectParameters { get { throw null; } } - public bool? Verbose { get { throw null; } set { } } - protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } - Azure.AI.Language.Conversations.Models.ConversationActionContent System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } - void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } - Azure.AI.Language.Conversations.Models.ConversationActionContent System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } - string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } - System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } - } public partial class ConversationActionResult : Azure.AI.Language.Conversations.Models.AnalyzeConversationActionResult, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel { internal ConversationActionResult() { } @@ -687,10 +670,27 @@ protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } } + public partial class ConversationLanguageUnderstandingActionContent : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public ConversationLanguageUnderstandingActionContent(string projectName, string deploymentName) { } + public string DeploymentName { get { throw null; } } + public string DirectTarget { get { throw null; } set { } } + public bool? IsLoggingEnabled { get { throw null; } set { } } + public string ProjectName { get { throw null; } } + public Azure.AI.Language.Conversations.Models.StringIndexType? StringIndexType { get { throw null; } set { } } + public System.Collections.Generic.IDictionary TargetProjectParameters { get { throw null; } } + public bool? Verbose { get { throw null; } set { } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Language.Conversations.Models.ConversationLanguageUnderstandingActionContent System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Language.Conversations.Models.ConversationLanguageUnderstandingActionContent System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } public partial class ConversationLanguageUnderstandingInput : Azure.AI.Language.Conversations.Models.AnalyzeConversationInput, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel { - public ConversationLanguageUnderstandingInput(Azure.AI.Language.Conversations.Models.ConversationAnalysisInput conversationInput, Azure.AI.Language.Conversations.Models.ConversationActionContent actionContent) { } - public Azure.AI.Language.Conversations.Models.ConversationActionContent ActionContent { get { throw null; } } + public ConversationLanguageUnderstandingInput(Azure.AI.Language.Conversations.Models.ConversationAnalysisInput conversationInput, Azure.AI.Language.Conversations.Models.ConversationLanguageUnderstandingActionContent actionContent) { } + public Azure.AI.Language.Conversations.Models.ConversationLanguageUnderstandingActionContent ActionContent { get { throw null; } } public Azure.AI.Language.Conversations.Models.ConversationAnalysisInput ConversationInput { get { throw null; } } protected override void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.AI.Language.Conversations.Models.ConversationLanguageUnderstandingInput System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } @@ -699,6 +699,24 @@ protected override void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter write string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } } + public partial class ConversationPiiActionContent : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public ConversationPiiActionContent() { } + public System.Collections.Generic.IList ExcludePiiCategories { get { throw null; } } + public bool? LoggingOptOut { get { throw null; } set { } } + public string ModelVersion { get { throw null; } set { } } + public System.Collections.Generic.IList PiiCategories { get { throw null; } } + public bool? RedactAudioTiming { get { throw null; } set { } } + public Azure.AI.Language.Conversations.Models.RedactionCharacter? RedactionCharacter { get { throw null; } set { } } + public Azure.AI.Language.Conversations.Models.BaseRedactionPolicy RedactionPolicy { get { throw null; } set { } } + public Azure.AI.Language.Conversations.Models.TranscriptContentType? RedactionSource { get { throw null; } set { } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Language.Conversations.Models.ConversationPiiActionContent System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Language.Conversations.Models.ConversationPiiActionContent System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] public readonly partial struct ConversationPiiCategories : System.IEquatable { @@ -707,13 +725,12 @@ protected override void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter write public ConversationPiiCategories(string value) { throw null; } public static Azure.AI.Language.Conversations.Models.ConversationPiiCategories Address { get { throw null; } } public static Azure.AI.Language.Conversations.Models.ConversationPiiCategories All { get { throw null; } } - public static Azure.AI.Language.Conversations.Models.ConversationPiiCategories CreditCardNumber { get { throw null; } } + public static Azure.AI.Language.Conversations.Models.ConversationPiiCategories CreditCard { get { throw null; } } public static Azure.AI.Language.Conversations.Models.ConversationPiiCategories Default { get { throw null; } } public static Azure.AI.Language.Conversations.Models.ConversationPiiCategories Email { get { throw null; } } - public static Azure.AI.Language.Conversations.Models.ConversationPiiCategories Miscellaneous { get { throw null; } } public static Azure.AI.Language.Conversations.Models.ConversationPiiCategories NumericIdentifier { get { throw null; } } public static Azure.AI.Language.Conversations.Models.ConversationPiiCategories Person { get { throw null; } } - public static Azure.AI.Language.Conversations.Models.ConversationPiiCategories PhoneNumber { get { throw null; } } + public static Azure.AI.Language.Conversations.Models.ConversationPiiCategories Phone { get { throw null; } } public static Azure.AI.Language.Conversations.Models.ConversationPiiCategories UsSocialSecurityNumber { get { throw null; } } public bool Equals(Azure.AI.Language.Conversations.Models.ConversationPiiCategories other) { throw null; } [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] @@ -732,11 +749,11 @@ protected override void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter write private readonly int _dummyPrimitive; public ConversationPiiCategoryExclusions(string value) { throw null; } public static Azure.AI.Language.Conversations.Models.ConversationPiiCategoryExclusions Address { get { throw null; } } - public static Azure.AI.Language.Conversations.Models.ConversationPiiCategoryExclusions CreditCardNumber { get { throw null; } } + public static Azure.AI.Language.Conversations.Models.ConversationPiiCategoryExclusions CreditCard { get { throw null; } } public static Azure.AI.Language.Conversations.Models.ConversationPiiCategoryExclusions Email { get { throw null; } } public static Azure.AI.Language.Conversations.Models.ConversationPiiCategoryExclusions NumericIdentifier { get { throw null; } } public static Azure.AI.Language.Conversations.Models.ConversationPiiCategoryExclusions Person { get { throw null; } } - public static Azure.AI.Language.Conversations.Models.ConversationPiiCategoryExclusions PhoneNumber { get { throw null; } } + public static Azure.AI.Language.Conversations.Models.ConversationPiiCategoryExclusions Phone { get { throw null; } } public static Azure.AI.Language.Conversations.Models.ConversationPiiCategoryExclusions UsSocialSecurityNumber { get { throw null; } } public bool Equals(Azure.AI.Language.Conversations.Models.ConversationPiiCategoryExclusions other) { throw null; } [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] @@ -1503,28 +1520,10 @@ protected override void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter write public static bool operator !=(Azure.AI.Language.Conversations.Models.ParticipantRole left, Azure.AI.Language.Conversations.Models.ParticipantRole right) { throw null; } public override string ToString() { throw null; } } - public partial class PiiActionContent : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel - { - public PiiActionContent() { } - public System.Collections.Generic.IList ExcludePiiCategories { get { throw null; } } - public bool? LoggingOptOut { get { throw null; } set { } } - public string ModelVersion { get { throw null; } set { } } - public System.Collections.Generic.IList PiiCategories { get { throw null; } } - public bool? RedactAudioTiming { get { throw null; } set { } } - public Azure.AI.Language.Conversations.Models.RedactionCharacter? RedactionCharacter { get { throw null; } set { } } - public Azure.AI.Language.Conversations.Models.BaseRedactionPolicy RedactionPolicy { get { throw null; } set { } } - public Azure.AI.Language.Conversations.Models.TranscriptContentType? RedactionSource { get { throw null; } set { } } - protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } - Azure.AI.Language.Conversations.Models.PiiActionContent System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } - void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } - Azure.AI.Language.Conversations.Models.PiiActionContent System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } - string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } - System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } - } public partial class PiiOperationAction : Azure.AI.Language.Conversations.Models.AnalyzeConversationOperationAction, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel { public PiiOperationAction() { } - public Azure.AI.Language.Conversations.Models.PiiActionContent ActionContent { get { throw null; } set { } } + public Azure.AI.Language.Conversations.Models.ConversationPiiActionContent ActionContent { get { throw null; } set { } } protected override void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.AI.Language.Conversations.Models.PiiOperationAction System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } diff --git a/sdk/cognitivelanguage/Azure.AI.Language.Conversations/api/Azure.AI.Language.Conversations.netstandard2.0.cs b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/api/Azure.AI.Language.Conversations.netstandard2.0.cs index 52ca0e8836a6..b5187574dcd9 100644 --- a/sdk/cognitivelanguage/Azure.AI.Language.Conversations/api/Azure.AI.Language.Conversations.netstandard2.0.cs +++ b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/api/Azure.AI.Language.Conversations.netstandard2.0.cs @@ -52,7 +52,6 @@ public static partial class ConversationsModelFactory public static Azure.AI.Language.Conversations.Models.AreaResolution AreaResolution(double value = 0, Azure.AI.Language.Conversations.Models.AreaUnit unit = default(Azure.AI.Language.Conversations.Models.AreaUnit)) { throw null; } public static Azure.AI.Language.Conversations.Models.AudioTiming AudioTiming(long? offset = default(long?), long? duration = default(long?)) { throw null; } public static Azure.AI.Language.Conversations.Models.BooleanResolution BooleanResolution(bool value = false) { throw null; } - public static Azure.AI.Language.Conversations.Models.ConversationActionContent ConversationActionContent(string projectName = null, string deploymentName = null, bool? verbose = default(bool?), bool? isLoggingEnabled = default(bool?), Azure.AI.Language.Conversations.Models.StringIndexType? stringIndexType = default(Azure.AI.Language.Conversations.Models.StringIndexType?), string directTarget = null, System.Collections.Generic.IDictionary targetProjectParameters = null) { throw null; } public static Azure.AI.Language.Conversations.Models.ConversationActionResult ConversationActionResult(Azure.AI.Language.Conversations.Models.AnalyzeConversationResult result = null) { throw null; } public static Azure.AI.Language.Conversations.Models.ConversationActions ConversationActions(int completed = 0, int failed = 0, int inProgress = 0, int total = 0, System.Collections.Generic.IEnumerable items = null) { throw null; } public static Azure.AI.Language.Conversations.Models.ConversationalPiiResult ConversationalPiiResult(string id = null, System.Collections.Generic.IEnumerable warnings = null, Azure.AI.Language.Conversations.Models.ConversationStatistics statistics = null, System.Collections.Generic.IEnumerable conversationItems = null) { throw null; } @@ -60,7 +59,8 @@ public static partial class ConversationsModelFactory public static Azure.AI.Language.Conversations.Models.ConversationError ConversationError(Azure.AI.Language.Conversations.Models.ConversationErrorCode code = default(Azure.AI.Language.Conversations.Models.ConversationErrorCode), string message = null, string target = null, System.Collections.Generic.IEnumerable details = null, Azure.AI.Language.Conversations.Models.InnerErrorModel innererror = null) { throw null; } public static Azure.AI.Language.Conversations.Models.ConversationInput ConversationInput(string id = null, string language = null, string modality = null, Azure.AI.Language.Conversations.Models.ConversationDomain? domain = default(Azure.AI.Language.Conversations.Models.ConversationDomain?)) { throw null; } public static Azure.AI.Language.Conversations.Models.ConversationIntent ConversationIntent(string category = null, float confidence = 0f) { throw null; } - public static Azure.AI.Language.Conversations.Models.ConversationLanguageUnderstandingInput ConversationLanguageUnderstandingInput(Azure.AI.Language.Conversations.Models.ConversationAnalysisInput conversationInput = null, Azure.AI.Language.Conversations.Models.ConversationActionContent actionContent = null) { throw null; } + public static Azure.AI.Language.Conversations.Models.ConversationLanguageUnderstandingActionContent ConversationLanguageUnderstandingActionContent(string projectName = null, string deploymentName = null, bool? verbose = default(bool?), bool? isLoggingEnabled = default(bool?), Azure.AI.Language.Conversations.Models.StringIndexType? stringIndexType = default(Azure.AI.Language.Conversations.Models.StringIndexType?), string directTarget = null, System.Collections.Generic.IDictionary targetProjectParameters = null) { throw null; } + public static Azure.AI.Language.Conversations.Models.ConversationLanguageUnderstandingInput ConversationLanguageUnderstandingInput(Azure.AI.Language.Conversations.Models.ConversationAnalysisInput conversationInput = null, Azure.AI.Language.Conversations.Models.ConversationLanguageUnderstandingActionContent actionContent = null) { throw null; } public static Azure.AI.Language.Conversations.Models.ConversationPiiItemResult ConversationPiiItemResult(string id = null, Azure.AI.Language.Conversations.Models.RedactedTranscriptContent redactedContent = null, System.Collections.Generic.IEnumerable entities = null) { throw null; } public static Azure.AI.Language.Conversations.Models.ConversationPiiOperationResult ConversationPiiOperationResult(System.DateTimeOffset lastUpdateDateTime = default(System.DateTimeOffset), Azure.AI.Language.Conversations.Models.ConversationActionState status = default(Azure.AI.Language.Conversations.Models.ConversationActionState), string name = null, Azure.AI.Language.Conversations.Models.ConversationPiiResults results = null) { throw null; } public static Azure.AI.Language.Conversations.Models.ConversationPiiResults ConversationPiiResults(System.Collections.Generic.IEnumerable errors = null, Azure.AI.Language.Conversations.Models.RequestStatistics statistics = null, string modelVersion = null, System.Collections.Generic.IEnumerable conversations = null) { throw null; } @@ -440,23 +440,6 @@ protected override void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter write string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } } - public partial class ConversationActionContent : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel - { - public ConversationActionContent(string projectName, string deploymentName) { } - public string DeploymentName { get { throw null; } } - public string DirectTarget { get { throw null; } set { } } - public bool? IsLoggingEnabled { get { throw null; } set { } } - public string ProjectName { get { throw null; } } - public Azure.AI.Language.Conversations.Models.StringIndexType? StringIndexType { get { throw null; } set { } } - public System.Collections.Generic.IDictionary TargetProjectParameters { get { throw null; } } - public bool? Verbose { get { throw null; } set { } } - protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } - Azure.AI.Language.Conversations.Models.ConversationActionContent System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } - void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } - Azure.AI.Language.Conversations.Models.ConversationActionContent System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } - string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } - System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } - } public partial class ConversationActionResult : Azure.AI.Language.Conversations.Models.AnalyzeConversationActionResult, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel { internal ConversationActionResult() { } @@ -687,10 +670,27 @@ protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } } + public partial class ConversationLanguageUnderstandingActionContent : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public ConversationLanguageUnderstandingActionContent(string projectName, string deploymentName) { } + public string DeploymentName { get { throw null; } } + public string DirectTarget { get { throw null; } set { } } + public bool? IsLoggingEnabled { get { throw null; } set { } } + public string ProjectName { get { throw null; } } + public Azure.AI.Language.Conversations.Models.StringIndexType? StringIndexType { get { throw null; } set { } } + public System.Collections.Generic.IDictionary TargetProjectParameters { get { throw null; } } + public bool? Verbose { get { throw null; } set { } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Language.Conversations.Models.ConversationLanguageUnderstandingActionContent System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Language.Conversations.Models.ConversationLanguageUnderstandingActionContent System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } public partial class ConversationLanguageUnderstandingInput : Azure.AI.Language.Conversations.Models.AnalyzeConversationInput, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel { - public ConversationLanguageUnderstandingInput(Azure.AI.Language.Conversations.Models.ConversationAnalysisInput conversationInput, Azure.AI.Language.Conversations.Models.ConversationActionContent actionContent) { } - public Azure.AI.Language.Conversations.Models.ConversationActionContent ActionContent { get { throw null; } } + public ConversationLanguageUnderstandingInput(Azure.AI.Language.Conversations.Models.ConversationAnalysisInput conversationInput, Azure.AI.Language.Conversations.Models.ConversationLanguageUnderstandingActionContent actionContent) { } + public Azure.AI.Language.Conversations.Models.ConversationLanguageUnderstandingActionContent ActionContent { get { throw null; } } public Azure.AI.Language.Conversations.Models.ConversationAnalysisInput ConversationInput { get { throw null; } } protected override void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.AI.Language.Conversations.Models.ConversationLanguageUnderstandingInput System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } @@ -699,6 +699,24 @@ protected override void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter write string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } } + public partial class ConversationPiiActionContent : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public ConversationPiiActionContent() { } + public System.Collections.Generic.IList ExcludePiiCategories { get { throw null; } } + public bool? LoggingOptOut { get { throw null; } set { } } + public string ModelVersion { get { throw null; } set { } } + public System.Collections.Generic.IList PiiCategories { get { throw null; } } + public bool? RedactAudioTiming { get { throw null; } set { } } + public Azure.AI.Language.Conversations.Models.RedactionCharacter? RedactionCharacter { get { throw null; } set { } } + public Azure.AI.Language.Conversations.Models.BaseRedactionPolicy RedactionPolicy { get { throw null; } set { } } + public Azure.AI.Language.Conversations.Models.TranscriptContentType? RedactionSource { get { throw null; } set { } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Language.Conversations.Models.ConversationPiiActionContent System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Language.Conversations.Models.ConversationPiiActionContent System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] public readonly partial struct ConversationPiiCategories : System.IEquatable { @@ -707,13 +725,12 @@ protected override void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter write public ConversationPiiCategories(string value) { throw null; } public static Azure.AI.Language.Conversations.Models.ConversationPiiCategories Address { get { throw null; } } public static Azure.AI.Language.Conversations.Models.ConversationPiiCategories All { get { throw null; } } - public static Azure.AI.Language.Conversations.Models.ConversationPiiCategories CreditCardNumber { get { throw null; } } + public static Azure.AI.Language.Conversations.Models.ConversationPiiCategories CreditCard { get { throw null; } } public static Azure.AI.Language.Conversations.Models.ConversationPiiCategories Default { get { throw null; } } public static Azure.AI.Language.Conversations.Models.ConversationPiiCategories Email { get { throw null; } } - public static Azure.AI.Language.Conversations.Models.ConversationPiiCategories Miscellaneous { get { throw null; } } public static Azure.AI.Language.Conversations.Models.ConversationPiiCategories NumericIdentifier { get { throw null; } } public static Azure.AI.Language.Conversations.Models.ConversationPiiCategories Person { get { throw null; } } - public static Azure.AI.Language.Conversations.Models.ConversationPiiCategories PhoneNumber { get { throw null; } } + public static Azure.AI.Language.Conversations.Models.ConversationPiiCategories Phone { get { throw null; } } public static Azure.AI.Language.Conversations.Models.ConversationPiiCategories UsSocialSecurityNumber { get { throw null; } } public bool Equals(Azure.AI.Language.Conversations.Models.ConversationPiiCategories other) { throw null; } [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] @@ -732,11 +749,11 @@ protected override void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter write private readonly int _dummyPrimitive; public ConversationPiiCategoryExclusions(string value) { throw null; } public static Azure.AI.Language.Conversations.Models.ConversationPiiCategoryExclusions Address { get { throw null; } } - public static Azure.AI.Language.Conversations.Models.ConversationPiiCategoryExclusions CreditCardNumber { get { throw null; } } + public static Azure.AI.Language.Conversations.Models.ConversationPiiCategoryExclusions CreditCard { get { throw null; } } public static Azure.AI.Language.Conversations.Models.ConversationPiiCategoryExclusions Email { get { throw null; } } public static Azure.AI.Language.Conversations.Models.ConversationPiiCategoryExclusions NumericIdentifier { get { throw null; } } public static Azure.AI.Language.Conversations.Models.ConversationPiiCategoryExclusions Person { get { throw null; } } - public static Azure.AI.Language.Conversations.Models.ConversationPiiCategoryExclusions PhoneNumber { get { throw null; } } + public static Azure.AI.Language.Conversations.Models.ConversationPiiCategoryExclusions Phone { get { throw null; } } public static Azure.AI.Language.Conversations.Models.ConversationPiiCategoryExclusions UsSocialSecurityNumber { get { throw null; } } public bool Equals(Azure.AI.Language.Conversations.Models.ConversationPiiCategoryExclusions other) { throw null; } [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] @@ -1503,28 +1520,10 @@ protected override void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter write public static bool operator !=(Azure.AI.Language.Conversations.Models.ParticipantRole left, Azure.AI.Language.Conversations.Models.ParticipantRole right) { throw null; } public override string ToString() { throw null; } } - public partial class PiiActionContent : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel - { - public PiiActionContent() { } - public System.Collections.Generic.IList ExcludePiiCategories { get { throw null; } } - public bool? LoggingOptOut { get { throw null; } set { } } - public string ModelVersion { get { throw null; } set { } } - public System.Collections.Generic.IList PiiCategories { get { throw null; } } - public bool? RedactAudioTiming { get { throw null; } set { } } - public Azure.AI.Language.Conversations.Models.RedactionCharacter? RedactionCharacter { get { throw null; } set { } } - public Azure.AI.Language.Conversations.Models.BaseRedactionPolicy RedactionPolicy { get { throw null; } set { } } - public Azure.AI.Language.Conversations.Models.TranscriptContentType? RedactionSource { get { throw null; } set { } } - protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } - Azure.AI.Language.Conversations.Models.PiiActionContent System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } - void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } - Azure.AI.Language.Conversations.Models.PiiActionContent System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } - string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } - System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } - } public partial class PiiOperationAction : Azure.AI.Language.Conversations.Models.AnalyzeConversationOperationAction, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel { public PiiOperationAction() { } - public Azure.AI.Language.Conversations.Models.PiiActionContent ActionContent { get { throw null; } set { } } + public Azure.AI.Language.Conversations.Models.ConversationPiiActionContent ActionContent { get { throw null; } set { } } protected override void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.AI.Language.Conversations.Models.PiiOperationAction System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } diff --git a/sdk/cognitivelanguage/Azure.AI.Language.Conversations/samples/Sample1_AnalyzeConversation_ConversationPrediction.md b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/samples/Sample1_AnalyzeConversation_ConversationPrediction.md index 556d681b87ef..360527108ea0 100644 --- a/sdk/cognitivelanguage/Azure.AI.Language.Conversations/samples/Sample1_AnalyzeConversation_ConversationPrediction.md +++ b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/samples/Sample1_AnalyzeConversation_ConversationPrediction.md @@ -35,7 +35,7 @@ AnalyzeConversationInput data = new ConversationLanguageUnderstandingInput( id: "1", participantId: "participant1", text: "Send an email to Carol about tomorrow's demo")), - new ConversationActionContent(projectName, deploymentName) + new ConversationLanguageUnderstandingActionContent(projectName, deploymentName) { // Use Utf16CodeUnit for strings in .NET. StringIndexType = StringIndexType.Utf16CodeUnit, diff --git a/sdk/cognitivelanguage/Azure.AI.Language.Conversations/samples/Sample2_AnalyzeConversation_OrchestrationPrediction.md b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/samples/Sample2_AnalyzeConversation_OrchestrationPrediction.md index ea7a398981ba..caa27ca1ee75 100644 --- a/sdk/cognitivelanguage/Azure.AI.Language.Conversations/samples/Sample2_AnalyzeConversation_OrchestrationPrediction.md +++ b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/samples/Sample2_AnalyzeConversation_OrchestrationPrediction.md @@ -34,7 +34,7 @@ AnalyzeConversationInput data = new ConversationLanguageUnderstandingInput( id: "1", participantId: "participant1", text: "How are you?")), - new ConversationActionContent(projectName, deploymentName) + new ConversationLanguageUnderstandingActionContent(projectName, deploymentName) { StringIndexType = StringIndexType.Utf16CodeUnit, }); diff --git a/sdk/cognitivelanguage/Azure.AI.Language.Conversations/samples/Sample3_AnalyzeConversationWithLanguage.md b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/samples/Sample3_AnalyzeConversationWithLanguage.md index 79b8273fcbf7..31ab6ebdfd82 100644 --- a/sdk/cognitivelanguage/Azure.AI.Language.Conversations/samples/Sample3_AnalyzeConversationWithLanguage.md +++ b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/samples/Sample3_AnalyzeConversationWithLanguage.md @@ -39,7 +39,7 @@ AnalyzeConversationInput data = { Language = "es" }), - new ConversationActionContent(projectName, deploymentName) + new ConversationLanguageUnderstandingActionContent(projectName, deploymentName) { // Use Utf16CodeUnit for strings in .NET. StringIndexType = StringIndexType.Utf16CodeUnit, diff --git a/sdk/cognitivelanguage/Azure.AI.Language.Conversations/samples/Sample4_AnalyzeConversationWithOptions.md b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/samples/Sample4_AnalyzeConversationWithOptions.md index 338aface5b04..04b27eabe7de 100644 --- a/sdk/cognitivelanguage/Azure.AI.Language.Conversations/samples/Sample4_AnalyzeConversationWithOptions.md +++ b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/samples/Sample4_AnalyzeConversationWithOptions.md @@ -35,7 +35,7 @@ AnalyzeConversationInput data = new ConversationLanguageUnderstandingInput( id: "1", participantId: "participant1", text: "Send an email to Carol about tomorrow's demo")), - new ConversationActionContent(projectName, deploymentName) + new ConversationLanguageUnderstandingActionContent(projectName, deploymentName) { // Use Utf16CodeUnit for strings in .NET. StringIndexType = StringIndexType.Utf16CodeUnit, diff --git a/sdk/cognitivelanguage/Azure.AI.Language.Conversations/samples/Sample8_AnalyzeConversation_ConversationPii.md b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/samples/Sample8_AnalyzeConversation_ConversationPii.md index 3c8860221250..666773152f58 100644 --- a/sdk/cognitivelanguage/Azure.AI.Language.Conversations/samples/Sample8_AnalyzeConversation_ConversationPii.md +++ b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/samples/Sample8_AnalyzeConversation_ConversationPii.md @@ -38,7 +38,7 @@ List actions = new List Date: Tue, 28 Jan 2025 13:45:16 -0800 Subject: [PATCH 10/31] add one more version 2024-11-01 in TestBase and add test for ConversationPiiWithCharacterMask --- .../tests/ConversationsClientLiveTests.cs | 97 ++++++++++++++ .../ConversationAnalysisTestBase.cs | 1 + ...ation_ConversationPiiWithMaskPolicyType.cs | 120 ++++++++++++++++++ 3 files changed, 218 insertions(+) create mode 100644 sdk/cognitivelanguage/Azure.AI.Language.Conversations/tests/Samples/Sample7_AnalyzeConversation_ConversationPiiWithMaskPolicyType.cs diff --git a/sdk/cognitivelanguage/Azure.AI.Language.Conversations/tests/ConversationsClientLiveTests.cs b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/tests/ConversationsClientLiveTests.cs index 6caf207cc0fd..70b8f0e2a90e 100644 --- a/sdk/cognitivelanguage/Azure.AI.Language.Conversations/tests/ConversationsClientLiveTests.cs +++ b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/tests/ConversationsClientLiveTests.cs @@ -322,5 +322,102 @@ public async Task AnalyzeConversation_ConversationSummarization() } } } + + [RecordedTest] + [ServiceVersion(Min = ConversationsClientOptions.ServiceVersion.V2024_05_01)] + public async Task AnalyzeConversation_ConversationPii_WithCharacterMaskPolicy() + { + List entitiesDetected = new(); + // Create a CharacterMaskPolicyType with a custom masking character + var redactionPolicy = new CharacterMaskPolicyType + { + RedactionCharacter = RedactionCharacter.Asterisk + }; + + // Simulate input conversation + MultiLanguageConversationInput input = new MultiLanguageConversationInput( + new List + { + new TextConversation("1", "en", new List + { + new TextConversationItem(id: "1", participantId: "Agent_1", text: "Can you provide your name?"), + new TextConversationItem(id: "2", participantId: "Customer_1", text: "Hi, my name is John Doe."), + new TextConversationItem(id: "3", participantId: "Agent_1", text: "Thank you John, that has been updated in our system.") + }) + }); + + // Add action with CharacterMaskPolicyType + List actions = new List + { + new PiiOperationAction + { + ActionContent = new ConversationPiiActionContent + { + RedactionPolicy = redactionPolicy + }, + Name = "Conversation PII with Character Mask Policy" + } + }; + + AnalyzeConversationOperationInput data = new AnalyzeConversationOperationInput(input, actions); + + Response analyzeConversationOperation = await Client.AnalyzeConversationsAsync(data); + Assert.NotNull(analyzeConversationOperation); + + AnalyzeConversationOperationState operationState = analyzeConversationOperation.Value; + foreach (AnalyzeConversationOperationResult operationResult in operationState.Actions.Items) + { + Console.WriteLine($"Operation action name: {operationResult.Name}"); + + if (operationResult is ConversationPiiOperationResult piiOperationResult) + { + foreach (ConversationalPiiResult conversation in piiOperationResult.Results.Conversations) + { + Console.WriteLine($"Conversation: #{conversation.Id}"); + Console.WriteLine("Detected Entities:"); + foreach (ConversationPiiItemResult item in conversation.ConversationItems) + { + foreach (NamedEntity entity in item.Entities) + { + Console.WriteLine($"Category: {entity.Category}"); + Console.WriteLine($"Subcategory: {entity.Subcategory}"); + Console.WriteLine($"Text: {entity.Text}"); + Console.WriteLine($"Offset: {entity.Offset}"); + Console.WriteLine($"Length: {entity.Length}"); + Console.WriteLine($"Confidence score: {entity.ConfidenceScore}"); + Console.WriteLine(); + + // Verify the redacted text uses the '*' character + Assert.That(entity.Text, Does.Not.Contain("John")); // Original text should be redacted + Assert.That(entity.Text, Does.Contain("*")); // Redacted text should contain the mask character + + entitiesDetected.Add(entity); + } + } + if (conversation.Warnings != null && conversation.Warnings.Any()) + { + Console.WriteLine("Warnings:"); + foreach (InputWarning warning in conversation.Warnings) + { + Console.WriteLine($"Code: {warning.Code}"); + Console.WriteLine($"Message: {warning.Message}"); + } + } + Console.WriteLine(); + } + } + if (operationState.Errors != null && operationState.Errors.Any()) + { + Console.WriteLine("Errors:"); + foreach (ConversationError error in operationState.Errors) + { + Console.WriteLine($"Error: {error.Code} - {error}"); + } + } + } + + Assert.NotZero(entitiesDetected.Count); + Assert.That(analyzeConversationOperation.GetRawResponse().Status, Is.EqualTo(200)); + } } } diff --git a/sdk/cognitivelanguage/Azure.AI.Language.Conversations/tests/Infrastructure/ConversationAnalysisTestBase.cs b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/tests/Infrastructure/ConversationAnalysisTestBase.cs index d0df1d8b64b1..638dba436961 100644 --- a/sdk/cognitivelanguage/Azure.AI.Language.Conversations/tests/Infrastructure/ConversationAnalysisTestBase.cs +++ b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/tests/Infrastructure/ConversationAnalysisTestBase.cs @@ -11,6 +11,7 @@ namespace Azure.AI.Language.Conversations.Tests /// /// The type of client being tested. [ClientTestFixture( + ConversationsClientOptions.ServiceVersion.V2024_11_01, ConversationsClientOptions.ServiceVersion.V2024_05_01, ConversationsClientOptions.ServiceVersion.V2023_04_01, ConversationsClientOptions.ServiceVersion.V2022_05_01)] diff --git a/sdk/cognitivelanguage/Azure.AI.Language.Conversations/tests/Samples/Sample7_AnalyzeConversation_ConversationPiiWithMaskPolicyType.cs b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/tests/Samples/Sample7_AnalyzeConversation_ConversationPiiWithMaskPolicyType.cs new file mode 100644 index 000000000000..38bf6cf170a4 --- /dev/null +++ b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/tests/Samples/Sample7_AnalyzeConversation_ConversationPiiWithMaskPolicyType.cs @@ -0,0 +1,120 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; +using Azure.AI.Language.Conversations.Models; +using Azure.Core.TestFramework; +using NUnit.Framework; + +namespace Azure.AI.Language.Conversations.Tests.Samples +{ + public partial class ConversationAnalysisClientSamples + { + [SyncOnly] + [RecordedTest] + [ServiceVersion(Min = ConversationsClientOptions.ServiceVersion.V2024_05_01)] + public void AnalyzeConversation_ConversationPii_WithCharacterMaskPolicy() + { + // Arrange: Initialize client and input + ConversationAnalysisClient client = Client; + List entitiesDetected = new(); + + // Create a CharacterMaskPolicyType with a custom masking character + var redactionPolicy = new CharacterMaskPolicyType + { + RedactionCharacter = RedactionCharacter.Asterisk + }; + + // Simulate input conversation + MultiLanguageConversationInput input = new MultiLanguageConversationInput( + new List + { + new TextConversation("1", "en", new List + { + new TextConversationItem(id: "1", participantId: "Agent_1", text: "Can you provide your name?"), + new TextConversationItem(id: "2", participantId: "Customer_1", text: "Hi, my name is John Doe."), + new TextConversationItem(id: "3", participantId: "Agent_1", text: "Thank you John, that has been updated in our system.") + }) + }); + + // Add action with CharacterMaskPolicyType + List actions = new List + { + new PiiOperationAction + { + ActionContent = new ConversationPiiActionContent + { + RedactionPolicy = redactionPolicy + }, + Name = "Conversation PII with Character Mask Policy" + } + }; + + // Create input for analysis + AnalyzeConversationOperationInput data = new AnalyzeConversationOperationInput(input, actions); + + // Act: Perform the PII analysis + Response analyzeConversationOperation = client.AnalyzeConversations(data); + #region Snippet:AnalyzeConversation_ConversationPiiSync + AnalyzeConversationOperationState operationState = analyzeConversationOperation.Value; + #endregion + foreach (AnalyzeConversationOperationResult operationResult in operationState.Actions.Items) + { + Console.WriteLine($"Operation action name: {operationResult.Name}"); + + if (operationResult is ConversationPiiOperationResult piiOperationResult) + { + foreach (ConversationalPiiResult conversation in piiOperationResult.Results.Conversations) + { + Console.WriteLine($"Conversation: #{conversation.Id}"); + Console.WriteLine("Detected Entities:"); + foreach (ConversationPiiItemResult item in conversation.ConversationItems) + { + foreach (NamedEntity entity in item.Entities) + { + Console.WriteLine($"Category: {entity.Category}"); + Console.WriteLine($"Subcategory: {entity.Subcategory}"); + Console.WriteLine($"Text: {entity.Text}"); + Console.WriteLine($"Offset: {entity.Offset}"); + Console.WriteLine($"Length: {entity.Length}"); + Console.WriteLine($"Confidence score: {entity.ConfidenceScore}"); + Console.WriteLine(); + + // Verify the redacted text uses the '*' character + //Assert.That(entity.Text, Does.Not.Contain("John")); // Original text should be redacted + Assert.That(entity.Text, Does.Contain("*")); // Redacted text should contain the mask character +#if !SNIPPET + entitiesDetected.Add(entity); +#endif + } + } + if (conversation.Warnings != null && conversation.Warnings.Any()) + { + Console.WriteLine("Warnings:"); + foreach (InputWarning warning in conversation.Warnings) + { + Console.WriteLine($"Code: {warning.Code}"); + Console.WriteLine($"Message: {warning.Message}"); + } + } + Console.WriteLine(); + } + } + if (operationState.Errors != null && operationState.Errors.Any()) + { + Console.WriteLine("Errors:"); + foreach (ConversationError error in operationState.Errors) + { + Console.WriteLine($"Error: {error.Code} - {error}"); + } + } + } + + Assert.NotZero(entitiesDetected.Count); + Assert.That(analyzeConversationOperation.GetRawResponse().Status, Is.EqualTo(200)); + } + } +} From 642d2a5946f88d1eeec5bc3be879f9596f799af9 Mon Sep 17 00:00:00 2001 From: Xiong Chen Date: Tue, 28 Jan 2025 13:54:34 -0800 Subject: [PATCH 11/31] -adjust the version to 2024-11-01 in the test --- ...le7_AnalyzeConversation_ConversationPiiWithMaskPolicyType.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sdk/cognitivelanguage/Azure.AI.Language.Conversations/tests/Samples/Sample7_AnalyzeConversation_ConversationPiiWithMaskPolicyType.cs b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/tests/Samples/Sample7_AnalyzeConversation_ConversationPiiWithMaskPolicyType.cs index 38bf6cf170a4..c910c904c4c8 100644 --- a/sdk/cognitivelanguage/Azure.AI.Language.Conversations/tests/Samples/Sample7_AnalyzeConversation_ConversationPiiWithMaskPolicyType.cs +++ b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/tests/Samples/Sample7_AnalyzeConversation_ConversationPiiWithMaskPolicyType.cs @@ -15,7 +15,7 @@ public partial class ConversationAnalysisClientSamples { [SyncOnly] [RecordedTest] - [ServiceVersion(Min = ConversationsClientOptions.ServiceVersion.V2024_05_01)] + [ServiceVersion(Min = ConversationsClientOptions.ServiceVersion.V2024_11_01)] public void AnalyzeConversation_ConversationPii_WithCharacterMaskPolicy() { // Arrange: Initialize client and input From 01ab95de8fe37116eaaa4623ad1664b4810fed14 Mon Sep 17 00:00:00 2001 From: Xiong Chen Date: Tue, 28 Jan 2025 16:09:47 -0800 Subject: [PATCH 12/31] Modified the assertion in conversation pii test with MaskPolicyType --- .../ConversationAnalysisTestBase.cs | 1 + ...ation_ConversationPiiWithMaskPolicyType.cs | 53 ++++++------------- 2 files changed, 17 insertions(+), 37 deletions(-) diff --git a/sdk/cognitivelanguage/Azure.AI.Language.Conversations/tests/Infrastructure/ConversationAnalysisTestBase.cs b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/tests/Infrastructure/ConversationAnalysisTestBase.cs index 638dba436961..5294493fc073 100644 --- a/sdk/cognitivelanguage/Azure.AI.Language.Conversations/tests/Infrastructure/ConversationAnalysisTestBase.cs +++ b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/tests/Infrastructure/ConversationAnalysisTestBase.cs @@ -11,6 +11,7 @@ namespace Azure.AI.Language.Conversations.Tests /// /// The type of client being tested. [ClientTestFixture( + ConversationsClientOptions.ServiceVersion.V2024_11_15_Preview, ConversationsClientOptions.ServiceVersion.V2024_11_01, ConversationsClientOptions.ServiceVersion.V2024_05_01, ConversationsClientOptions.ServiceVersion.V2023_04_01, diff --git a/sdk/cognitivelanguage/Azure.AI.Language.Conversations/tests/Samples/Sample7_AnalyzeConversation_ConversationPiiWithMaskPolicyType.cs b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/tests/Samples/Sample7_AnalyzeConversation_ConversationPiiWithMaskPolicyType.cs index c910c904c4c8..ed505f3f12a1 100644 --- a/sdk/cognitivelanguage/Azure.AI.Language.Conversations/tests/Samples/Sample7_AnalyzeConversation_ConversationPiiWithMaskPolicyType.cs +++ b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/tests/Samples/Sample7_AnalyzeConversation_ConversationPiiWithMaskPolicyType.cs @@ -15,12 +15,12 @@ public partial class ConversationAnalysisClientSamples { [SyncOnly] [RecordedTest] - [ServiceVersion(Min = ConversationsClientOptions.ServiceVersion.V2024_11_01)] + [ServiceVersion(Min = ConversationsClientOptions.ServiceVersion.V2024_11_15_Preview)] public void AnalyzeConversation_ConversationPii_WithCharacterMaskPolicy() { // Arrange: Initialize client and input ConversationAnalysisClient client = Client; - List entitiesDetected = new(); + List redactedTexts = new(); // Create a CharacterMaskPolicyType with a custom masking character var redactionPolicy = new CharacterMaskPolicyType @@ -61,6 +61,7 @@ public void AnalyzeConversation_ConversationPii_WithCharacterMaskPolicy() #region Snippet:AnalyzeConversation_ConversationPiiSync AnalyzeConversationOperationState operationState = analyzeConversationOperation.Value; #endregion + // Assert: Validate the results foreach (AnalyzeConversationOperationResult operationResult in operationState.Actions.Items) { Console.WriteLine($"Operation action name: {operationResult.Name}"); @@ -70,50 +71,28 @@ public void AnalyzeConversation_ConversationPii_WithCharacterMaskPolicy() foreach (ConversationalPiiResult conversation in piiOperationResult.Results.Conversations) { Console.WriteLine($"Conversation: #{conversation.Id}"); - Console.WriteLine("Detected Entities:"); foreach (ConversationPiiItemResult item in conversation.ConversationItems) { - foreach (NamedEntity entity in item.Entities) - { - Console.WriteLine($"Category: {entity.Category}"); - Console.WriteLine($"Subcategory: {entity.Subcategory}"); - Console.WriteLine($"Text: {entity.Text}"); - Console.WriteLine($"Offset: {entity.Offset}"); - Console.WriteLine($"Length: {entity.Length}"); - Console.WriteLine($"Confidence score: {entity.ConfidenceScore}"); - Console.WriteLine(); + string redactedText = item.RedactedContent?.Text ?? string.Empty; + Console.WriteLine($"Redacted Text: {redactedText}"); - // Verify the redacted text uses the '*' character - //Assert.That(entity.Text, Does.Not.Contain("John")); // Original text should be redacted - Assert.That(entity.Text, Does.Contain("*")); // Redacted text should contain the mask character -#if !SNIPPET - entitiesDetected.Add(entity); -#endif - } - } - if (conversation.Warnings != null && conversation.Warnings.Any()) - { - Console.WriteLine("Warnings:"); - foreach (InputWarning warning in conversation.Warnings) + // Only verify redaction if the original sentence had PII + if (item.Entities.Any()) { - Console.WriteLine($"Code: {warning.Code}"); - Console.WriteLine($"Message: {warning.Message}"); + foreach (var entity in item.Entities) + { + Assert.That(redactedText, Does.Not.Contain(entity.Text), + $"Expected entity '{entity.Text}' to be redacted but found in: {redactedText}"); + + Assert.That(redactedText, Does.Contain("*"), + $"Expected redacted text to contain '*' but got: {redactedText}"); + } } } - Console.WriteLine(); - } - } - if (operationState.Errors != null && operationState.Errors.Any()) - { - Console.WriteLine("Errors:"); - foreach (ConversationError error in operationState.Errors) - { - Console.WriteLine($"Error: {error.Code} - {error}"); } } } - - Assert.NotZero(entitiesDetected.Count); + // Verify the HTTP response is successful Assert.That(analyzeConversationOperation.GetRawResponse().Status, Is.EqualTo(200)); } } From bb036104a386deec8302d416948772034bc3056c Mon Sep 17 00:00:00 2001 From: Xiong Chen Date: Wed, 29 Jan 2025 10:47:13 -0800 Subject: [PATCH 13/31] add async test for ConversationPii_WithCharacterMaskPolicy --- ...ation_ConversationPiiWithMaskPolicyType.cs | 83 +++++++++++++++++++ 1 file changed, 83 insertions(+) diff --git a/sdk/cognitivelanguage/Azure.AI.Language.Conversations/tests/Samples/Sample7_AnalyzeConversation_ConversationPiiWithMaskPolicyType.cs b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/tests/Samples/Sample7_AnalyzeConversation_ConversationPiiWithMaskPolicyType.cs index ed505f3f12a1..fd637eee61dd 100644 --- a/sdk/cognitivelanguage/Azure.AI.Language.Conversations/tests/Samples/Sample7_AnalyzeConversation_ConversationPiiWithMaskPolicyType.cs +++ b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/tests/Samples/Sample7_AnalyzeConversation_ConversationPiiWithMaskPolicyType.cs @@ -95,5 +95,88 @@ public void AnalyzeConversation_ConversationPii_WithCharacterMaskPolicy() // Verify the HTTP response is successful Assert.That(analyzeConversationOperation.GetRawResponse().Status, Is.EqualTo(200)); } + + [AsyncOnly] + [RecordedTest] + [ServiceVersion(Min = ConversationsClientOptions.ServiceVersion.V2024_11_15_Preview)] + public async Task AnalyzeConversationAsync_ConversationPii_WithCharacterMaskPolicy() + { + // Arrange: Initialize client and input + ConversationAnalysisClient client = Client; + List redactedTexts = new(); + + // Create a CharacterMaskPolicyType with a custom masking character + var redactionPolicy = new CharacterMaskPolicyType + { + RedactionCharacter = RedactionCharacter.Asterisk + }; + + // Simulate input conversation + MultiLanguageConversationInput input = new MultiLanguageConversationInput( + new List + { + new TextConversation("1", "en", new List + { + new TextConversationItem(id: "1", participantId: "Agent_1", text: "Can you provide your name?"), + new TextConversationItem(id: "2", participantId: "Customer_1", text: "Hi, my name is John Doe."), + new TextConversationItem(id: "3", participantId: "Agent_1", text: "Thank you John, that has been updated in our system.") + }) + }); + + // Add action with CharacterMaskPolicyType + List actions = new List + { + new PiiOperationAction + { + ActionContent = new ConversationPiiActionContent + { + RedactionPolicy = redactionPolicy + }, + Name = "Conversation PII with Character Mask Policy" + } + }; + + // Create input for analysis + AnalyzeConversationOperationInput data = new AnalyzeConversationOperationInput(input, actions); + + // Act: Perform the PII analysis + Response analyzeConversationOperation = await client.AnalyzeConversationsAsync(data); + #region Snippet:AnalyzeConversation_ConversationPiiSync + AnalyzeConversationOperationState operationState = analyzeConversationOperation.Value; + #endregion + // Assert: Validate the results + foreach (AnalyzeConversationOperationResult operationResult in operationState.Actions.Items) + { + Console.WriteLine($"Operation action name: {operationResult.Name}"); + + if (operationResult is ConversationPiiOperationResult piiOperationResult) + { + foreach (ConversationalPiiResult conversation in piiOperationResult.Results.Conversations) + { + Console.WriteLine($"Conversation: #{conversation.Id}"); + foreach (ConversationPiiItemResult item in conversation.ConversationItems) + { + string redactedText = item.RedactedContent?.Text ?? string.Empty; + Console.WriteLine($"Redacted Text: {redactedText}"); + + // Only verify redaction if the original sentence had PII + if (item.Entities.Any()) + { + foreach (var entity in item.Entities) + { + Assert.That(redactedText, Does.Not.Contain(entity.Text), + $"Expected entity '{entity.Text}' to be redacted but found in: {redactedText}"); + + Assert.That(redactedText, Does.Contain("*"), + $"Expected redacted text to contain '*' but got: {redactedText}"); + } + } + } + } + } + } + // Verify the HTTP response is successful + Assert.That(analyzeConversationOperation.GetRawResponse().Status, Is.EqualTo(200)); + } } } From 5a5b47f2c1f84bbafdda8f8f76fd21d2ac5dbd74 Mon Sep 17 00:00:00 2001 From: Xiong Chen Date: Wed, 29 Jan 2025 11:38:14 -0800 Subject: [PATCH 14/31] add sync and async test for ConversationPii_WithEntityMaskPolicy --- ...ConversationPiiWithCharacterMaskPolicy.cs} | 0 ...ion_ConversationPiiWithEntityMaskPolicy.cs | 183 ++++++++++++++++++ 2 files changed, 183 insertions(+) rename sdk/cognitivelanguage/Azure.AI.Language.Conversations/tests/Samples/{Sample7_AnalyzeConversation_ConversationPiiWithMaskPolicyType.cs => Sample7_AnalyzeConversation_ConversationPiiWithCharacterMaskPolicy.cs} (100%) create mode 100644 sdk/cognitivelanguage/Azure.AI.Language.Conversations/tests/Samples/Sample8_AnalyzeConversation_ConversationPiiWithEntityMaskPolicy.cs diff --git a/sdk/cognitivelanguage/Azure.AI.Language.Conversations/tests/Samples/Sample7_AnalyzeConversation_ConversationPiiWithMaskPolicyType.cs b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/tests/Samples/Sample7_AnalyzeConversation_ConversationPiiWithCharacterMaskPolicy.cs similarity index 100% rename from sdk/cognitivelanguage/Azure.AI.Language.Conversations/tests/Samples/Sample7_AnalyzeConversation_ConversationPiiWithMaskPolicyType.cs rename to sdk/cognitivelanguage/Azure.AI.Language.Conversations/tests/Samples/Sample7_AnalyzeConversation_ConversationPiiWithCharacterMaskPolicy.cs diff --git a/sdk/cognitivelanguage/Azure.AI.Language.Conversations/tests/Samples/Sample8_AnalyzeConversation_ConversationPiiWithEntityMaskPolicy.cs b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/tests/Samples/Sample8_AnalyzeConversation_ConversationPiiWithEntityMaskPolicy.cs new file mode 100644 index 000000000000..12a740f30ce5 --- /dev/null +++ b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/tests/Samples/Sample8_AnalyzeConversation_ConversationPiiWithEntityMaskPolicy.cs @@ -0,0 +1,183 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text.RegularExpressions; +using System.Threading.Tasks; +using Azure.AI.Language.Conversations.Models; +using Azure.Core.TestFramework; +using NUnit.Framework; + +namespace Azure.AI.Language.Conversations.Tests.Samples +{ + public partial class ConversationAnalysisClientSamples + { + [SyncOnly] + [RecordedTest] + [ServiceVersion(Min = ConversationsClientOptions.ServiceVersion.V2024_11_15_Preview)] + public void AnalyzeConversation_ConversationPii_WithEntityMaskPolicy() + { + // Arrange: Initialize client and input + ConversationAnalysisClient client = Client; + List redactedTexts = new(); + + // Create an EntityMaskTypePolicyType + var redactionPolicy = new EntityMaskTypePolicyType(); + + // Simulate input conversation + MultiLanguageConversationInput input = new MultiLanguageConversationInput( + new List + { + new TextConversation("1", "en", new List + { + new TextConversationItem(id: "1", participantId: "Agent_1", text: "Can you provide your name?"), + new TextConversationItem(id: "2", participantId: "Customer_1", text: "Hi, my name is John Doe."), + new TextConversationItem(id: "3", participantId: "Agent_1", text: "Thank you John, that has been updated in our system.") + }) + }); + + // Add action with EntityMaskTypePolicyType + List actions = new List + { + new PiiOperationAction + { + ActionContent = new ConversationPiiActionContent + { + RedactionPolicy = redactionPolicy + }, + Name = "Conversation PII with Entity Mask Policy" + } + }; + + // Create input for analysis + AnalyzeConversationOperationInput data = new AnalyzeConversationOperationInput(input, actions); + + // Act: Perform the PII analysis + Response analyzeConversationOperation = client.AnalyzeConversations(data); + AnalyzeConversationOperationState operationState = analyzeConversationOperation.Value; + + // Assert: Validate the results + foreach (AnalyzeConversationOperationResult operationResult in operationState.Actions.Items) + { + Console.WriteLine($"Operation action name: {operationResult.Name}"); + + if (operationResult is ConversationPiiOperationResult piiOperationResult) + { + foreach (ConversationalPiiResult conversation in piiOperationResult.Results.Conversations) + { + Console.WriteLine($"Conversation: #{conversation.Id}"); + foreach (ConversationPiiItemResult item in conversation.ConversationItems) + { + string redactedText = item.RedactedContent?.Text ?? string.Empty; + Console.WriteLine($"Redacted Text: {redactedText}"); + + // Only verify redaction if the original sentence had PII + if (item.Entities.Any()) + { + foreach (var entity in item.Entities) + { + Assert.That(redactedText, Does.Not.Contain(entity.Text), + $"Expected entity '{entity.Text}' to be redacted but found in: {redactedText}"); + + // Case-insensitive pattern to match entity mask variations + string expectedMaskPattern = $@"\[{entity.Category}-?\d*\]"; + + // Perform case-insensitive regex match + StringAssert.IsMatch("(?i)" + expectedMaskPattern, redactedText, + $"Expected redacted text to contain an entity mask similar to '[{entity.Category}]' but got: {redactedText}"); + } + } + } + } + } + } + // Verify the HTTP response is successful + Assert.That(analyzeConversationOperation.GetRawResponse().Status, Is.EqualTo(200)); + } + + [AsyncOnly] + [RecordedTest] + [ServiceVersion(Min = ConversationsClientOptions.ServiceVersion.V2024_11_15_Preview)] + public async Task AnalyzeConversationAsync_ConversationPii_WithEntityMaskPolicy() + { + // Arrange: Initialize client and input + ConversationAnalysisClient client = Client; + List redactedTexts = new(); + + // Create an EntityMaskTypePolicyType + var redactionPolicy = new EntityMaskTypePolicyType(); + + // Simulate input conversation + MultiLanguageConversationInput input = new MultiLanguageConversationInput( + new List + { + new TextConversation("1", "en", new List + { + new TextConversationItem(id: "1", participantId: "Agent_1", text: "Can you provide your name?"), + new TextConversationItem(id: "2", participantId: "Customer_1", text: "Hi, my name is John Doe."), + new TextConversationItem(id: "3", participantId: "Agent_1", text: "Thank you John, that has been updated in our system.") + }) + }); + + // Add action with EntityMaskTypePolicyType + List actions = new List + { + new PiiOperationAction + { + ActionContent = new ConversationPiiActionContent + { + RedactionPolicy = redactionPolicy + }, + Name = "Conversation PII with Entity Mask Policy" + } + }; + + // Create input for analysis + AnalyzeConversationOperationInput data = new AnalyzeConversationOperationInput(input, actions); + + // Act: Perform the PII analysis + Response analyzeConversationOperation = await client.AnalyzeConversationsAsync(data); + AnalyzeConversationOperationState operationState = analyzeConversationOperation.Value; + + // Assert: Validate the results + foreach (AnalyzeConversationOperationResult operationResult in operationState.Actions.Items) + { + Console.WriteLine($"Operation action name: {operationResult.Name}"); + + if (operationResult is ConversationPiiOperationResult piiOperationResult) + { + foreach (ConversationalPiiResult conversation in piiOperationResult.Results.Conversations) + { + Console.WriteLine($"Conversation: #{conversation.Id}"); + foreach (ConversationPiiItemResult item in conversation.ConversationItems) + { + string redactedText = item.RedactedContent?.Text ?? string.Empty; + Console.WriteLine($"Redacted Text: {redactedText}"); + + // Only verify redaction if the original sentence had PII + if (item.Entities.Any()) + { + foreach (var entity in item.Entities) + { + Assert.That(redactedText, Does.Not.Contain(entity.Text), + $"Expected entity '{entity.Text}' to be redacted but found in: {redactedText}"); + + // Case-insensitive pattern to match entity mask variations + string expectedMaskPattern = $@"\[{entity.Category}-?\d*\]"; + + // Perform case-insensitive regex match + StringAssert.IsMatch("(?i)" + expectedMaskPattern, redactedText, + $"Expected redacted text to contain an entity mask similar to '[{entity.Category}]' but got: {redactedText}"); + } + } + } + } + } + } + // Verify the HTTP response is successful + Assert.That(analyzeConversationOperation.GetRawResponse().Status, Is.EqualTo(200)); + } + } +} From 764f8dcede85e8ce7b2f4e2e1965f26048790e44 Mon Sep 17 00:00:00 2001 From: Xiong Chen Date: Wed, 29 Jan 2025 11:58:07 -0800 Subject: [PATCH 15/31] add sync and async test for ConversationPii_WithNoMaskPolicy --- ...rsation_ConversationPiiWithNoMaskPolicy.cs | 177 ++++++++++++++++++ 1 file changed, 177 insertions(+) create mode 100644 sdk/cognitivelanguage/Azure.AI.Language.Conversations/tests/Samples/Sample9_AnalyzeConversation_ConversationPiiWithNoMaskPolicy.cs diff --git a/sdk/cognitivelanguage/Azure.AI.Language.Conversations/tests/Samples/Sample9_AnalyzeConversation_ConversationPiiWithNoMaskPolicy.cs b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/tests/Samples/Sample9_AnalyzeConversation_ConversationPiiWithNoMaskPolicy.cs new file mode 100644 index 000000000000..3f0244d6dffb --- /dev/null +++ b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/tests/Samples/Sample9_AnalyzeConversation_ConversationPiiWithNoMaskPolicy.cs @@ -0,0 +1,177 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text.RegularExpressions; +using System.Threading.Tasks; +using Azure.AI.Language.Conversations.Models; +using Azure.Core.TestFramework; +using NUnit.Framework; + +namespace Azure.AI.Language.Conversations.Tests.Samples +{ + public partial class ConversationAnalysisClientSamples + { + [SyncOnly] + [RecordedTest] + [ServiceVersion(Min = ConversationsClientOptions.ServiceVersion.V2024_11_15_Preview)] + public void AnalyzeConversation_ConversationPii_WithNoMaskPolicy() + { + // Arrange: Initialize client and input + ConversationAnalysisClient client = Client; + List detectedEntities = new(); + + // Create a NoMaskPolicyType (PII should be detected but not redacted) + var redactionPolicy = new NoMaskPolicyType(); + + // Simulate input conversation + MultiLanguageConversationInput input = new MultiLanguageConversationInput( + new List + { + new TextConversation("1", "en", new List + { + new TextConversationItem(id: "1", participantId: "Agent_1", text: "Can you provide your name?"), + new TextConversationItem(id: "2", participantId: "Customer_1", text: "Hi, my name is John Doe."), + new TextConversationItem(id: "3", participantId: "Agent_1", text: "Thank you John, that has been updated in our system.") + }) + }); + + // Add action with NoMaskPolicyType + List actions = new List + { + new PiiOperationAction + { + ActionContent = new ConversationPiiActionContent + { + RedactionPolicy = redactionPolicy + }, + Name = "Conversation PII with No Mask Policy" + } + }; + + // Create input for analysis + AnalyzeConversationOperationInput data = new AnalyzeConversationOperationInput(input, actions); + + // Act: Perform the PII analysis + Response analyzeConversationOperation = client.AnalyzeConversations(data); + AnalyzeConversationOperationState operationState = analyzeConversationOperation.Value; + + // Assert: Validate the results + foreach (AnalyzeConversationOperationResult operationResult in operationState.Actions.Items) + { + Console.WriteLine($"Operation action name: {operationResult.Name}"); + + if (operationResult is ConversationPiiOperationResult piiOperationResult) + { + foreach (ConversationalPiiResult conversation in piiOperationResult.Results.Conversations) + { + Console.WriteLine($"Conversation: #{conversation.Id}"); + foreach (ConversationPiiItemResult item in conversation.ConversationItems) + { + string originalText = item.RedactedContent?.Text ?? string.Empty; + Console.WriteLine($"Original Text: {originalText}"); + + // Ensure PII is detected + if (item.Entities.Any()) + { + foreach (var entity in item.Entities) + { + detectedEntities.Add(entity.Text); + Assert.That(originalText, Does.Contain(entity.Text), + $"Expected entity '{entity.Text}' to be present but was not found in: {originalText}"); + } + } + } + } + } + } + // Ensure PII was detected + Assert.NotZero(detectedEntities.Count); + + // Verify the HTTP response is successful + Assert.That(analyzeConversationOperation.GetRawResponse().Status, Is.EqualTo(200)); + } + + [AsyncOnly] + [RecordedTest] + [ServiceVersion(Min = ConversationsClientOptions.ServiceVersion.V2024_11_15_Preview)] + public async Task AnalyzeConversationAsync_ConversationPii_WithNoMaskPolicy() + { + // Arrange: Initialize client and input + ConversationAnalysisClient client = Client; + List detectedEntities = new(); + + // Create a NoMaskPolicyType (PII should be detected but not redacted) + var redactionPolicy = new NoMaskPolicyType(); + + // Simulate input conversation + MultiLanguageConversationInput input = new MultiLanguageConversationInput( + new List + { + new TextConversation("1", "en", new List + { + new TextConversationItem(id: "1", participantId: "Agent_1", text: "Can you provide your name?"), + new TextConversationItem(id: "2", participantId: "Customer_1", text: "Hi, my name is John Doe."), + new TextConversationItem(id: "3", participantId: "Agent_1", text: "Thank you John, that has been updated in our system.") + }) + }); + + // Add action with NoMaskPolicyType + List actions = new List + { + new PiiOperationAction + { + ActionContent = new ConversationPiiActionContent + { + RedactionPolicy = redactionPolicy + }, + Name = "Conversation PII with No Mask Policy" + } + }; + + // Create input for analysis + AnalyzeConversationOperationInput data = new AnalyzeConversationOperationInput(input, actions); + + // Act: Perform the PII analysis + Response analyzeConversationOperation = await client.AnalyzeConversationsAsync(data); + AnalyzeConversationOperationState operationState = analyzeConversationOperation.Value; + + // Assert: Validate the results + foreach (AnalyzeConversationOperationResult operationResult in operationState.Actions.Items) + { + Console.WriteLine($"Operation action name: {operationResult.Name}"); + + if (operationResult is ConversationPiiOperationResult piiOperationResult) + { + foreach (ConversationalPiiResult conversation in piiOperationResult.Results.Conversations) + { + Console.WriteLine($"Conversation: #{conversation.Id}"); + foreach (ConversationPiiItemResult item in conversation.ConversationItems) + { + string originalText = item.RedactedContent?.Text ?? string.Empty; + Console.WriteLine($"Original Text: {originalText}"); + + // Ensure PII is detected + if (item.Entities.Any()) + { + foreach (var entity in item.Entities) + { + detectedEntities.Add(entity.Text); + Assert.That(originalText, Does.Contain(entity.Text), + $"Expected entity '{entity.Text}' to be present but was not found in: {originalText}"); + } + } + } + } + } + } + // Ensure PII was detected + Assert.NotZero(detectedEntities.Count); + + // Verify the HTTP response is successful + Assert.That(analyzeConversationOperation.GetRawResponse().Status, Is.EqualTo(200)); + } + } +} From e92b9ba722a5ccbcb64150ac9eb299b886ba3d2a Mon Sep 17 00:00:00 2001 From: Xiong Chen Date: Wed, 29 Jan 2025 12:06:39 -0800 Subject: [PATCH 16/31] revert ConversationsClientLiveTests --- .../tests/ConversationsClientLiveTests.cs | 97 ------------------- 1 file changed, 97 deletions(-) diff --git a/sdk/cognitivelanguage/Azure.AI.Language.Conversations/tests/ConversationsClientLiveTests.cs b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/tests/ConversationsClientLiveTests.cs index 70b8f0e2a90e..6caf207cc0fd 100644 --- a/sdk/cognitivelanguage/Azure.AI.Language.Conversations/tests/ConversationsClientLiveTests.cs +++ b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/tests/ConversationsClientLiveTests.cs @@ -322,102 +322,5 @@ public async Task AnalyzeConversation_ConversationSummarization() } } } - - [RecordedTest] - [ServiceVersion(Min = ConversationsClientOptions.ServiceVersion.V2024_05_01)] - public async Task AnalyzeConversation_ConversationPii_WithCharacterMaskPolicy() - { - List entitiesDetected = new(); - // Create a CharacterMaskPolicyType with a custom masking character - var redactionPolicy = new CharacterMaskPolicyType - { - RedactionCharacter = RedactionCharacter.Asterisk - }; - - // Simulate input conversation - MultiLanguageConversationInput input = new MultiLanguageConversationInput( - new List - { - new TextConversation("1", "en", new List - { - new TextConversationItem(id: "1", participantId: "Agent_1", text: "Can you provide your name?"), - new TextConversationItem(id: "2", participantId: "Customer_1", text: "Hi, my name is John Doe."), - new TextConversationItem(id: "3", participantId: "Agent_1", text: "Thank you John, that has been updated in our system.") - }) - }); - - // Add action with CharacterMaskPolicyType - List actions = new List - { - new PiiOperationAction - { - ActionContent = new ConversationPiiActionContent - { - RedactionPolicy = redactionPolicy - }, - Name = "Conversation PII with Character Mask Policy" - } - }; - - AnalyzeConversationOperationInput data = new AnalyzeConversationOperationInput(input, actions); - - Response analyzeConversationOperation = await Client.AnalyzeConversationsAsync(data); - Assert.NotNull(analyzeConversationOperation); - - AnalyzeConversationOperationState operationState = analyzeConversationOperation.Value; - foreach (AnalyzeConversationOperationResult operationResult in operationState.Actions.Items) - { - Console.WriteLine($"Operation action name: {operationResult.Name}"); - - if (operationResult is ConversationPiiOperationResult piiOperationResult) - { - foreach (ConversationalPiiResult conversation in piiOperationResult.Results.Conversations) - { - Console.WriteLine($"Conversation: #{conversation.Id}"); - Console.WriteLine("Detected Entities:"); - foreach (ConversationPiiItemResult item in conversation.ConversationItems) - { - foreach (NamedEntity entity in item.Entities) - { - Console.WriteLine($"Category: {entity.Category}"); - Console.WriteLine($"Subcategory: {entity.Subcategory}"); - Console.WriteLine($"Text: {entity.Text}"); - Console.WriteLine($"Offset: {entity.Offset}"); - Console.WriteLine($"Length: {entity.Length}"); - Console.WriteLine($"Confidence score: {entity.ConfidenceScore}"); - Console.WriteLine(); - - // Verify the redacted text uses the '*' character - Assert.That(entity.Text, Does.Not.Contain("John")); // Original text should be redacted - Assert.That(entity.Text, Does.Contain("*")); // Redacted text should contain the mask character - - entitiesDetected.Add(entity); - } - } - if (conversation.Warnings != null && conversation.Warnings.Any()) - { - Console.WriteLine("Warnings:"); - foreach (InputWarning warning in conversation.Warnings) - { - Console.WriteLine($"Code: {warning.Code}"); - Console.WriteLine($"Message: {warning.Message}"); - } - } - Console.WriteLine(); - } - } - if (operationState.Errors != null && operationState.Errors.Any()) - { - Console.WriteLine("Errors:"); - foreach (ConversationError error in operationState.Errors) - { - Console.WriteLine($"Error: {error.Code} - {error}"); - } - } - } - - Assert.NotZero(entitiesDetected.Count); - Assert.That(analyzeConversationOperation.GetRawResponse().Status, Is.EqualTo(200)); - } } } From 1b4f375108ebd1dc7d14fded4abae708824567f0 Mon Sep 17 00:00:00 2001 From: Xiong Chen Date: Thu, 30 Jan 2025 07:28:59 -0800 Subject: [PATCH 17/31] modify new test data for previous tests --- ...alyzeConversation_ConversationPrediction.cs | 18 +++++++++--------- .../Sample3_AnalyzeConversationWithOptions.cs | 8 ++++---- .../Sample4_AnalyzeConversationWithLanguage.cs | 16 ++++++++-------- 3 files changed, 21 insertions(+), 21 deletions(-) diff --git a/sdk/cognitivelanguage/Azure.AI.Language.Conversations/tests/Samples/Sample1_AnalyzeConversation_ConversationPrediction.cs b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/tests/Samples/Sample1_AnalyzeConversation_ConversationPrediction.cs index 28ef2e350169..904601f5ac24 100644 --- a/sdk/cognitivelanguage/Azure.AI.Language.Conversations/tests/Samples/Sample1_AnalyzeConversation_ConversationPrediction.cs +++ b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/tests/Samples/Sample1_AnalyzeConversation_ConversationPrediction.cs @@ -19,19 +19,19 @@ public void AnalyzeConversation() ConversationAnalysisClient client = Client; #region Snippet:ConversationAnalysis_AnalyzeConversation - string projectName = "Menu"; - string deploymentName = "production"; -#if !SNIPPET - projectName = TestEnvironment.ProjectName; - deploymentName = TestEnvironment.DeploymentName; -#endif + string projectName = "EmailApp"; + string deploymentName = "deployment1"; +//#if !SNIPPET +// projectName = TestEnvironment.ProjectName; +// deploymentName = TestEnvironment.DeploymentName; +//#endif AnalyzeConversationInput data = new ConversationLanguageUnderstandingInput( new ConversationAnalysisInput( new TextConversationItem( id: "1", participantId: "participant1", - text: "Send an email to Carol about tomorrow's demo")), + text: "I want to buy a house")), new ConversationLanguageUnderstandingActionContent(projectName, deploymentName) { // Use Utf16CodeUnit for strings in .NET. @@ -78,7 +78,7 @@ public void AnalyzeConversation() } #endregion - Assert.That(conversationPrediction.TopIntent?.ToString(), Is.EqualTo("Send")); + Assert.That(conversationPrediction.TopIntent?.ToString(), Is.EqualTo("Buy")); } [AsyncOnly] @@ -142,7 +142,7 @@ public async Task AnalyzeConversationAsync() } } } - Assert.That(conversationPrediction.TopIntent?.ToString(), Is.EqualTo("Send")); + Assert.That(conversationPrediction.TopIntent?.ToString(), Is.EqualTo("SendEmail")); } } } diff --git a/sdk/cognitivelanguage/Azure.AI.Language.Conversations/tests/Samples/Sample3_AnalyzeConversationWithOptions.cs b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/tests/Samples/Sample3_AnalyzeConversationWithOptions.cs index 8cf35eecbb43..f8cb71310474 100644 --- a/sdk/cognitivelanguage/Azure.AI.Language.Conversations/tests/Samples/Sample3_AnalyzeConversationWithOptions.cs +++ b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/tests/Samples/Sample3_AnalyzeConversationWithOptions.cs @@ -31,7 +31,7 @@ public void AnalyzeConversationWithOptions() new TextConversationItem( id: "1", participantId: "participant1", - text: "Send an email to Carol about tomorrow's demo")), + text: "I want to buy a house")), new ConversationLanguageUnderstandingActionContent(projectName, deploymentName) { // Use Utf16CodeUnit for strings in .NET. @@ -79,7 +79,7 @@ public void AnalyzeConversationWithOptions() } } } - Assert.That(conversationPrediction.TopIntent?.ToString(), Is.EqualTo("Send")); + Assert.That(conversationPrediction.TopIntent?.ToString(), Is.EqualTo("Buy")); } [AsyncOnly] @@ -96,7 +96,7 @@ public async Task AnalyzeConversationWithOptionsAsync() new TextConversationItem( id: "1", participantId: "participant1", - text: "Send an email to Carol about tomorrow's demo")), + text: "I want to buy a house")), new ConversationLanguageUnderstandingActionContent(projectName, deploymentName) { // Use Utf16CodeUnit for strings in .NET. @@ -145,7 +145,7 @@ public async Task AnalyzeConversationWithOptionsAsync() } } } - Assert.That(conversationPrediction.TopIntent?.ToString(), Is.EqualTo("Send")); + Assert.That(conversationPrediction.TopIntent?.ToString(), Is.EqualTo("Buy")); } } } diff --git a/sdk/cognitivelanguage/Azure.AI.Language.Conversations/tests/Samples/Sample4_AnalyzeConversationWithLanguage.cs b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/tests/Samples/Sample4_AnalyzeConversationWithLanguage.cs index ba2cdf218c44..b9bd95704e53 100644 --- a/sdk/cognitivelanguage/Azure.AI.Language.Conversations/tests/Samples/Sample4_AnalyzeConversationWithLanguage.cs +++ b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/tests/Samples/Sample4_AnalyzeConversationWithLanguage.cs @@ -19,12 +19,12 @@ public void AnalyzeConversationWithLanguage() ConversationAnalysisClient client = Client; #region Snippet:ConversationAnalysis_AnalyzeConversationWithLanguage - string projectName = "Menu"; - string deploymentName = "production"; -#if !SNIPPET - projectName = TestEnvironment.ProjectName; - deploymentName = TestEnvironment.DeploymentName; -#endif + string projectName = "EmailApp"; + string deploymentName = "deployment1"; +//#if !SNIPPET +// projectName = "EmailApp"; +// deploymentName = "deployment1"; +//#endif AnalyzeConversationInput data = new ConversationLanguageUnderstandingInput( @@ -83,7 +83,7 @@ public void AnalyzeConversationWithLanguage() } } } - Assert.That(conversationPrediction.TopIntent?.ToString(), Is.EqualTo("Send")); + Assert.That(conversationPrediction.TopIntent?.ToString(), Is.EqualTo("SendEmail")); } [AsyncOnly] @@ -153,7 +153,7 @@ public async Task AnalyzeConversationWithLanguageAsync() } } } - Assert.That(conversationPrediction.TopIntent?.ToString(), Is.EqualTo("Send")); + Assert.That(conversationPrediction.TopIntent?.ToString(), Is.EqualTo("SendEmail")); } } } From 76b851841ff257dab1dd2f364ef5cddad1b3185b Mon Sep 17 00:00:00 2001 From: Xiong Chen Date: Thu, 30 Jan 2025 09:10:36 -0800 Subject: [PATCH 18/31] revert previous tests to main version. --- ...alyzeConversation_ConversationPrediction.cs | 18 +++++++++--------- .../Sample3_AnalyzeConversationWithOptions.cs | 8 ++++---- .../Sample4_AnalyzeConversationWithLanguage.cs | 16 ++++++++-------- 3 files changed, 21 insertions(+), 21 deletions(-) diff --git a/sdk/cognitivelanguage/Azure.AI.Language.Conversations/tests/Samples/Sample1_AnalyzeConversation_ConversationPrediction.cs b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/tests/Samples/Sample1_AnalyzeConversation_ConversationPrediction.cs index 904601f5ac24..28ef2e350169 100644 --- a/sdk/cognitivelanguage/Azure.AI.Language.Conversations/tests/Samples/Sample1_AnalyzeConversation_ConversationPrediction.cs +++ b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/tests/Samples/Sample1_AnalyzeConversation_ConversationPrediction.cs @@ -19,19 +19,19 @@ public void AnalyzeConversation() ConversationAnalysisClient client = Client; #region Snippet:ConversationAnalysis_AnalyzeConversation - string projectName = "EmailApp"; - string deploymentName = "deployment1"; -//#if !SNIPPET -// projectName = TestEnvironment.ProjectName; -// deploymentName = TestEnvironment.DeploymentName; -//#endif + string projectName = "Menu"; + string deploymentName = "production"; +#if !SNIPPET + projectName = TestEnvironment.ProjectName; + deploymentName = TestEnvironment.DeploymentName; +#endif AnalyzeConversationInput data = new ConversationLanguageUnderstandingInput( new ConversationAnalysisInput( new TextConversationItem( id: "1", participantId: "participant1", - text: "I want to buy a house")), + text: "Send an email to Carol about tomorrow's demo")), new ConversationLanguageUnderstandingActionContent(projectName, deploymentName) { // Use Utf16CodeUnit for strings in .NET. @@ -78,7 +78,7 @@ public void AnalyzeConversation() } #endregion - Assert.That(conversationPrediction.TopIntent?.ToString(), Is.EqualTo("Buy")); + Assert.That(conversationPrediction.TopIntent?.ToString(), Is.EqualTo("Send")); } [AsyncOnly] @@ -142,7 +142,7 @@ public async Task AnalyzeConversationAsync() } } } - Assert.That(conversationPrediction.TopIntent?.ToString(), Is.EqualTo("SendEmail")); + Assert.That(conversationPrediction.TopIntent?.ToString(), Is.EqualTo("Send")); } } } diff --git a/sdk/cognitivelanguage/Azure.AI.Language.Conversations/tests/Samples/Sample3_AnalyzeConversationWithOptions.cs b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/tests/Samples/Sample3_AnalyzeConversationWithOptions.cs index f8cb71310474..8cf35eecbb43 100644 --- a/sdk/cognitivelanguage/Azure.AI.Language.Conversations/tests/Samples/Sample3_AnalyzeConversationWithOptions.cs +++ b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/tests/Samples/Sample3_AnalyzeConversationWithOptions.cs @@ -31,7 +31,7 @@ public void AnalyzeConversationWithOptions() new TextConversationItem( id: "1", participantId: "participant1", - text: "I want to buy a house")), + text: "Send an email to Carol about tomorrow's demo")), new ConversationLanguageUnderstandingActionContent(projectName, deploymentName) { // Use Utf16CodeUnit for strings in .NET. @@ -79,7 +79,7 @@ public void AnalyzeConversationWithOptions() } } } - Assert.That(conversationPrediction.TopIntent?.ToString(), Is.EqualTo("Buy")); + Assert.That(conversationPrediction.TopIntent?.ToString(), Is.EqualTo("Send")); } [AsyncOnly] @@ -96,7 +96,7 @@ public async Task AnalyzeConversationWithOptionsAsync() new TextConversationItem( id: "1", participantId: "participant1", - text: "I want to buy a house")), + text: "Send an email to Carol about tomorrow's demo")), new ConversationLanguageUnderstandingActionContent(projectName, deploymentName) { // Use Utf16CodeUnit for strings in .NET. @@ -145,7 +145,7 @@ public async Task AnalyzeConversationWithOptionsAsync() } } } - Assert.That(conversationPrediction.TopIntent?.ToString(), Is.EqualTo("Buy")); + Assert.That(conversationPrediction.TopIntent?.ToString(), Is.EqualTo("Send")); } } } diff --git a/sdk/cognitivelanguage/Azure.AI.Language.Conversations/tests/Samples/Sample4_AnalyzeConversationWithLanguage.cs b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/tests/Samples/Sample4_AnalyzeConversationWithLanguage.cs index b9bd95704e53..ba2cdf218c44 100644 --- a/sdk/cognitivelanguage/Azure.AI.Language.Conversations/tests/Samples/Sample4_AnalyzeConversationWithLanguage.cs +++ b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/tests/Samples/Sample4_AnalyzeConversationWithLanguage.cs @@ -19,12 +19,12 @@ public void AnalyzeConversationWithLanguage() ConversationAnalysisClient client = Client; #region Snippet:ConversationAnalysis_AnalyzeConversationWithLanguage - string projectName = "EmailApp"; - string deploymentName = "deployment1"; -//#if !SNIPPET -// projectName = "EmailApp"; -// deploymentName = "deployment1"; -//#endif + string projectName = "Menu"; + string deploymentName = "production"; +#if !SNIPPET + projectName = TestEnvironment.ProjectName; + deploymentName = TestEnvironment.DeploymentName; +#endif AnalyzeConversationInput data = new ConversationLanguageUnderstandingInput( @@ -83,7 +83,7 @@ public void AnalyzeConversationWithLanguage() } } } - Assert.That(conversationPrediction.TopIntent?.ToString(), Is.EqualTo("SendEmail")); + Assert.That(conversationPrediction.TopIntent?.ToString(), Is.EqualTo("Send")); } [AsyncOnly] @@ -153,7 +153,7 @@ public async Task AnalyzeConversationWithLanguageAsync() } } } - Assert.That(conversationPrediction.TopIntent?.ToString(), Is.EqualTo("SendEmail")); + Assert.That(conversationPrediction.TopIntent?.ToString(), Is.EqualTo("Send")); } } } From 24a6cda7e71f837b5a0c884b731cab21bd3f5069 Mon Sep 17 00:00:00 2001 From: Xiong Chen Date: Thu, 30 Jan 2025 11:41:47 -0800 Subject: [PATCH 19/31] testing --- ...AnalyzeConversation_ConversationPiiWithCharacterMaskPolicy.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/sdk/cognitivelanguage/Azure.AI.Language.Conversations/tests/Samples/Sample7_AnalyzeConversation_ConversationPiiWithCharacterMaskPolicy.cs b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/tests/Samples/Sample7_AnalyzeConversation_ConversationPiiWithCharacterMaskPolicy.cs index fd637eee61dd..8d917d3091f8 100644 --- a/sdk/cognitivelanguage/Azure.AI.Language.Conversations/tests/Samples/Sample7_AnalyzeConversation_ConversationPiiWithCharacterMaskPolicy.cs +++ b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/tests/Samples/Sample7_AnalyzeConversation_ConversationPiiWithCharacterMaskPolicy.cs @@ -175,6 +175,7 @@ public async Task AnalyzeConversationAsync_ConversationPii_WithCharacterMaskPoli } } } + // Verify the HTTP response is successful Assert.That(analyzeConversationOperation.GetRawResponse().Status, Is.EqualTo(200)); } From 9cb4d0d9eb97b79602f3fd8f791061fe4084a557 Mon Sep 17 00:00:00 2001 From: Xiong Chen Date: Thu, 30 Jan 2025 12:13:14 -0800 Subject: [PATCH 20/31] test for authentication --- ...AnalyzeConversation_ConversationPiiWithCharacterMaskPolicy.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/sdk/cognitivelanguage/Azure.AI.Language.Conversations/tests/Samples/Sample7_AnalyzeConversation_ConversationPiiWithCharacterMaskPolicy.cs b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/tests/Samples/Sample7_AnalyzeConversation_ConversationPiiWithCharacterMaskPolicy.cs index 8d917d3091f8..8e11e6088245 100644 --- a/sdk/cognitivelanguage/Azure.AI.Language.Conversations/tests/Samples/Sample7_AnalyzeConversation_ConversationPiiWithCharacterMaskPolicy.cs +++ b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/tests/Samples/Sample7_AnalyzeConversation_ConversationPiiWithCharacterMaskPolicy.cs @@ -144,6 +144,7 @@ public async Task AnalyzeConversationAsync_ConversationPii_WithCharacterMaskPoli #region Snippet:AnalyzeConversation_ConversationPiiSync AnalyzeConversationOperationState operationState = analyzeConversationOperation.Value; #endregion + // Assert: Validate the results foreach (AnalyzeConversationOperationResult operationResult in operationState.Actions.Items) { From ea99fb1e2d0f7388c7c76a4ad98adf269482ed36 Mon Sep 17 00:00:00 2001 From: Xiong Chen Date: Thu, 30 Jan 2025 12:21:54 -0800 Subject: [PATCH 21/31] - update the assets.json --- .../Azure.AI.Language.Conversations/assets.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sdk/cognitivelanguage/Azure.AI.Language.Conversations/assets.json b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/assets.json index cad3d9bffbe8..70cb0b2afe36 100644 --- a/sdk/cognitivelanguage/Azure.AI.Language.Conversations/assets.json +++ b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/assets.json @@ -2,5 +2,5 @@ "AssetsRepo": "Azure/azure-sdk-assets", "AssetsRepoPrefixPath": "net", "TagPrefix": "net/cognitivelanguage/Azure.AI.Language.Conversations", - "Tag": "net/cognitivelanguage/Azure.AI.Language.Conversations_1e1b47540c" + "Tag": "net/cognitivelanguage/Azure.AI.Language.Conversations_82b18b029d" } From 9d258739f3c7147a28036fb22dc268fdc40d11fa Mon Sep 17 00:00:00 2001 From: Xiong Chen Date: Thu, 30 Jan 2025 13:54:43 -0800 Subject: [PATCH 22/31] update recording for some old version apis --- .../Azure.AI.Language.Conversations/assets.json | 2 +- .../Sample1_AnalyzeConversation_ConversationPrediction.cs | 4 ++-- .../tests/Samples/Sample3_AnalyzeConversationWithOptions.cs | 4 ++-- .../tests/Samples/Sample4_AnalyzeConversationWithLanguage.cs | 4 ++-- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/sdk/cognitivelanguage/Azure.AI.Language.Conversations/assets.json b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/assets.json index 70cb0b2afe36..eae21f41115b 100644 --- a/sdk/cognitivelanguage/Azure.AI.Language.Conversations/assets.json +++ b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/assets.json @@ -2,5 +2,5 @@ "AssetsRepo": "Azure/azure-sdk-assets", "AssetsRepoPrefixPath": "net", "TagPrefix": "net/cognitivelanguage/Azure.AI.Language.Conversations", - "Tag": "net/cognitivelanguage/Azure.AI.Language.Conversations_82b18b029d" + "Tag": "net/cognitivelanguage/Azure.AI.Language.Conversations_4253521005" } diff --git a/sdk/cognitivelanguage/Azure.AI.Language.Conversations/tests/Samples/Sample1_AnalyzeConversation_ConversationPrediction.cs b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/tests/Samples/Sample1_AnalyzeConversation_ConversationPrediction.cs index 28ef2e350169..e3065765fbce 100644 --- a/sdk/cognitivelanguage/Azure.AI.Language.Conversations/tests/Samples/Sample1_AnalyzeConversation_ConversationPrediction.cs +++ b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/tests/Samples/Sample1_AnalyzeConversation_ConversationPrediction.cs @@ -78,7 +78,7 @@ public void AnalyzeConversation() } #endregion - Assert.That(conversationPrediction.TopIntent?.ToString(), Is.EqualTo("Send")); + Assert.That(conversationPrediction.TopIntent?.ToString(), Is.EqualTo("SendEmail")); } [AsyncOnly] @@ -142,7 +142,7 @@ public async Task AnalyzeConversationAsync() } } } - Assert.That(conversationPrediction.TopIntent?.ToString(), Is.EqualTo("Send")); + Assert.That(conversationPrediction.TopIntent?.ToString(), Is.EqualTo("SendEmail")); } } } diff --git a/sdk/cognitivelanguage/Azure.AI.Language.Conversations/tests/Samples/Sample3_AnalyzeConversationWithOptions.cs b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/tests/Samples/Sample3_AnalyzeConversationWithOptions.cs index 8cf35eecbb43..bf95bfd30a56 100644 --- a/sdk/cognitivelanguage/Azure.AI.Language.Conversations/tests/Samples/Sample3_AnalyzeConversationWithOptions.cs +++ b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/tests/Samples/Sample3_AnalyzeConversationWithOptions.cs @@ -79,7 +79,7 @@ public void AnalyzeConversationWithOptions() } } } - Assert.That(conversationPrediction.TopIntent?.ToString(), Is.EqualTo("Send")); + Assert.That(conversationPrediction.TopIntent?.ToString(), Is.EqualTo("SendEmail")); } [AsyncOnly] @@ -145,7 +145,7 @@ public async Task AnalyzeConversationWithOptionsAsync() } } } - Assert.That(conversationPrediction.TopIntent?.ToString(), Is.EqualTo("Send")); + Assert.That(conversationPrediction.TopIntent?.ToString(), Is.EqualTo("SendEmail")); } } } diff --git a/sdk/cognitivelanguage/Azure.AI.Language.Conversations/tests/Samples/Sample4_AnalyzeConversationWithLanguage.cs b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/tests/Samples/Sample4_AnalyzeConversationWithLanguage.cs index ba2cdf218c44..74a0e787ef4a 100644 --- a/sdk/cognitivelanguage/Azure.AI.Language.Conversations/tests/Samples/Sample4_AnalyzeConversationWithLanguage.cs +++ b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/tests/Samples/Sample4_AnalyzeConversationWithLanguage.cs @@ -83,7 +83,7 @@ public void AnalyzeConversationWithLanguage() } } } - Assert.That(conversationPrediction.TopIntent?.ToString(), Is.EqualTo("Send")); + Assert.That(conversationPrediction.TopIntent?.ToString(), Is.EqualTo("SendEmail")); } [AsyncOnly] @@ -153,7 +153,7 @@ public async Task AnalyzeConversationWithLanguageAsync() } } } - Assert.That(conversationPrediction.TopIntent?.ToString(), Is.EqualTo("Send")); + Assert.That(conversationPrediction.TopIntent?.ToString(), Is.EqualTo("SendEmail")); } } } From 612253f87e8857d342046de9a82d990e7d0390d2 Mon Sep 17 00:00:00 2001 From: Xiong Chen Date: Thu, 30 Jan 2025 16:16:37 -0800 Subject: [PATCH 23/31] update assets.json --- .../Azure.AI.Language.Conversations/assets.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sdk/cognitivelanguage/Azure.AI.Language.Conversations/assets.json b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/assets.json index eae21f41115b..6cf0cdfbf19f 100644 --- a/sdk/cognitivelanguage/Azure.AI.Language.Conversations/assets.json +++ b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/assets.json @@ -2,5 +2,5 @@ "AssetsRepo": "Azure/azure-sdk-assets", "AssetsRepoPrefixPath": "net", "TagPrefix": "net/cognitivelanguage/Azure.AI.Language.Conversations", - "Tag": "net/cognitivelanguage/Azure.AI.Language.Conversations_4253521005" + "Tag": "net/cognitivelanguage/Azure.AI.Language.Conversations_4783ed8f69" } From ad39cbfd57edb2fd94e8280caedf51cc065ac22a Mon Sep 17 00:00:00 2001 From: Xiong Chen Date: Thu, 30 Jan 2025 16:35:30 -0800 Subject: [PATCH 24/31] Succesfully run all the local tests and update the assets.json --- .../Azure.AI.Language.Conversations/assets.json | 2 +- .../Sample1_AnalyzeConversation_ConversationPrediction.cs | 4 ++-- .../tests/Samples/Sample3_AnalyzeConversationWithOptions.cs | 4 ++-- .../tests/Samples/Sample4_AnalyzeConversationWithLanguage.cs | 4 ++-- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/sdk/cognitivelanguage/Azure.AI.Language.Conversations/assets.json b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/assets.json index 6cf0cdfbf19f..9cb5428ca45e 100644 --- a/sdk/cognitivelanguage/Azure.AI.Language.Conversations/assets.json +++ b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/assets.json @@ -2,5 +2,5 @@ "AssetsRepo": "Azure/azure-sdk-assets", "AssetsRepoPrefixPath": "net", "TagPrefix": "net/cognitivelanguage/Azure.AI.Language.Conversations", - "Tag": "net/cognitivelanguage/Azure.AI.Language.Conversations_4783ed8f69" + "Tag": "net/cognitivelanguage/Azure.AI.Language.Conversations_2e95d6033b" } diff --git a/sdk/cognitivelanguage/Azure.AI.Language.Conversations/tests/Samples/Sample1_AnalyzeConversation_ConversationPrediction.cs b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/tests/Samples/Sample1_AnalyzeConversation_ConversationPrediction.cs index e3065765fbce..28ef2e350169 100644 --- a/sdk/cognitivelanguage/Azure.AI.Language.Conversations/tests/Samples/Sample1_AnalyzeConversation_ConversationPrediction.cs +++ b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/tests/Samples/Sample1_AnalyzeConversation_ConversationPrediction.cs @@ -78,7 +78,7 @@ public void AnalyzeConversation() } #endregion - Assert.That(conversationPrediction.TopIntent?.ToString(), Is.EqualTo("SendEmail")); + Assert.That(conversationPrediction.TopIntent?.ToString(), Is.EqualTo("Send")); } [AsyncOnly] @@ -142,7 +142,7 @@ public async Task AnalyzeConversationAsync() } } } - Assert.That(conversationPrediction.TopIntent?.ToString(), Is.EqualTo("SendEmail")); + Assert.That(conversationPrediction.TopIntent?.ToString(), Is.EqualTo("Send")); } } } diff --git a/sdk/cognitivelanguage/Azure.AI.Language.Conversations/tests/Samples/Sample3_AnalyzeConversationWithOptions.cs b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/tests/Samples/Sample3_AnalyzeConversationWithOptions.cs index bf95bfd30a56..8cf35eecbb43 100644 --- a/sdk/cognitivelanguage/Azure.AI.Language.Conversations/tests/Samples/Sample3_AnalyzeConversationWithOptions.cs +++ b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/tests/Samples/Sample3_AnalyzeConversationWithOptions.cs @@ -79,7 +79,7 @@ public void AnalyzeConversationWithOptions() } } } - Assert.That(conversationPrediction.TopIntent?.ToString(), Is.EqualTo("SendEmail")); + Assert.That(conversationPrediction.TopIntent?.ToString(), Is.EqualTo("Send")); } [AsyncOnly] @@ -145,7 +145,7 @@ public async Task AnalyzeConversationWithOptionsAsync() } } } - Assert.That(conversationPrediction.TopIntent?.ToString(), Is.EqualTo("SendEmail")); + Assert.That(conversationPrediction.TopIntent?.ToString(), Is.EqualTo("Send")); } } } diff --git a/sdk/cognitivelanguage/Azure.AI.Language.Conversations/tests/Samples/Sample4_AnalyzeConversationWithLanguage.cs b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/tests/Samples/Sample4_AnalyzeConversationWithLanguage.cs index 74a0e787ef4a..ba2cdf218c44 100644 --- a/sdk/cognitivelanguage/Azure.AI.Language.Conversations/tests/Samples/Sample4_AnalyzeConversationWithLanguage.cs +++ b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/tests/Samples/Sample4_AnalyzeConversationWithLanguage.cs @@ -83,7 +83,7 @@ public void AnalyzeConversationWithLanguage() } } } - Assert.That(conversationPrediction.TopIntent?.ToString(), Is.EqualTo("SendEmail")); + Assert.That(conversationPrediction.TopIntent?.ToString(), Is.EqualTo("Send")); } [AsyncOnly] @@ -153,7 +153,7 @@ public async Task AnalyzeConversationWithLanguageAsync() } } } - Assert.That(conversationPrediction.TopIntent?.ToString(), Is.EqualTo("SendEmail")); + Assert.That(conversationPrediction.TopIntent?.ToString(), Is.EqualTo("Send")); } } } From 9eca5bef1dfd726379efc87d313245b9eeb90c33 Mon Sep 17 00:00:00 2001 From: Xiong Chen Date: Thu, 30 Jan 2025 18:06:51 -0800 Subject: [PATCH 25/31] adding new tests to clientLiveTests and update assets.json --- .../assets.json | 2 +- .../tests/ConversationsClientLiveTests.cs | 245 ++++++++++++++++++ 2 files changed, 246 insertions(+), 1 deletion(-) diff --git a/sdk/cognitivelanguage/Azure.AI.Language.Conversations/assets.json b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/assets.json index 9cb5428ca45e..e40b545956f0 100644 --- a/sdk/cognitivelanguage/Azure.AI.Language.Conversations/assets.json +++ b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/assets.json @@ -2,5 +2,5 @@ "AssetsRepo": "Azure/azure-sdk-assets", "AssetsRepoPrefixPath": "net", "TagPrefix": "net/cognitivelanguage/Azure.AI.Language.Conversations", - "Tag": "net/cognitivelanguage/Azure.AI.Language.Conversations_2e95d6033b" + "Tag": "net/cognitivelanguage/Azure.AI.Language.Conversations_e0c44e83be" } diff --git a/sdk/cognitivelanguage/Azure.AI.Language.Conversations/tests/ConversationsClientLiveTests.cs b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/tests/ConversationsClientLiveTests.cs index 6caf207cc0fd..4900970956c5 100644 --- a/sdk/cognitivelanguage/Azure.AI.Language.Conversations/tests/ConversationsClientLiveTests.cs +++ b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/tests/ConversationsClientLiveTests.cs @@ -322,5 +322,250 @@ public async Task AnalyzeConversation_ConversationSummarization() } } } + + [RecordedTest] + [ServiceVersion(Min = ConversationsClientOptions.ServiceVersion.V2024_11_15_Preview)] + public async Task AnalyzeConversationAsync_ConversationPii_WithCharacterMaskPolicy() + { + // Arrange: Initialize client and input + ConversationAnalysisClient client = Client; + List redactedTexts = new(); + + // Create a CharacterMaskPolicyType with a custom masking character + var redactionPolicy = new CharacterMaskPolicyType + { + RedactionCharacter = RedactionCharacter.Asterisk + }; + + // Simulate input conversation + MultiLanguageConversationInput input = new MultiLanguageConversationInput( + new List + { + new TextConversation("1", "en", new List + { + new TextConversationItem(id: "1", participantId: "Agent_1", text: "Can you provide your name?"), + new TextConversationItem(id: "2", participantId: "Customer_1", text: "Hi, my name is John Doe."), + new TextConversationItem(id: "3", participantId: "Agent_1", text: "Thank you John, that has been updated in our system.") + }) + }); + + // Add action with CharacterMaskPolicyType + List actions = new List + { + new PiiOperationAction + { + ActionContent = new ConversationPiiActionContent + { + RedactionPolicy = redactionPolicy + }, + Name = "Conversation PII with Character Mask Policy" + } + }; + + // Create input for analysis + AnalyzeConversationOperationInput data = new AnalyzeConversationOperationInput(input, actions); + + // Act: Perform the PII analysis + Response analyzeConversationOperation = await client.AnalyzeConversationsAsync(data); + #region Snippet:AnalyzeConversation_ConversationPiiSync + AnalyzeConversationOperationState operationState = analyzeConversationOperation.Value; + #endregion + + // Assert: Validate the results + foreach (AnalyzeConversationOperationResult operationResult in operationState.Actions.Items) + { + Console.WriteLine($"Operation action name: {operationResult.Name}"); + + if (operationResult is ConversationPiiOperationResult piiOperationResult) + { + foreach (ConversationalPiiResult conversation in piiOperationResult.Results.Conversations) + { + Console.WriteLine($"Conversation: #{conversation.Id}"); + foreach (ConversationPiiItemResult item in conversation.ConversationItems) + { + string redactedText = item.RedactedContent?.Text ?? string.Empty; + Console.WriteLine($"Redacted Text: {redactedText}"); + + // Only verify redaction if the original sentence had PII + if (item.Entities.Any()) + { + foreach (var entity in item.Entities) + { + Assert.That(redactedText, Does.Not.Contain(entity.Text), + $"Expected entity '{entity.Text}' to be redacted but found in: {redactedText}"); + + Assert.That(redactedText, Does.Contain("*"), + $"Expected redacted text to contain '*' but got: {redactedText}"); + } + } + } + } + } + } + + // Verify the HTTP response is successful + Assert.That(analyzeConversationOperation.GetRawResponse().Status, Is.EqualTo(200)); + } + + [RecordedTest] + [ServiceVersion(Min = ConversationsClientOptions.ServiceVersion.V2024_11_15_Preview)] + public async Task AnalyzeConversationAsync_ConversationPii_WithEntityMaskPolicy() + { + // Arrange: Initialize client and input + ConversationAnalysisClient client = Client; + List redactedTexts = new(); + + // Create an EntityMaskTypePolicyType + var redactionPolicy = new EntityMaskTypePolicyType(); + + // Simulate input conversation + MultiLanguageConversationInput input = new MultiLanguageConversationInput( + new List + { + new TextConversation("1", "en", new List + { + new TextConversationItem(id: "1", participantId: "Agent_1", text: "Can you provide your name?"), + new TextConversationItem(id: "2", participantId: "Customer_1", text: "Hi, my name is John Doe."), + new TextConversationItem(id: "3", participantId: "Agent_1", text: "Thank you John, that has been updated in our system.") + }) + }); + + // Add action with EntityMaskTypePolicyType + List actions = new List + { + new PiiOperationAction + { + ActionContent = new ConversationPiiActionContent + { + RedactionPolicy = redactionPolicy + }, + Name = "Conversation PII with Entity Mask Policy" + } + }; + + // Create input for analysis + AnalyzeConversationOperationInput data = new AnalyzeConversationOperationInput(input, actions); + + // Act: Perform the PII analysis + Response analyzeConversationOperation = await client.AnalyzeConversationsAsync(data); + AnalyzeConversationOperationState operationState = analyzeConversationOperation.Value; + + // Assert: Validate the results + foreach (AnalyzeConversationOperationResult operationResult in operationState.Actions.Items) + { + Console.WriteLine($"Operation action name: {operationResult.Name}"); + + if (operationResult is ConversationPiiOperationResult piiOperationResult) + { + foreach (ConversationalPiiResult conversation in piiOperationResult.Results.Conversations) + { + Console.WriteLine($"Conversation: #{conversation.Id}"); + foreach (ConversationPiiItemResult item in conversation.ConversationItems) + { + string redactedText = item.RedactedContent?.Text ?? string.Empty; + Console.WriteLine($"Redacted Text: {redactedText}"); + + // Only verify redaction if the original sentence had PII + if (item.Entities.Any()) + { + foreach (var entity in item.Entities) + { + Assert.That(redactedText, Does.Not.Contain(entity.Text), + $"Expected entity '{entity.Text}' to be redacted but found in: {redactedText}"); + + // Case-insensitive pattern to match entity mask variations + string expectedMaskPattern = $@"\[{entity.Category}-?\d*\]"; + + // Perform case-insensitive regex match + StringAssert.IsMatch("(?i)" + expectedMaskPattern, redactedText, + $"Expected redacted text to contain an entity mask similar to '[{entity.Category}]' but got: {redactedText}"); + } + } + } + } + } + } + // Verify the HTTP response is successful + Assert.That(analyzeConversationOperation.GetRawResponse().Status, Is.EqualTo(200)); + } + + [RecordedTest] + [ServiceVersion(Min = ConversationsClientOptions.ServiceVersion.V2024_11_15_Preview)] + public async Task AnalyzeConversationAsync_ConversationPii_WithNoMaskPolicy() + { + // Arrange: Initialize client and input + ConversationAnalysisClient client = Client; + List detectedEntities = new(); + + // Create a NoMaskPolicyType (PII should be detected but not redacted) + var redactionPolicy = new NoMaskPolicyType(); + + // Simulate input conversation + MultiLanguageConversationInput input = new MultiLanguageConversationInput( + new List + { + new TextConversation("1", "en", new List + { + new TextConversationItem(id: "1", participantId: "Agent_1", text: "Can you provide your name?"), + new TextConversationItem(id: "2", participantId: "Customer_1", text: "Hi, my name is John Doe."), + new TextConversationItem(id: "3", participantId: "Agent_1", text: "Thank you John, that has been updated in our system.") + }) + }); + + // Add action with NoMaskPolicyType + List actions = new List + { + new PiiOperationAction + { + ActionContent = new ConversationPiiActionContent + { + RedactionPolicy = redactionPolicy + }, + Name = "Conversation PII with No Mask Policy" + } + }; + + // Create input for analysis + AnalyzeConversationOperationInput data = new AnalyzeConversationOperationInput(input, actions); + + // Act: Perform the PII analysis + Response analyzeConversationOperation = await client.AnalyzeConversationsAsync(data); + AnalyzeConversationOperationState operationState = analyzeConversationOperation.Value; + + // Assert: Validate the results + foreach (AnalyzeConversationOperationResult operationResult in operationState.Actions.Items) + { + Console.WriteLine($"Operation action name: {operationResult.Name}"); + + if (operationResult is ConversationPiiOperationResult piiOperationResult) + { + foreach (ConversationalPiiResult conversation in piiOperationResult.Results.Conversations) + { + Console.WriteLine($"Conversation: #{conversation.Id}"); + foreach (ConversationPiiItemResult item in conversation.ConversationItems) + { + string originalText = item.RedactedContent?.Text ?? string.Empty; + Console.WriteLine($"Original Text: {originalText}"); + + // Ensure PII is detected + if (item.Entities.Any()) + { + foreach (var entity in item.Entities) + { + detectedEntities.Add(entity.Text); + Assert.That(originalText, Does.Contain(entity.Text), + $"Expected entity '{entity.Text}' to be present but was not found in: {originalText}"); + } + } + } + } + } + } + // Ensure PII was detected + Assert.NotZero(detectedEntities.Count); + + // Verify the HTTP response is successful + Assert.That(analyzeConversationOperation.GetRawResponse().Status, Is.EqualTo(200)); + } } } From 66a6fdefd130dabbd92935723c30878f67648ec4 Mon Sep 17 00:00:00 2001 From: Xiong Chen Date: Sun, 2 Feb 2025 17:51:43 -0800 Subject: [PATCH 26/31] remove the duplicate snippets --- .../tests/ConversationsClientLiveTests.cs | 2 -- ...yzeConversation_ConversationPiiWithCharacterMaskPolicy.cs | 5 ----- 2 files changed, 7 deletions(-) diff --git a/sdk/cognitivelanguage/Azure.AI.Language.Conversations/tests/ConversationsClientLiveTests.cs b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/tests/ConversationsClientLiveTests.cs index 4900970956c5..7bd55533ac52 100644 --- a/sdk/cognitivelanguage/Azure.AI.Language.Conversations/tests/ConversationsClientLiveTests.cs +++ b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/tests/ConversationsClientLiveTests.cs @@ -367,9 +367,7 @@ public async Task AnalyzeConversationAsync_ConversationPii_WithCharacterMaskPoli // Act: Perform the PII analysis Response analyzeConversationOperation = await client.AnalyzeConversationsAsync(data); - #region Snippet:AnalyzeConversation_ConversationPiiSync AnalyzeConversationOperationState operationState = analyzeConversationOperation.Value; - #endregion // Assert: Validate the results foreach (AnalyzeConversationOperationResult operationResult in operationState.Actions.Items) diff --git a/sdk/cognitivelanguage/Azure.AI.Language.Conversations/tests/Samples/Sample7_AnalyzeConversation_ConversationPiiWithCharacterMaskPolicy.cs b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/tests/Samples/Sample7_AnalyzeConversation_ConversationPiiWithCharacterMaskPolicy.cs index 8e11e6088245..349544f5c48c 100644 --- a/sdk/cognitivelanguage/Azure.AI.Language.Conversations/tests/Samples/Sample7_AnalyzeConversation_ConversationPiiWithCharacterMaskPolicy.cs +++ b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/tests/Samples/Sample7_AnalyzeConversation_ConversationPiiWithCharacterMaskPolicy.cs @@ -58,9 +58,7 @@ public void AnalyzeConversation_ConversationPii_WithCharacterMaskPolicy() // Act: Perform the PII analysis Response analyzeConversationOperation = client.AnalyzeConversations(data); - #region Snippet:AnalyzeConversation_ConversationPiiSync AnalyzeConversationOperationState operationState = analyzeConversationOperation.Value; - #endregion // Assert: Validate the results foreach (AnalyzeConversationOperationResult operationResult in operationState.Actions.Items) { @@ -141,10 +139,7 @@ public async Task AnalyzeConversationAsync_ConversationPii_WithCharacterMaskPoli // Act: Perform the PII analysis Response analyzeConversationOperation = await client.AnalyzeConversationsAsync(data); - #region Snippet:AnalyzeConversation_ConversationPiiSync AnalyzeConversationOperationState operationState = analyzeConversationOperation.Value; - #endregion - // Assert: Validate the results foreach (AnalyzeConversationOperationResult operationResult in operationState.Actions.Items) { From b9cc4973200915c1de0b181127d938126644cfdd Mon Sep 17 00:00:00 2001 From: Xiong Chen Date: Sun, 2 Feb 2025 17:58:01 -0800 Subject: [PATCH 27/31] update some remaining test recordings to 2024-11-15-preview --- .../Azure.AI.Language.Conversations/assets.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sdk/cognitivelanguage/Azure.AI.Language.Conversations/assets.json b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/assets.json index e40b545956f0..b58f5a820368 100644 --- a/sdk/cognitivelanguage/Azure.AI.Language.Conversations/assets.json +++ b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/assets.json @@ -2,5 +2,5 @@ "AssetsRepo": "Azure/azure-sdk-assets", "AssetsRepoPrefixPath": "net", "TagPrefix": "net/cognitivelanguage/Azure.AI.Language.Conversations", - "Tag": "net/cognitivelanguage/Azure.AI.Language.Conversations_e0c44e83be" + "Tag": "net/cognitivelanguage/Azure.AI.Language.Conversations_ace95858ae" } From d6bbe4f5ead69edea579bef9367a53dabf30b2a0 Mon Sep 17 00:00:00 2001 From: Xiong Chen Date: Sun, 2 Feb 2025 18:14:18 -0800 Subject: [PATCH 28/31] udpate the new test for MaskWithEntity --- .../Azure.AI.Language.Conversations/assets.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sdk/cognitivelanguage/Azure.AI.Language.Conversations/assets.json b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/assets.json index b58f5a820368..4830adbbf46c 100644 --- a/sdk/cognitivelanguage/Azure.AI.Language.Conversations/assets.json +++ b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/assets.json @@ -2,5 +2,5 @@ "AssetsRepo": "Azure/azure-sdk-assets", "AssetsRepoPrefixPath": "net", "TagPrefix": "net/cognitivelanguage/Azure.AI.Language.Conversations", - "Tag": "net/cognitivelanguage/Azure.AI.Language.Conversations_ace95858ae" + "Tag": "net/cognitivelanguage/Azure.AI.Language.Conversations_26c3361e25" } From 5e450e58fba2cfd83e04958aaf5b2e6ad9e1eb4c Mon Sep 17 00:00:00 2001 From: Xiong Chen Date: Sun, 2 Feb 2025 21:20:18 -0800 Subject: [PATCH 29/31] Update the snippets for new feature tests --- ...ion_ConversationPiiWithEntityMaskPolicy.md | 103 ++++++++++++++++++ ...rsation_ConversationPiiWithNoMaskPolicy.md | 98 +++++++++++++++++ ..._ConversationPiiWithCharacterMaskPolicy.md | 102 +++++++++++++++++ ..._ConversationPiiWithCharacterMaskPolicy.cs | 11 +- ...ion_ConversationPiiWithEntityMaskPolicy.cs | 10 +- ...rsation_ConversationPiiWithNoMaskPolicy.cs | 13 +-- 6 files changed, 319 insertions(+), 18 deletions(-) create mode 100644 sdk/cognitivelanguage/Azure.AI.Language.Conversations/samples/Sample10_AnalyzeConversation_ConversationPiiWithEntityMaskPolicy.md create mode 100644 sdk/cognitivelanguage/Azure.AI.Language.Conversations/samples/Sample11_AnalyzeConversation_ConversationPiiWithNoMaskPolicy.md create mode 100644 sdk/cognitivelanguage/Azure.AI.Language.Conversations/samples/Sample9_AnalyzeConversation_ConversationPiiWithCharacterMaskPolicy.md diff --git a/sdk/cognitivelanguage/Azure.AI.Language.Conversations/samples/Sample10_AnalyzeConversation_ConversationPiiWithEntityMaskPolicy.md b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/samples/Sample10_AnalyzeConversation_ConversationPiiWithEntityMaskPolicy.md new file mode 100644 index 000000000000..1623030b04e5 --- /dev/null +++ b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/samples/Sample10_AnalyzeConversation_ConversationPiiWithEntityMaskPolicy.md @@ -0,0 +1,103 @@ +# Analyze a Conversation for PII Using Entity Masking + +This sample demonstrates how to detect and redact personally identifiable information (PII) in a conversation using Entity Mask Policy with Conversation PII analysis. 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. + +Start by importing the namespace for the `ConversationAnalysisClient` and related classes: + +```C# Snippet:ConversationAnalysisClient_Namespaces +using Azure.Core; +using Azure.Core.Serialization; +using Azure.AI.Language.Conversations; +``` + +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. + +```C# Snippet:ConversationAnalysisClient_Create +Uri endpoint = new Uri("https://myaccount.cognitiveservices.azure.com"); +AzureKeyCredential credential = new AzureKeyCredential("{api-key}"); + +ConversationAnalysisClient client = new ConversationAnalysisClient(endpoint, credential); +``` + +Once you have created a client, you can call synchronous or asynchronous methods. + +## Asynchronous + +```C# Snippet:AnalyzeConversation_ConversationPiiWithEntityMaskPolicy +var redactionPolicy = new EntityMaskTypePolicyType(); + +MultiLanguageConversationInput input = new MultiLanguageConversationInput( + new List + { + new TextConversation("1", "en", new List + { + new TextConversationItem(id: "1", participantId: "Agent_1", text: "Can you provide your name?"), + new TextConversationItem(id: "2", participantId: "Customer_1", text: "Hi, my name is John Doe."), + new TextConversationItem(id: "3", participantId: "Agent_1", text: "Thank you John, that has been updated in our system.") + }) + }); + +// Add action with EntityMaskTypePolicyType +List actions = new List +{ + new PiiOperationAction + { + ActionContent = new ConversationPiiActionContent + { + RedactionPolicy = redactionPolicy + }, + Name = "Conversation PII with Entity Mask Policy" + } +}; + +// Create input for analysis +AnalyzeConversationOperationInput data = new AnalyzeConversationOperationInput(input, actions); + +// Act: Perform the PII analysis +Response analyzeConversationOperation = await client.AnalyzeConversationsAsync(data); +AnalyzeConversationOperationState operationState = analyzeConversationOperation.Value; + +// Assert: Validate the results +foreach (AnalyzeConversationOperationResult operationResult in operationState.Actions.Items) +{ + Console.WriteLine($"Operation action name: {operationResult.Name}"); + + if (operationResult is ConversationPiiOperationResult piiOperationResult) + { + foreach (ConversationalPiiResult conversation in piiOperationResult.Results.Conversations) + { + Console.WriteLine($"Conversation: #{conversation.Id}"); + foreach (ConversationPiiItemResult item in conversation.ConversationItems) + { + string redactedText = item.RedactedContent?.Text ?? string.Empty; + Console.WriteLine($"Redacted Text: {redactedText}"); + + // Only verify redaction if the original sentence had PII + if (item.Entities.Any()) + { + foreach (var entity in item.Entities) + { + Assert.That(redactedText, Does.Not.Contain(entity.Text), + $"Expected entity '{entity.Text}' to be redacted but found in: {redactedText}"); + + // Case-insensitive pattern to match entity mask variations + string expectedMaskPattern = $@"\[{entity.Category}-?\d*\]"; + + // Perform case-insensitive regex match + StringAssert.IsMatch("(?i)" + expectedMaskPattern, redactedText, + $"Expected redacted text to contain an entity mask similar to '[{entity.Category}]' but got: {redactedText}"); + } + } + } + } + } +} +``` + +## Synchronous + +Using the same `data` definition above, you can make a synchronous request by calling `AnalyzeConversationOperation`: + +```C# Snippet:AnalyzeConversation_ConversationPiiWithEntityMaskPolicySync +AnalyzeConversationOperationState operationState = analyzeConversationOperation.Value; +``` diff --git a/sdk/cognitivelanguage/Azure.AI.Language.Conversations/samples/Sample11_AnalyzeConversation_ConversationPiiWithNoMaskPolicy.md b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/samples/Sample11_AnalyzeConversation_ConversationPiiWithNoMaskPolicy.md new file mode 100644 index 000000000000..c5f16283d99c --- /dev/null +++ b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/samples/Sample11_AnalyzeConversation_ConversationPiiWithNoMaskPolicy.md @@ -0,0 +1,98 @@ +# Analyze a Conversation for PII With No Masking + +This sample demonstrates how to detect and redact personally identifiable information (PII) in a conversation using No Mask Policy with Conversation PII analysis. 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. + +Start by importing the namespace for the `ConversationAnalysisClient` and related classes: + +```C# Snippet:ConversationAnalysisClient_Namespaces +using Azure.Core; +using Azure.Core.Serialization; +using Azure.AI.Language.Conversations; +``` + +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. + +```C# Snippet:ConversationAnalysisClient_Create +Uri endpoint = new Uri("https://myaccount.cognitiveservices.azure.com"); +AzureKeyCredential credential = new AzureKeyCredential("{api-key}"); + +ConversationAnalysisClient client = new ConversationAnalysisClient(endpoint, credential); +``` + +Once you have created a client, you can call synchronous or asynchronous methods. + +## Asynchronous + +```C# Snippet:AnalyzeConversation_ConversationPiiWithNoMaskPolicy +var redactionPolicy = new NoMaskPolicyType(); + +// Simulate input conversation +MultiLanguageConversationInput input = new MultiLanguageConversationInput( + new List + { + new TextConversation("1", "en", new List + { + new TextConversationItem(id: "1", participantId: "Agent_1", text: "Can you provide your name?"), + new TextConversationItem(id: "2", participantId: "Customer_1", text: "Hi, my name is John Doe."), + new TextConversationItem(id: "3", participantId: "Agent_1", text: "Thank you John, that has been updated in our system.") + }) + }); + +// Add action with NoMaskPolicyType +List actions = new List +{ + new PiiOperationAction + { + ActionContent = new ConversationPiiActionContent + { + RedactionPolicy = redactionPolicy + }, + Name = "Conversation PII with No Mask Policy" + } +}; + +// Create input for analysis +AnalyzeConversationOperationInput data = new AnalyzeConversationOperationInput(input, actions); + +// Act: Perform the PII analysis +Response analyzeConversationOperation = await client.AnalyzeConversationsAsync(data); +AnalyzeConversationOperationState operationState = analyzeConversationOperation.Value; + +// Assert: Validate the results +foreach (AnalyzeConversationOperationResult operationResult in operationState.Actions.Items) +{ + Console.WriteLine($"Operation action name: {operationResult.Name}"); + + if (operationResult is ConversationPiiOperationResult piiOperationResult) + { + foreach (ConversationalPiiResult conversation in piiOperationResult.Results.Conversations) + { + Console.WriteLine($"Conversation: #{conversation.Id}"); + foreach (ConversationPiiItemResult item in conversation.ConversationItems) + { + string originalText = item.RedactedContent?.Text ?? string.Empty; + Console.WriteLine($"Original Text: {originalText}"); + + // Ensure PII is detected + if (item.Entities.Any()) + { + foreach (var entity in item.Entities) + { + detectedEntities.Add(entity.Text); + Assert.That(originalText, Does.Contain(entity.Text), + $"Expected entity '{entity.Text}' to be present but was not found in: {originalText}"); + } + } + } + } + } +} +``` + +## Synchronous + +Using the same `data` definition above, you can make a synchronous request by calling `AnalyzeConversationOperation`: + +```C# Snippet:AnalyzeConversation_ConversationPiiWithNoMaskPolicySync +AnalyzeConversationOperationState operationState = analyzeConversationOperation.Value; +``` diff --git a/sdk/cognitivelanguage/Azure.AI.Language.Conversations/samples/Sample9_AnalyzeConversation_ConversationPiiWithCharacterMaskPolicy.md b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/samples/Sample9_AnalyzeConversation_ConversationPiiWithCharacterMaskPolicy.md new file mode 100644 index 000000000000..4bda60468416 --- /dev/null +++ b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/samples/Sample9_AnalyzeConversation_ConversationPiiWithCharacterMaskPolicy.md @@ -0,0 +1,102 @@ +# Analyze a Conversation for PII Using Character Masking + +This sample demonstrates how to detect and redact personally identifiable information (PII) in a conversation using Character Mask Policy with Conversation PII analysis. 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. + +Start by importing the namespace for the `ConversationAnalysisClient` and related classes: + +```C# Snippet:ConversationAnalysisClient_Namespaces +using Azure.Core; +using Azure.Core.Serialization; +using Azure.AI.Language.Conversations; +``` + +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. + +```C# Snippet:ConversationAnalysisClient_Create +Uri endpoint = new Uri("https://myaccount.cognitiveservices.azure.com"); +AzureKeyCredential credential = new AzureKeyCredential("{api-key}"); + +ConversationAnalysisClient client = new ConversationAnalysisClient(endpoint, credential); +``` + +Once you have created a client, you can call synchronous or asynchronous methods. + +## Asynchronous + +```C# Snippet:AnalyzeConversation_ConversationPiiWithCharacterMaskPolicy +var redactionPolicy = new CharacterMaskPolicyType +{ + RedactionCharacter = RedactionCharacter.Asterisk +}; + +// Simulate input conversation +MultiLanguageConversationInput input = new MultiLanguageConversationInput( + new List + { + new TextConversation("1", "en", new List + { + new TextConversationItem(id: "1", participantId: "Agent_1", text: "Can you provide your name?"), + new TextConversationItem(id: "2", participantId: "Customer_1", text: "Hi, my name is John Doe."), + new TextConversationItem(id: "3", participantId: "Agent_1", text: "Thank you John, that has been updated in our system.") + }) + }); + +// Add action with CharacterMaskPolicyType +List actions = new List +{ + new PiiOperationAction + { + ActionContent = new ConversationPiiActionContent + { + RedactionPolicy = redactionPolicy + }, + Name = "Conversation PII with Character Mask Policy" + } +}; + +// Create input for analysis +AnalyzeConversationOperationInput data = new AnalyzeConversationOperationInput(input, actions); + +// Act: Perform the PII analysis +Response analyzeConversationOperation = await client.AnalyzeConversationsAsync(data); +AnalyzeConversationOperationState operationState = analyzeConversationOperation.Value; +// Assert: Validate the results +foreach (AnalyzeConversationOperationResult operationResult in operationState.Actions.Items) +{ + Console.WriteLine($"Operation action name: {operationResult.Name}"); + + if (operationResult is ConversationPiiOperationResult piiOperationResult) + { + foreach (ConversationalPiiResult conversation in piiOperationResult.Results.Conversations) + { + Console.WriteLine($"Conversation: #{conversation.Id}"); + foreach (ConversationPiiItemResult item in conversation.ConversationItems) + { + string redactedText = item.RedactedContent?.Text ?? string.Empty; + Console.WriteLine($"Redacted Text: {redactedText}"); + + // Only verify redaction if the original sentence had PII + if (item.Entities.Any()) + { + foreach (var entity in item.Entities) + { + Assert.That(redactedText, Does.Not.Contain(entity.Text), + $"Expected entity '{entity.Text}' to be redacted but found in: {redactedText}"); + + Assert.That(redactedText, Does.Contain("*"), + $"Expected redacted text to contain '*' but got: {redactedText}"); + } + } + } + } + } +} +``` + +## Synchronous + +Using the same `data` definition above, you can make a synchronous request by calling `AnalyzeConversationOperation`: + +```C# Snippet:AnalyzeConversation_ConversationPiiWithCharacterMaskPolicySync +AnalyzeConversationOperationState operationState = analyzeConversationOperation.Value; +``` diff --git a/sdk/cognitivelanguage/Azure.AI.Language.Conversations/tests/Samples/Sample7_AnalyzeConversation_ConversationPiiWithCharacterMaskPolicy.cs b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/tests/Samples/Sample7_AnalyzeConversation_ConversationPiiWithCharacterMaskPolicy.cs index 349544f5c48c..b22a01809b70 100644 --- a/sdk/cognitivelanguage/Azure.AI.Language.Conversations/tests/Samples/Sample7_AnalyzeConversation_ConversationPiiWithCharacterMaskPolicy.cs +++ b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/tests/Samples/Sample7_AnalyzeConversation_ConversationPiiWithCharacterMaskPolicy.cs @@ -53,13 +53,13 @@ public void AnalyzeConversation_ConversationPii_WithCharacterMaskPolicy() } }; - // Create input for analysis AnalyzeConversationOperationInput data = new AnalyzeConversationOperationInput(input, actions); - // Act: Perform the PII analysis Response analyzeConversationOperation = client.AnalyzeConversations(data); + + #region Snippet:AnalyzeConversation_ConversationPiiWithCharacterMaskPolicySync AnalyzeConversationOperationState operationState = analyzeConversationOperation.Value; - // Assert: Validate the results + #endregion foreach (AnalyzeConversationOperationResult operationResult in operationState.Actions.Items) { Console.WriteLine($"Operation action name: {operationResult.Name}"); @@ -99,11 +99,10 @@ public void AnalyzeConversation_ConversationPii_WithCharacterMaskPolicy() [ServiceVersion(Min = ConversationsClientOptions.ServiceVersion.V2024_11_15_Preview)] public async Task AnalyzeConversationAsync_ConversationPii_WithCharacterMaskPolicy() { - // Arrange: Initialize client and input ConversationAnalysisClient client = Client; List redactedTexts = new(); - // Create a CharacterMaskPolicyType with a custom masking character + #region Snippet:AnalyzeConversation_ConversationPiiWithCharacterMaskPolicy var redactionPolicy = new CharacterMaskPolicyType { RedactionCharacter = RedactionCharacter.Asterisk @@ -171,7 +170,7 @@ public async Task AnalyzeConversationAsync_ConversationPii_WithCharacterMaskPoli } } } - + #endregion // Verify the HTTP response is successful Assert.That(analyzeConversationOperation.GetRawResponse().Status, Is.EqualTo(200)); } diff --git a/sdk/cognitivelanguage/Azure.AI.Language.Conversations/tests/Samples/Sample8_AnalyzeConversation_ConversationPiiWithEntityMaskPolicy.cs b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/tests/Samples/Sample8_AnalyzeConversation_ConversationPiiWithEntityMaskPolicy.cs index 12a740f30ce5..25106b4c7dab 100644 --- a/sdk/cognitivelanguage/Azure.AI.Language.Conversations/tests/Samples/Sample8_AnalyzeConversation_ConversationPiiWithEntityMaskPolicy.cs +++ b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/tests/Samples/Sample8_AnalyzeConversation_ConversationPiiWithEntityMaskPolicy.cs @@ -51,12 +51,12 @@ public void AnalyzeConversation_ConversationPii_WithEntityMaskPolicy() } }; - // Create input for analysis AnalyzeConversationOperationInput data = new AnalyzeConversationOperationInput(input, actions); - // Act: Perform the PII analysis Response analyzeConversationOperation = client.AnalyzeConversations(data); + #region Snippet:AnalyzeConversation_ConversationPiiWithEntityMaskPolicySync AnalyzeConversationOperationState operationState = analyzeConversationOperation.Value; + #endregion // Assert: Validate the results foreach (AnalyzeConversationOperationResult operationResult in operationState.Actions.Items) @@ -106,10 +106,9 @@ public async Task AnalyzeConversationAsync_ConversationPii_WithEntityMaskPolicy( ConversationAnalysisClient client = Client; List redactedTexts = new(); - // Create an EntityMaskTypePolicyType + #region Snippet:AnalyzeConversation_ConversationPiiWithEntityMaskPolicy var redactionPolicy = new EntityMaskTypePolicyType(); - // Simulate input conversation MultiLanguageConversationInput input = new MultiLanguageConversationInput( new List { @@ -176,7 +175,8 @@ public async Task AnalyzeConversationAsync_ConversationPii_WithEntityMaskPolicy( } } } - // Verify the HTTP response is successful + #endregion + Assert.That(analyzeConversationOperation.GetRawResponse().Status, Is.EqualTo(200)); } } diff --git a/sdk/cognitivelanguage/Azure.AI.Language.Conversations/tests/Samples/Sample9_AnalyzeConversation_ConversationPiiWithNoMaskPolicy.cs b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/tests/Samples/Sample9_AnalyzeConversation_ConversationPiiWithNoMaskPolicy.cs index 3f0244d6dffb..240993c18938 100644 --- a/sdk/cognitivelanguage/Azure.AI.Language.Conversations/tests/Samples/Sample9_AnalyzeConversation_ConversationPiiWithNoMaskPolicy.cs +++ b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/tests/Samples/Sample9_AnalyzeConversation_ConversationPiiWithNoMaskPolicy.cs @@ -51,13 +51,13 @@ public void AnalyzeConversation_ConversationPii_WithNoMaskPolicy() } }; - // Create input for analysis AnalyzeConversationOperationInput data = new AnalyzeConversationOperationInput(input, actions); - // Act: Perform the PII analysis Response analyzeConversationOperation = client.AnalyzeConversations(data); - AnalyzeConversationOperationState operationState = analyzeConversationOperation.Value; + #region Snippet:AnalyzeConversation_ConversationPiiWithNoMaskPolicySync + AnalyzeConversationOperationState operationState = analyzeConversationOperation.Value; + #endregion // Assert: Validate the results foreach (AnalyzeConversationOperationResult operationResult in operationState.Actions.Items) { @@ -103,7 +103,7 @@ public async Task AnalyzeConversationAsync_ConversationPii_WithNoMaskPolicy() ConversationAnalysisClient client = Client; List detectedEntities = new(); - // Create a NoMaskPolicyType (PII should be detected but not redacted) + #region Snippet:AnalyzeConversation_ConversationPiiWithNoMaskPolicy var redactionPolicy = new NoMaskPolicyType(); // Simulate input conversation @@ -167,10 +167,9 @@ public async Task AnalyzeConversationAsync_ConversationPii_WithNoMaskPolicy() } } } - // Ensure PII was detected - Assert.NotZero(detectedEntities.Count); + #endregion - // Verify the HTTP response is successful + Assert.NotZero(detectedEntities.Count); Assert.That(analyzeConversationOperation.GetRawResponse().Status, Is.EqualTo(200)); } } From de6b53d6b93cb314ac2ad727e64c7b2c9c2323f9 Mon Sep 17 00:00:00 2001 From: Xiong Chen Date: Sun, 2 Feb 2025 22:27:07 -0800 Subject: [PATCH 30/31] update the snippets for the general README file. --- .../Azure.AI.Language.Conversations/README.md | 219 ++++++++++++++++++ 1 file changed, 219 insertions(+) diff --git a/sdk/cognitivelanguage/Azure.AI.Language.Conversations/README.md b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/README.md index b4c9ac591b90..f8e04eceda6f 100644 --- a/sdk/cognitivelanguage/Azure.AI.Language.Conversations/README.md +++ b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/README.md @@ -482,6 +482,225 @@ foreach (AnalyzeConversationOperationResult operationResult in operationState.Ac } ``` +### Extract PII from a conversation With Character Mask Policy + +To detect and redact PII in a conversation using Character Mask Policy, you can use the `AnalyzeConversationsAsync` method overload with an action of type `PiiOperationAction` and utilize `CharacterMaskPolicyType` to define the RedactionCharacter (e.g., an asterisk *) to replace sensitive information. The method returns a `Response`:: + +```C# Snippet:AnalyzeConversation_ConversationPiiWithCharacterMaskPolicy +var redactionPolicy = new CharacterMaskPolicyType +{ + RedactionCharacter = RedactionCharacter.Asterisk +}; + +// Simulate input conversation +MultiLanguageConversationInput input = new MultiLanguageConversationInput( + new List + { + new TextConversation("1", "en", new List + { + new TextConversationItem(id: "1", participantId: "Agent_1", text: "Can you provide your name?"), + new TextConversationItem(id: "2", participantId: "Customer_1", text: "Hi, my name is John Doe."), + new TextConversationItem(id: "3", participantId: "Agent_1", text: "Thank you John, that has been updated in our system.") + }) + }); + +// Add action with CharacterMaskPolicyType +List actions = new List +{ + new PiiOperationAction + { + ActionContent = new ConversationPiiActionContent + { + RedactionPolicy = redactionPolicy + }, + Name = "Conversation PII with Character Mask Policy" + } +}; + +// Create input for analysis +AnalyzeConversationOperationInput data = new AnalyzeConversationOperationInput(input, actions); + +// Act: Perform the PII analysis +Response analyzeConversationOperation = await client.AnalyzeConversationsAsync(data); +AnalyzeConversationOperationState operationState = analyzeConversationOperation.Value; +// Assert: Validate the results +foreach (AnalyzeConversationOperationResult operationResult in operationState.Actions.Items) +{ + Console.WriteLine($"Operation action name: {operationResult.Name}"); + + if (operationResult is ConversationPiiOperationResult piiOperationResult) + { + foreach (ConversationalPiiResult conversation in piiOperationResult.Results.Conversations) + { + Console.WriteLine($"Conversation: #{conversation.Id}"); + foreach (ConversationPiiItemResult item in conversation.ConversationItems) + { + string redactedText = item.RedactedContent?.Text ?? string.Empty; + Console.WriteLine($"Redacted Text: {redactedText}"); + + // Only verify redaction if the original sentence had PII + if (item.Entities.Any()) + { + foreach (var entity in item.Entities) + { + Assert.That(redactedText, Does.Not.Contain(entity.Text), + $"Expected entity '{entity.Text}' to be redacted but found in: {redactedText}"); + + Assert.That(redactedText, Does.Contain("*"), + $"Expected redacted text to contain '*' but got: {redactedText}"); + } + } + } + } + } +} +``` + +### Extract PII from a conversation With Entity Mask Policy + +To detect and redact PII in a conversation using Character Mask Policy, you can use the `AnalyzeConversationsAsync` method overload with an action of type `PiiOperationAction` and utilize `EntityMaskTypePolicyType` as Mask Policy to replace sensitive information. The method returns a `Response`:: + +```C# Snippet:AnalyzeConversation_ConversationPiiWithEntityMaskPolicy +var redactionPolicy = new EntityMaskTypePolicyType(); + +MultiLanguageConversationInput input = new MultiLanguageConversationInput( + new List + { + new TextConversation("1", "en", new List + { + new TextConversationItem(id: "1", participantId: "Agent_1", text: "Can you provide your name?"), + new TextConversationItem(id: "2", participantId: "Customer_1", text: "Hi, my name is John Doe."), + new TextConversationItem(id: "3", participantId: "Agent_1", text: "Thank you John, that has been updated in our system.") + }) + }); + +// Add action with EntityMaskTypePolicyType +List actions = new List +{ + new PiiOperationAction + { + ActionContent = new ConversationPiiActionContent + { + RedactionPolicy = redactionPolicy + }, + Name = "Conversation PII with Entity Mask Policy" + } +}; + +// Create input for analysis +AnalyzeConversationOperationInput data = new AnalyzeConversationOperationInput(input, actions); + +// Act: Perform the PII analysis +Response analyzeConversationOperation = await client.AnalyzeConversationsAsync(data); +AnalyzeConversationOperationState operationState = analyzeConversationOperation.Value; + +// Assert: Validate the results +foreach (AnalyzeConversationOperationResult operationResult in operationState.Actions.Items) +{ + Console.WriteLine($"Operation action name: {operationResult.Name}"); + + if (operationResult is ConversationPiiOperationResult piiOperationResult) + { + foreach (ConversationalPiiResult conversation in piiOperationResult.Results.Conversations) + { + Console.WriteLine($"Conversation: #{conversation.Id}"); + foreach (ConversationPiiItemResult item in conversation.ConversationItems) + { + string redactedText = item.RedactedContent?.Text ?? string.Empty; + Console.WriteLine($"Redacted Text: {redactedText}"); + + // Only verify redaction if the original sentence had PII + if (item.Entities.Any()) + { + foreach (var entity in item.Entities) + { + Assert.That(redactedText, Does.Not.Contain(entity.Text), + $"Expected entity '{entity.Text}' to be redacted but found in: {redactedText}"); + + // Case-insensitive pattern to match entity mask variations + string expectedMaskPattern = $@"\[{entity.Category}-?\d*\]"; + + // Perform case-insensitive regex match + StringAssert.IsMatch("(?i)" + expectedMaskPattern, redactedText, + $"Expected redacted text to contain an entity mask similar to '[{entity.Category}]' but got: {redactedText}"); + } + } + } + } + } +} +``` + +### Extract PII from a conversation With Character Mask Policy + +To detect and redact PII in a conversation using No Mask Policy, you can use the `AnalyzeConversationsAsync` method overload with an action of type `PiiOperationAction` and utilize `NoMaskPolicyType` as Mask Policy. The method returns a `Response`:: + +```C# Snippet:AnalyzeConversation_ConversationPiiWithNoMaskPolicy +var redactionPolicy = new NoMaskPolicyType(); + +// Simulate input conversation +MultiLanguageConversationInput input = new MultiLanguageConversationInput( + new List + { + new TextConversation("1", "en", new List + { + new TextConversationItem(id: "1", participantId: "Agent_1", text: "Can you provide your name?"), + new TextConversationItem(id: "2", participantId: "Customer_1", text: "Hi, my name is John Doe."), + new TextConversationItem(id: "3", participantId: "Agent_1", text: "Thank you John, that has been updated in our system.") + }) + }); + +// Add action with NoMaskPolicyType +List actions = new List +{ + new PiiOperationAction + { + ActionContent = new ConversationPiiActionContent + { + RedactionPolicy = redactionPolicy + }, + Name = "Conversation PII with No Mask Policy" + } +}; + +// Create input for analysis +AnalyzeConversationOperationInput data = new AnalyzeConversationOperationInput(input, actions); + +// Act: Perform the PII analysis +Response analyzeConversationOperation = await client.AnalyzeConversationsAsync(data); +AnalyzeConversationOperationState operationState = analyzeConversationOperation.Value; + +// Assert: Validate the results +foreach (AnalyzeConversationOperationResult operationResult in operationState.Actions.Items) +{ + Console.WriteLine($"Operation action name: {operationResult.Name}"); + + if (operationResult is ConversationPiiOperationResult piiOperationResult) + { + foreach (ConversationalPiiResult conversation in piiOperationResult.Results.Conversations) + { + Console.WriteLine($"Conversation: #{conversation.Id}"); + foreach (ConversationPiiItemResult item in conversation.ConversationItems) + { + string originalText = item.RedactedContent?.Text ?? string.Empty; + Console.WriteLine($"Original Text: {originalText}"); + + // Ensure PII is detected + if (item.Entities.Any()) + { + foreach (var entity in item.Entities) + { + detectedEntities.Add(entity.Text); + Assert.That(originalText, Does.Contain(entity.Text), + $"Expected entity '{entity.Text}' to be present but was not found in: {originalText}"); + } + } + } + } + } +} +``` + ### Additional samples Browse our [samples][conversationanalysis_samples] for more examples of how to analyze conversations. From c4a94b2d012015693a003b57130178785e5ce40d Mon Sep 17 00:00:00 2001 From: Xiong Chen Date: Sun, 2 Feb 2025 22:59:17 -0800 Subject: [PATCH 31/31] updated the change log --- .../Azure.AI.Language.Conversations/CHANGELOG.md | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/sdk/cognitivelanguage/Azure.AI.Language.Conversations/CHANGELOG.md b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/CHANGELOG.md index 5c7d97bc0506..4d058ccc1ce9 100644 --- a/sdk/cognitivelanguage/Azure.AI.Language.Conversations/CHANGELOG.md +++ b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/CHANGELOG.md @@ -1,17 +1,18 @@ # Release History -## 2.0.0-beta.2 (2025-01-13) +## 2.0.0-beta.2 (2025-02-03) ### Features Added -- Exposed `JsonModelWriteCore` for model serialization procedure. +- Added three differenct type of Redaction Policy `CharacterMaskPolicyType`, `EntityMaskTypePolicyType` and `NoMaskPolicyType` for the function `AnalyzeConversations` - Added support for analyze-conversation API Versions - 2024-11-01 - 2024-11-15-preview ### Other Changes -- Removed support for analyze-conversation API Versions - - 2023-11-15-preview + +- Changed property `CreditCardNumberValue` to `CreditCardValue` and `PhoneNumberValue` to `PhoneValue` for class `ConversationPiiCategoryExclusions` +- Added a new `Instruction` property to class `ConversationSummarizationActionContent` ## 2.0.0-beta.1 (2024-08-01)