From 9036b06afa28ea4213040807fa2be8f85af94ed7 Mon Sep 17 00:00:00 2001 From: Heath Stewart Date: Wed, 31 May 2023 09:33:59 -0700 Subject: [PATCH] Resolve architect feedback (#36637) Resolves #36514 --- .../CHANGELOG.md | 4 + .../Azure.AI.Language.Conversations/README.md | 2 +- ...I.Language.Conversations.netstandard2.0.cs | 28 +- ...eConversation_ConversationSummarization.md | 4 +- .../src/ConversationAnalysisClient.cs | 188 ------------- .../src/ConversationsAudience.cs | 2 +- .../src/ConversationsClientOptions.cs | 2 +- .../Generated/ConversationAnalysisClient.cs | 44 +-- .../Docs/ConversationAnalysisClient.xml | 236 +++++++++++++++- .../src/autorest.md | 9 +- .../ConversationAnalysisClientLiveTests.cs | 2 +- .../Samples_ConversationAnalysisClient.cs | 252 +++++++++++++++++- ...eConversation_ConversationSummarization.cs | 4 +- 13 files changed, 512 insertions(+), 265 deletions(-) diff --git a/sdk/cognitivelanguage/Azure.AI.Language.Conversations/CHANGELOG.md b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/CHANGELOG.md index a6662af1d8430..2b6511e636bd6 100644 --- a/sdk/cognitivelanguage/Azure.AI.Language.Conversations/CHANGELOG.md +++ b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/CHANGELOG.md @@ -14,6 +14,8 @@ The following changes are only breaking from the previous beta. They are not bre - Removed support for service version 2022-10-01-preview. - Removed support for "ConversationalPIITask" analysis. - Removed support for "ConversationalSentimentTask" analysis. +- Removed `ConversationsAudience`. +- Removed `ConversationsClientOptions.Audience`. - Removed `ConversationAuthoringClient.AssignDeploymentResources` and `AssignDeploymentResourcesAsync`. - Removed `ConversationAuthoringClient.DeleteDeploymentFromResources` and `DeleteDeploymentFromResourcesAsync`. - Removed `ConversationAuthoringClient.GetAssignDeploymentResourcesStatus` and `GetAssignDeploymentResourcesStatusAsync`. @@ -22,6 +24,8 @@ The following changes are only breaking from the previous beta. They are not bre - Removed `ConversationAuthoringClient.GetDeploymentResources` and `GetDeploymentResourcesAsync`. - Removed `ConversationAuthoringClient.GetUnassignDeploymentResourcesStatus` and `GetUnassignDeploymentResourcesStatusAsync`. - Removed `ConversationAuthoringClient.UnassignDeploymentResources` and `UnassignDeploymentResourcesAsync`. +- Renamed `ConversationAnalysisClient.AnalyzeConversation` and `AnalyzeConversationAsync` that took a `WaitUntil` parameter to `AnalyzeConversations` and `AnalyzeConversationsAsync`. +- Renamed `ConversationAnalysisClient.CancelAnalyzeConversationJob` and `CancelAnalyzeConversationJobAsync` to `CancelAnalyzeConversations` and `CancelAnalyzeConversationsAsync`. ### Bugs Fixed diff --git a/sdk/cognitivelanguage/Azure.AI.Language.Conversations/README.md b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/README.md index 4b06cd4429fa7..1cf4b12b447a7 100644 --- a/sdk/cognitivelanguage/Azure.AI.Language.Conversations/README.md +++ b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/README.md @@ -400,7 +400,7 @@ var data = new }, }; -Operation analyzeConversationOperation = client.AnalyzeConversation(WaitUntil.Completed, RequestContent.Create(data)); +Operation analyzeConversationOperation = client.AnalyzeConversations(WaitUntil.Completed, RequestContent.Create(data)); using JsonDocument result = JsonDocument.Parse(analyzeConversationOperation.Value.ToStream()); JsonElement jobResults = result.RootElement; 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 ffb73b8605ba9..533c411f4cb6a 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 @@ -10,37 +10,17 @@ public ConversationAnalysisClient(System.Uri endpoint, Azure.Core.TokenCredentia public virtual System.Uri Endpoint { get { throw null; } } public virtual Azure.Core.Pipeline.HttpPipeline Pipeline { get { throw null; } } public virtual Azure.Response AnalyzeConversation(Azure.Core.RequestContent content, Azure.RequestContext context = null) { throw null; } - public virtual Azure.Operation AnalyzeConversation(Azure.WaitUntil waitUntil, Azure.Core.RequestContent content, Azure.RequestContext context = null) { throw null; } public virtual System.Threading.Tasks.Task AnalyzeConversationAsync(Azure.Core.RequestContent content, Azure.RequestContext context = null) { throw null; } - public virtual System.Threading.Tasks.Task> AnalyzeConversationAsync(Azure.WaitUntil waitUntil, Azure.Core.RequestContent content, Azure.RequestContext context = null) { throw null; } - public virtual Azure.Operation CancelAnalyzeConversationJob(Azure.WaitUntil waitUntil, System.Guid jobId, Azure.RequestContext context = null) { throw null; } - public virtual System.Threading.Tasks.Task CancelAnalyzeConversationJobAsync(Azure.WaitUntil waitUntil, System.Guid jobId, Azure.RequestContext context = null) { throw null; } + public virtual Azure.Operation AnalyzeConversations(Azure.WaitUntil waitUntil, Azure.Core.RequestContent content, Azure.RequestContext context = null) { throw null; } + public virtual System.Threading.Tasks.Task> AnalyzeConversationsAsync(Azure.WaitUntil waitUntil, Azure.Core.RequestContent content, Azure.RequestContext context = null) { throw null; } + public virtual Azure.Operation CancelAnalyzeConversations(Azure.WaitUntil waitUntil, System.Guid jobId, Azure.RequestContext context = null) { throw null; } + public virtual System.Threading.Tasks.Task CancelAnalyzeConversationsAsync(Azure.WaitUntil waitUntil, System.Guid jobId, Azure.RequestContext context = null) { throw null; } public virtual Azure.Response GetAnalyzeConversationJobStatus(System.Guid jobId, bool? showStats = default(bool?), Azure.RequestContext context = null) { throw null; } public virtual System.Threading.Tasks.Task GetAnalyzeConversationJobStatusAsync(System.Guid jobId, bool? showStats = default(bool?), Azure.RequestContext context = null) { throw null; } } - [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] - public readonly partial struct ConversationsAudience : System.IEquatable - { - private readonly object _dummy; - private readonly int _dummyPrimitive; - public ConversationsAudience(string value) { throw null; } - public static Azure.AI.Language.Conversations.ConversationsAudience AzureChina { get { throw null; } } - public static Azure.AI.Language.Conversations.ConversationsAudience AzureGovernment { get { throw null; } } - public static Azure.AI.Language.Conversations.ConversationsAudience AzurePublicCloud { get { throw null; } } - public bool Equals(Azure.AI.Language.Conversations.ConversationsAudience other) { throw null; } - [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] - public override bool Equals(object obj) { throw null; } - [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] - public override int GetHashCode() { throw null; } - public static bool operator ==(Azure.AI.Language.Conversations.ConversationsAudience left, Azure.AI.Language.Conversations.ConversationsAudience right) { throw null; } - public static implicit operator Azure.AI.Language.Conversations.ConversationsAudience (string value) { throw null; } - public static bool operator !=(Azure.AI.Language.Conversations.ConversationsAudience left, Azure.AI.Language.Conversations.ConversationsAudience right) { throw null; } - public override string ToString() { throw null; } - } public partial class ConversationsClientOptions : Azure.Core.ClientOptions { public ConversationsClientOptions(Azure.AI.Language.Conversations.ConversationsClientOptions.ServiceVersion version = Azure.AI.Language.Conversations.ConversationsClientOptions.ServiceVersion.V2023_04_01) { } - public Azure.AI.Language.Conversations.ConversationsAudience? Audience { get { throw null; } set { } } public enum ServiceVersion { V2022_05_01 = 1, diff --git a/sdk/cognitivelanguage/Azure.AI.Language.Conversations/samples/Sample6_AnalyzeConversation_ConversationSummarization.md b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/samples/Sample6_AnalyzeConversation_ConversationSummarization.md index 7d6bed86a9bb0..1132652d49b0d 100644 --- a/sdk/cognitivelanguage/Azure.AI.Language.Conversations/samples/Sample6_AnalyzeConversation_ConversationSummarization.md +++ b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/samples/Sample6_AnalyzeConversation_ConversationSummarization.md @@ -83,7 +83,7 @@ var data = new }, }; -Operation analyzeConversationOperation = client.AnalyzeConversation(WaitUntil.Completed, RequestContent.Create(data)); +Operation analyzeConversationOperation = client.AnalyzeConversations(WaitUntil.Completed, RequestContent.Create(data)); using JsonDocument result = JsonDocument.Parse(analyzeConversationOperation.Value.ToStream()); JsonElement jobResults = result.RootElement; @@ -110,5 +110,5 @@ foreach (JsonElement task in jobResults.GetProperty("tasks").GetProperty("items" Using the same `data` definition above, you can make an asynchronous request by calling `AnalyzeConversationAsync`: ```C# Snippet:AnalyzeConversationAsync_ConversationSummarization -Operation analyzeConversationOperation = await client.AnalyzeConversationAsync(WaitUntil.Completed, RequestContent.Create(data)); +Operation analyzeConversationOperation = await client.AnalyzeConversationsAsync(WaitUntil.Completed, RequestContent.Create(data)); ``` diff --git a/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/ConversationAnalysisClient.cs b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/ConversationAnalysisClient.cs index 8408c7ddd3549..01ea568a554a9 100644 --- a/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/ConversationAnalysisClient.cs +++ b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/ConversationAnalysisClient.cs @@ -74,193 +74,5 @@ public ConversationAnalysisClient(Uri endpoint, TokenCredential credential, Conv /// Gets the service endpoint for this client. /// public virtual Uri Endpoint => _endpoint; - - /// Submit a collection of conversations for analysis. Specify one or more unique tasks to be executed. - /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. - /// The content to send as the body of the request. Details of the request body schema are in the Remarks section below. - /// The request context, which can override default behaviors of the client pipeline on a per-call basis. - /// is null. - /// Service returned a non-success status code. - /// The from the service that will contain a object once the asynchronous operation on the service has completed. Details of the body schema for the operation's final value are in the Remarks section below. - /// - /// Below is the JSON schema for the request and response payloads. - /// - /// Request Body: - /// - /// Schema for AnalyzeConversationJobsInput: - /// { - /// displayName: string, # Optional. Optional display name for the analysis job. - /// analysisInput: { - /// conversations: [ - /// { - /// id: string, # Required. Unique identifier for the conversation. - /// language: string, # Required. The language of the conversation item in BCP-47 format. - /// modality: "transcript" | "text", # Required. Enumeration of supported conversational modalities. - /// domain: "finance" | "healthcare" | "generic", # Optional. Enumeration of supported conversational domains. - /// } - /// ], # Required. - /// }, # Required. - /// tasks: [ - /// { - /// taskName: string, # Optional. - /// kind: "ConversationalPIITask" | "ConversationalSummarizationTask", # Required. Enumeration of supported analysis tasks on a collection of conversations. - /// } - /// ], # Required. The set of tasks to execute on the input conversation. - /// } - /// - /// - /// Response Body: - /// - /// Schema for AnalyzeConversationJobState: - /// { - /// displayName: string, # Optional. - /// createdDateTime: string (ISO 8601 Format), # Required. - /// expirationDateTime: string (ISO 8601 Format), # Optional. - /// jobId: string, # Required. - /// lastUpdatedDateTime: string (ISO 8601 Format), # Required. - /// status: "notStarted" | "running" | "succeeded" | "partiallyCompleted" | "failed" | "cancelled" | "cancelling", # Required. - /// errors: [ - /// { - /// code: "InvalidRequest" | "InvalidArgument" | "Unauthorized" | "Forbidden" | "NotFound" | "ProjectNotFound" | "OperationNotFound" | "AzureCognitiveSearchNotFound" | "AzureCognitiveSearchIndexNotFound" | "TooManyRequests" | "AzureCognitiveSearchThrottling" | "AzureCognitiveSearchIndexLimitReached" | "InternalServerError" | "ServiceUnavailable" | "Timeout" | "QuotaExceeded" | "Conflict" | "Warning", # Required. One of a server-defined set of error codes. - /// message: string, # Required. A human-readable representation of the error. - /// target: string, # Optional. The target of the error. - /// details: [Error], # Optional. An array of details about specific errors that led to this reported error. - /// innererror: { - /// code: "InvalidRequest" | "InvalidParameterValue" | "KnowledgeBaseNotFound" | "AzureCognitiveSearchNotFound" | "AzureCognitiveSearchThrottling" | "ExtractionFailure" | "InvalidRequestBodyFormat" | "EmptyRequest" | "MissingInputDocuments" | "InvalidDocument" | "ModelVersionIncorrect" | "InvalidDocumentBatch" | "UnsupportedLanguageCode" | "InvalidCountryHint", # Required. One of a server-defined set of error codes. - /// message: string, # Required. Error message. - /// details: Dictionary<string, string>, # Optional. Error details. - /// target: string, # Optional. Error target. - /// innererror: InnerErrorModel, # Optional. An object containing more specific information than the current object about the error. - /// }, # Optional. An object containing more specific information than the current object about the error. - /// } - /// ], # Optional. - /// nextLink: string, # Optional. - /// tasks: { - /// completed: number, # Required. Count of tasks completed successfully. - /// failed: number, # Required. Count of tasks that failed. - /// inProgress: number, # Required. Count of tasks in progress currently. - /// total: number, # Required. Total count of tasks submitted as part of the job. - /// items: [ - /// { - /// lastUpdateDateTime: string (ISO 8601 Format), # Required. The last updated time in UTC for the task. - /// status: "notStarted" | "running" | "succeeded" | "failed" | "cancelled" | "cancelling", # Required. The status of the task at the mentioned last update time. - /// taskName: string, # Optional. - /// kind: "ConversationalPIIResults" | "ConversationalSummarizationResults", # Required. Enumeration of supported Conversation Analysis task results. - /// } - /// ], # Optional. List of results from tasks (if available). - /// }, # Required. - /// statistics: { - /// transactionsCount: number, # Required. Number of transactions for the request. - /// conversationsCount: number, # Required. Number of conversations submitted in the request. - /// validConversationsCount: number, # Required. Number of conversations documents. This excludes empty, over-size limit or non-supported languages documents. - /// erroneousConversationsCount: number, # Required. Number of invalid documents. This includes empty, over-size limit or non-supported languages documents. - /// }, # Optional. if showStats=true was specified in the request this field will contain information about the request payload. - /// } - /// - /// - /// - public virtual async Task> AnalyzeConversationAsync(WaitUntil waitUntil, RequestContent content, RequestContext context = null) - { - Argument.AssertNotNull(content, nameof(content)); - - using var scope = ClientDiagnostics.CreateScope($"{nameof(ConversationAnalysisClient)}.{nameof(AnalyzeConversation)}"); - scope.Start(); - - return await StartAnalyzeConversationAsync(waitUntil, content, context).ConfigureAwait(false); - } - - /// Submit a collection of conversations for analysis. Specify one or more unique tasks to be executed. - /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. - /// The content to send as the body of the request. Details of the request body schema are in the Remarks section below. - /// The request context, which can override default behaviors of the client pipeline on a per-call basis. - /// is null. - /// Service returned a non-success status code. - /// The from the service that will contain a object once the asynchronous operation on the service has completed. Details of the body schema for the operation's final value are in the Remarks section below. - /// - /// Below is the JSON schema for the request and response payloads. - /// - /// Request Body: - /// - /// Schema for AnalyzeConversationJobsInput: - /// { - /// displayName: string, # Optional. Optional display name for the analysis job. - /// analysisInput: { - /// conversations: [ - /// { - /// id: string, # Required. Unique identifier for the conversation. - /// language: string, # Required. The language of the conversation item in BCP-47 format. - /// modality: "transcript" | "text", # Required. Enumeration of supported conversational modalities. - /// domain: "finance" | "healthcare" | "generic", # Optional. Enumeration of supported conversational domains. - /// } - /// ], # Required. - /// }, # Required. - /// tasks: [ - /// { - /// taskName: string, # Optional. - /// kind: "ConversationalPIITask" | "ConversationalSummarizationTask", # Required. Enumeration of supported analysis tasks on a collection of conversations. - /// } - /// ], # Required. The set of tasks to execute on the input conversation. - /// } - /// - /// - /// Response Body: - /// - /// Schema for AnalyzeConversationJobState: - /// { - /// displayName: string, # Optional. - /// createdDateTime: string (ISO 8601 Format), # Required. - /// expirationDateTime: string (ISO 8601 Format), # Optional. - /// jobId: string, # Required. - /// lastUpdatedDateTime: string (ISO 8601 Format), # Required. - /// status: "notStarted" | "running" | "succeeded" | "partiallyCompleted" | "failed" | "cancelled" | "cancelling", # Required. - /// errors: [ - /// { - /// code: "InvalidRequest" | "InvalidArgument" | "Unauthorized" | "Forbidden" | "NotFound" | "ProjectNotFound" | "OperationNotFound" | "AzureCognitiveSearchNotFound" | "AzureCognitiveSearchIndexNotFound" | "TooManyRequests" | "AzureCognitiveSearchThrottling" | "AzureCognitiveSearchIndexLimitReached" | "InternalServerError" | "ServiceUnavailable" | "Timeout" | "QuotaExceeded" | "Conflict" | "Warning", # Required. One of a server-defined set of error codes. - /// message: string, # Required. A human-readable representation of the error. - /// target: string, # Optional. The target of the error. - /// details: [Error], # Optional. An array of details about specific errors that led to this reported error. - /// innererror: { - /// code: "InvalidRequest" | "InvalidParameterValue" | "KnowledgeBaseNotFound" | "AzureCognitiveSearchNotFound" | "AzureCognitiveSearchThrottling" | "ExtractionFailure" | "InvalidRequestBodyFormat" | "EmptyRequest" | "MissingInputDocuments" | "InvalidDocument" | "ModelVersionIncorrect" | "InvalidDocumentBatch" | "UnsupportedLanguageCode" | "InvalidCountryHint", # Required. One of a server-defined set of error codes. - /// message: string, # Required. Error message. - /// details: Dictionary<string, string>, # Optional. Error details. - /// target: string, # Optional. Error target. - /// innererror: InnerErrorModel, # Optional. An object containing more specific information than the current object about the error. - /// }, # Optional. An object containing more specific information than the current object about the error. - /// } - /// ], # Optional. - /// nextLink: string, # Optional. - /// tasks: { - /// completed: number, # Required. Count of tasks completed successfully. - /// failed: number, # Required. Count of tasks that failed. - /// inProgress: number, # Required. Count of tasks in progress currently. - /// total: number, # Required. Total count of tasks submitted as part of the job. - /// items: [ - /// { - /// lastUpdateDateTime: string (ISO 8601 Format), # Required. The last updated time in UTC for the task. - /// status: "notStarted" | "running" | "succeeded" | "failed" | "cancelled" | "cancelling", # Required. The status of the task at the mentioned last update time. - /// taskName: string, # Optional. - /// kind: "ConversationalPIIResults" | "ConversationalSummarizationResults", # Required. Enumeration of supported Conversation Analysis task results. - /// } - /// ], # Optional. List of results from tasks (if available). - /// }, # Required. - /// statistics: { - /// transactionsCount: number, # Required. Number of transactions for the request. - /// conversationsCount: number, # Required. Number of conversations submitted in the request. - /// validConversationsCount: number, # Required. Number of conversations documents. This excludes empty, over-size limit or non-supported languages documents. - /// erroneousConversationsCount: number, # Required. Number of invalid documents. This includes empty, over-size limit or non-supported languages documents. - /// }, # Optional. if showStats=true was specified in the request this field will contain information about the request payload. - /// } - /// - /// - /// - public virtual Operation AnalyzeConversation(WaitUntil waitUntil, RequestContent content, RequestContext context = null) - { - Argument.AssertNotNull(content, nameof(content)); - - using var scope = ClientDiagnostics.CreateScope($"{nameof(ConversationAnalysisClient)}.{nameof(AnalyzeConversation)}"); - scope.Start(); - - return StartAnalyzeConversation(waitUntil, content, context); - } } } diff --git a/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/ConversationsAudience.cs b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/ConversationsAudience.cs index 71e79191160fa..e1c98d861daa3 100644 --- a/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/ConversationsAudience.cs +++ b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/ConversationsAudience.cs @@ -8,7 +8,7 @@ namespace Azure.AI.Language.Conversations { /// Cloud audiences available for Conversations. - public readonly partial struct ConversationsAudience : IEquatable + internal readonly partial struct ConversationsAudience : IEquatable { private readonly string _value; diff --git a/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/ConversationsClientOptions.cs b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/ConversationsClientOptions.cs index 5ef0222c04663..97cded23b3e9c 100644 --- a/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/ConversationsClientOptions.cs +++ b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/ConversationsClientOptions.cs @@ -29,7 +29,7 @@ public enum ServiceVersion /// Gets or sets the audience to use for authentication with Azure Active Directory (AAD). The audience is not considered when using a shared key. /// /// If null, will be assumed. - public ConversationsAudience? Audience { get; set; } + internal ConversationsAudience? Audience { get; set; } internal string Version { get; } diff --git a/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/ConversationAnalysisClient.cs b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/ConversationAnalysisClient.cs index d169671966ca7..c9509d63db7f9 100644 --- a/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/ConversationAnalysisClient.cs +++ b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/ConversationAnalysisClient.cs @@ -182,17 +182,17 @@ public virtual Response GetAnalyzeConversationJobStatus(Guid jobId, bool? showSt /// is null. /// Service returned a non-success status code. /// The representing an asynchronous operation on the service. - /// - internal virtual async Task> StartAnalyzeConversationAsync(WaitUntil waitUntil, RequestContent content, RequestContext context = null) + /// + public virtual async Task> AnalyzeConversationsAsync(WaitUntil waitUntil, RequestContent content, RequestContext context = null) { Argument.AssertNotNull(content, nameof(content)); - using var scope = ClientDiagnostics.CreateScope("ConversationAnalysisClient.StartAnalyzeConversation"); + using var scope = ClientDiagnostics.CreateScope("ConversationAnalysisClient.AnalyzeConversations"); scope.Start(); try { - using HttpMessage message = CreateStartAnalyzeConversationRequest(content, context); - return await ProtocolOperationHelpers.ProcessMessageAsync(_pipeline, message, ClientDiagnostics, "ConversationAnalysisClient.StartAnalyzeConversation", OperationFinalStateVia.Location, context, waitUntil).ConfigureAwait(false); + using HttpMessage message = CreateAnalyzeConversationsRequest(content, context); + return await ProtocolOperationHelpers.ProcessMessageAsync(_pipeline, message, ClientDiagnostics, "ConversationAnalysisClient.AnalyzeConversations", OperationFinalStateVia.Location, context, waitUntil).ConfigureAwait(false); } catch (Exception e) { @@ -217,17 +217,17 @@ internal virtual async Task> StartAnalyzeConversationAsync /// is null. /// Service returned a non-success status code. /// The representing an asynchronous operation on the service. - /// - internal virtual Operation StartAnalyzeConversation(WaitUntil waitUntil, RequestContent content, RequestContext context = null) + /// + public virtual Operation AnalyzeConversations(WaitUntil waitUntil, RequestContent content, RequestContext context = null) { Argument.AssertNotNull(content, nameof(content)); - using var scope = ClientDiagnostics.CreateScope("ConversationAnalysisClient.StartAnalyzeConversation"); + using var scope = ClientDiagnostics.CreateScope("ConversationAnalysisClient.AnalyzeConversations"); scope.Start(); try { - using HttpMessage message = CreateStartAnalyzeConversationRequest(content, context); - return ProtocolOperationHelpers.ProcessMessage(_pipeline, message, ClientDiagnostics, "ConversationAnalysisClient.StartAnalyzeConversation", OperationFinalStateVia.Location, context, waitUntil); + using HttpMessage message = CreateAnalyzeConversationsRequest(content, context); + return ProtocolOperationHelpers.ProcessMessage(_pipeline, message, ClientDiagnostics, "ConversationAnalysisClient.AnalyzeConversations", OperationFinalStateVia.Location, context, waitUntil); } catch (Exception e) { @@ -251,15 +251,15 @@ internal virtual Operation StartAnalyzeConversation(WaitUntil waitUn /// The request context, which can override default behaviors of the client pipeline on a per-call basis. /// Service returned a non-success status code. /// The representing an asynchronous operation on the service. - /// - public virtual async Task CancelAnalyzeConversationJobAsync(WaitUntil waitUntil, Guid jobId, RequestContext context = null) + /// + public virtual async Task CancelAnalyzeConversationsAsync(WaitUntil waitUntil, Guid jobId, RequestContext context = null) { - using var scope = ClientDiagnostics.CreateScope("ConversationAnalysisClient.CancelAnalyzeConversationJob"); + using var scope = ClientDiagnostics.CreateScope("ConversationAnalysisClient.CancelAnalyzeConversations"); scope.Start(); try { - using HttpMessage message = CreateCancelAnalyzeConversationJobRequest(jobId, context); - return await ProtocolOperationHelpers.ProcessMessageWithoutResponseValueAsync(_pipeline, message, ClientDiagnostics, "ConversationAnalysisClient.CancelAnalyzeConversationJob", OperationFinalStateVia.Location, context, waitUntil).ConfigureAwait(false); + using HttpMessage message = CreateCancelAnalyzeConversationsRequest(jobId, context); + return await ProtocolOperationHelpers.ProcessMessageWithoutResponseValueAsync(_pipeline, message, ClientDiagnostics, "ConversationAnalysisClient.CancelAnalyzeConversations", OperationFinalStateVia.Location, context, waitUntil).ConfigureAwait(false); } catch (Exception e) { @@ -283,15 +283,15 @@ public virtual async Task CancelAnalyzeConversationJobAsync(WaitUntil /// The request context, which can override default behaviors of the client pipeline on a per-call basis. /// Service returned a non-success status code. /// The representing an asynchronous operation on the service. - /// - public virtual Operation CancelAnalyzeConversationJob(WaitUntil waitUntil, Guid jobId, RequestContext context = null) + /// + public virtual Operation CancelAnalyzeConversations(WaitUntil waitUntil, Guid jobId, RequestContext context = null) { - using var scope = ClientDiagnostics.CreateScope("ConversationAnalysisClient.CancelAnalyzeConversationJob"); + using var scope = ClientDiagnostics.CreateScope("ConversationAnalysisClient.CancelAnalyzeConversations"); scope.Start(); try { - using HttpMessage message = CreateCancelAnalyzeConversationJobRequest(jobId, context); - return ProtocolOperationHelpers.ProcessMessageWithoutResponseValue(_pipeline, message, ClientDiagnostics, "ConversationAnalysisClient.CancelAnalyzeConversationJob", OperationFinalStateVia.Location, context, waitUntil); + using HttpMessage message = CreateCancelAnalyzeConversationsRequest(jobId, context); + return ProtocolOperationHelpers.ProcessMessageWithoutResponseValue(_pipeline, message, ClientDiagnostics, "ConversationAnalysisClient.CancelAnalyzeConversations", OperationFinalStateVia.Location, context, waitUntil); } catch (Exception e) { @@ -317,7 +317,7 @@ internal HttpMessage CreateAnalyzeConversationRequest(RequestContent content, Re return message; } - internal HttpMessage CreateStartAnalyzeConversationRequest(RequestContent content, RequestContext context) + internal HttpMessage CreateAnalyzeConversationsRequest(RequestContent content, RequestContext context) { var message = _pipeline.CreateMessage(context, ResponseClassifier200202); var request = message.Request; @@ -354,7 +354,7 @@ internal HttpMessage CreateGetAnalyzeConversationJobStatusRequest(Guid jobId, bo return message; } - internal HttpMessage CreateCancelAnalyzeConversationJobRequest(Guid jobId, RequestContext context) + internal HttpMessage CreateCancelAnalyzeConversationsRequest(Guid jobId, RequestContext context) { var message = _pipeline.CreateMessage(context, ResponseClassifier202); var request = message.Request; 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 0e73ee1957317..bdb6c5c07bcf4 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 @@ -279,7 +279,117 @@ https://learn.microsoft.com/rest/api/language/2023-04-01/conversation-analysis-r - + + +This sample shows how to call AnalyzeConversationsAsync with required parameters and request content, and how to parse the result. +"); +var endpoint = new Uri(""); +var client = new ConversationAnalysisClient(endpoint, credential); + +var data = new { + analysisInput = new { + conversations = new[] { + new { + conversationItems = new[] { + new { + text = "", + id = "", + participantId = "", + } + }, + id = "", + language = "", + modality = "text", + } + }, + }, + tasks = new[] { + new { + kind = "ConversationalSummarizationTask", + } + }, +}; + +var operation = await client.AnalyzeConversationsAsync(WaitUntil.Completed, RequestContent.Create(data)); + +BinaryData responseData = operation.Value; +JsonElement result = JsonDocument.Parse(responseData.ToStream()).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()); +]]> +This sample shows how to call AnalyzeConversationsAsync with all parameters and request content, and how to parse the result. +"); +var endpoint = new Uri(""); +var client = new ConversationAnalysisClient(endpoint, credential); + +var data = new { + displayName = "", + analysisInput = new { + conversations = new[] { + new { + conversationItems = new[] { + new { + text = "", + id = "", + participantId = "", + language = "", + modality = "transcript", + role = "agent", + } + }, + id = "", + language = "", + modality = "text", + domain = "finance", + } + }, + }, + tasks = new[] { + new { + parameters = new { + summaryAspects = new[] { + "issue" + }, + modelVersion = "", + loggingOptOut = true, + }, + kind = "ConversationalSummarizationTask", + taskName = "", + } + }, +}; + +var operation = await client.AnalyzeConversationsAsync(WaitUntil.Completed, RequestContent.Create(data), new RequestContext()); + +BinaryData responseData = operation.Value; +JsonElement result = JsonDocument.Parse(responseData.ToStream()).RootElement; +Console.WriteLine(result.GetProperty("displayName").ToString()); +Console.WriteLine(result.GetProperty("createdDateTime").ToString()); +Console.WriteLine(result.GetProperty("expirationDateTime").ToString()); +Console.WriteLine(result.GetProperty("jobId").ToString()); +Console.WriteLine(result.GetProperty("lastUpdatedDateTime").ToString()); +Console.WriteLine(result.GetProperty("status").ToString()); +Console.WriteLine(result.GetProperty("errors")[0].GetProperty("code").ToString()); +Console.WriteLine(result.GetProperty("errors")[0].GetProperty("message").ToString()); +Console.WriteLine(result.GetProperty("errors")[0].GetProperty("target").ToString()); +Console.WriteLine(result.GetProperty("errors")[0].GetProperty("details")[0].GetProperty("code").ToString()); +Console.WriteLine(result.GetProperty("errors")[0].GetProperty("details")[0].GetProperty("message").ToString()); +Console.WriteLine(result.GetProperty("errors")[0].GetProperty("details")[0].GetProperty("target").ToString()); +Console.WriteLine(result.GetProperty("errors")[0].GetProperty("details")[0].GetProperty("innererror").GetProperty("code").ToString()); +Console.WriteLine(result.GetProperty("errors")[0].GetProperty("details")[0].GetProperty("innererror").GetProperty("message").ToString()); +Console.WriteLine(result.GetProperty("errors")[0].GetProperty("details")[0].GetProperty("innererror").GetProperty("details").GetProperty("").ToString()); +Console.WriteLine(result.GetProperty("errors")[0].GetProperty("details")[0].GetProperty("innererror").GetProperty("target").ToString()); +Console.WriteLine(result.GetProperty("errors")[0].GetProperty("innererror").GetProperty("code").ToString()); +Console.WriteLine(result.GetProperty("errors")[0].GetProperty("innererror").GetProperty("message").ToString()); +Console.WriteLine(result.GetProperty("errors")[0].GetProperty("innererror").GetProperty("details").GetProperty("").ToString()); +Console.WriteLine(result.GetProperty("errors")[0].GetProperty("innererror").GetProperty("target").ToString()); +Console.WriteLine(result.GetProperty("nextLink").ToString()); +]]> + Additional information can be found in the service REST API documentation: @@ -287,7 +397,117 @@ https://learn.microsoft.com/rest/api/language/2023-04-01/conversation-analysis-r - + + +This sample shows how to call AnalyzeConversations with required parameters and request content, and how to parse the result. +"); +var endpoint = new Uri(""); +var client = new ConversationAnalysisClient(endpoint, credential); + +var data = new { + analysisInput = new { + conversations = new[] { + new { + conversationItems = new[] { + new { + text = "", + id = "", + participantId = "", + } + }, + id = "", + language = "", + modality = "text", + } + }, + }, + tasks = new[] { + new { + kind = "ConversationalSummarizationTask", + } + }, +}; + +var operation = client.AnalyzeConversations(WaitUntil.Completed, RequestContent.Create(data)); + +BinaryData responseData = operation.Value; +JsonElement result = JsonDocument.Parse(responseData.ToStream()).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()); +]]> +This sample shows how to call AnalyzeConversations with all parameters and request content, and how to parse the result. +"); +var endpoint = new Uri(""); +var client = new ConversationAnalysisClient(endpoint, credential); + +var data = new { + displayName = "", + analysisInput = new { + conversations = new[] { + new { + conversationItems = new[] { + new { + text = "", + id = "", + participantId = "", + language = "", + modality = "transcript", + role = "agent", + } + }, + id = "", + language = "", + modality = "text", + domain = "finance", + } + }, + }, + tasks = new[] { + new { + parameters = new { + summaryAspects = new[] { + "issue" + }, + modelVersion = "", + loggingOptOut = true, + }, + kind = "ConversationalSummarizationTask", + taskName = "", + } + }, +}; + +var operation = client.AnalyzeConversations(WaitUntil.Completed, RequestContent.Create(data), new RequestContext()); + +BinaryData responseData = operation.Value; +JsonElement result = JsonDocument.Parse(responseData.ToStream()).RootElement; +Console.WriteLine(result.GetProperty("displayName").ToString()); +Console.WriteLine(result.GetProperty("createdDateTime").ToString()); +Console.WriteLine(result.GetProperty("expirationDateTime").ToString()); +Console.WriteLine(result.GetProperty("jobId").ToString()); +Console.WriteLine(result.GetProperty("lastUpdatedDateTime").ToString()); +Console.WriteLine(result.GetProperty("status").ToString()); +Console.WriteLine(result.GetProperty("errors")[0].GetProperty("code").ToString()); +Console.WriteLine(result.GetProperty("errors")[0].GetProperty("message").ToString()); +Console.WriteLine(result.GetProperty("errors")[0].GetProperty("target").ToString()); +Console.WriteLine(result.GetProperty("errors")[0].GetProperty("details")[0].GetProperty("code").ToString()); +Console.WriteLine(result.GetProperty("errors")[0].GetProperty("details")[0].GetProperty("message").ToString()); +Console.WriteLine(result.GetProperty("errors")[0].GetProperty("details")[0].GetProperty("target").ToString()); +Console.WriteLine(result.GetProperty("errors")[0].GetProperty("details")[0].GetProperty("innererror").GetProperty("code").ToString()); +Console.WriteLine(result.GetProperty("errors")[0].GetProperty("details")[0].GetProperty("innererror").GetProperty("message").ToString()); +Console.WriteLine(result.GetProperty("errors")[0].GetProperty("details")[0].GetProperty("innererror").GetProperty("details").GetProperty("").ToString()); +Console.WriteLine(result.GetProperty("errors")[0].GetProperty("details")[0].GetProperty("innererror").GetProperty("target").ToString()); +Console.WriteLine(result.GetProperty("errors")[0].GetProperty("innererror").GetProperty("code").ToString()); +Console.WriteLine(result.GetProperty("errors")[0].GetProperty("innererror").GetProperty("message").ToString()); +Console.WriteLine(result.GetProperty("errors")[0].GetProperty("innererror").GetProperty("details").GetProperty("").ToString()); +Console.WriteLine(result.GetProperty("errors")[0].GetProperty("innererror").GetProperty("target").ToString()); +Console.WriteLine(result.GetProperty("nextLink").ToString()); +]]> + Additional information can be found in the service REST API documentation: @@ -295,15 +515,15 @@ https://learn.microsoft.com/rest/api/language/2023-04-01/conversation-analysis-r - + -This sample shows how to call CancelAnalyzeConversationJobAsync with required parameters. +This sample shows how to call CancelAnalyzeConversationsAsync with required parameters. "); var endpoint = new Uri(""); var client = new ConversationAnalysisClient(endpoint, credential); -var operation = await client.CancelAnalyzeConversationJobAsync(WaitUntil.Completed, Guid.NewGuid(), new RequestContext()); +var operation = await client.CancelAnalyzeConversationsAsync(WaitUntil.Completed, Guid.NewGuid(), new RequestContext()); Console.WriteLine(operation.GetRawResponse().Status); ]]> @@ -315,15 +535,15 @@ https://learn.microsoft.com/rest/api/language/2023-04-01/conversation-analysis-r - + -This sample shows how to call CancelAnalyzeConversationJob with required parameters. +This sample shows how to call CancelAnalyzeConversations with required parameters. "); var endpoint = new Uri(""); var client = new ConversationAnalysisClient(endpoint, credential); -var operation = client.CancelAnalyzeConversationJob(WaitUntil.Completed, Guid.NewGuid(), new RequestContext()); +var operation = client.CancelAnalyzeConversations(WaitUntil.Completed, Guid.NewGuid(), new RequestContext()); Console.WriteLine(operation.GetRawResponse().Status); ]]> diff --git a/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/autorest.md b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/autorest.md index 3d3d13a22b21a..55e9e2f7162bd 100644 --- a/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/autorest.md +++ b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/autorest.md @@ -180,15 +180,10 @@ directive: url: "https://learn.microsoft.com/rest/api/language/" + version + "/conversational-analysis-authoring/" + operationId.replace(/([a-z0-9])([A-Z])/g, "$1-$2").toLowerCase() }; -# Mark the LRO as internal so we can call it from an overload, which we can't do using transforms since that results in duplicate operationIds. -- where-operation: AnalyzeConversation_SubmitJob - transform: | - $["x-accessibility"] = "internal"; - # Rename operations to be consistent. Do this after other operation transforms for ease. - rename-operation: from: AnalyzeConversation_SubmitJob - to: ConversationAnalysis_StartAnalyzeConversation + to: ConversationAnalysis_AnalyzeConversations - rename-operation: from: AnalyzeConversation_JobStatus @@ -196,7 +191,7 @@ directive: - rename-operation: from: AnalyzeConversation_CancelJob - to: ConversationAnalysis_CancelAnalyzeConversationJob + to: ConversationAnalysis_CancelAnalyzeConversations - rename-operation: from: ConversationalAnalysisAuthoring_Export diff --git a/sdk/cognitivelanguage/Azure.AI.Language.Conversations/tests/ConversationAnalysisClientLiveTests.cs b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/tests/ConversationAnalysisClientLiveTests.cs index 1caea1a7b1a79..17ec8b7843401 100644 --- a/sdk/cognitivelanguage/Azure.AI.Language.Conversations/tests/ConversationAnalysisClientLiveTests.cs +++ b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/tests/ConversationAnalysisClientLiveTests.cs @@ -320,7 +320,7 @@ public async Task AnalyzeConversation_ConversationSummarization() }, }; - Operation analyzeConversationOperation = await Client.AnalyzeConversationAsync(WaitUntil.Completed, RequestContent.Create(data)); + Operation analyzeConversationOperation = await Client.AnalyzeConversationsAsync(WaitUntil.Completed, RequestContent.Create(data)); dynamic jobResults = analyzeConversationOperation.Value.ToDynamicFromJson(DynamicCaseMapping.PascalToCamel); Assert.NotNull(jobResults); 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 e1b22e6c35f63..0940a42fb1e86 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 @@ -305,52 +305,288 @@ public async Task Example_GetAnalyzeConversationJobStatus_AllParameters_Async() [Test] [Ignore("Only validating compilation of examples")] - public void Example_CancelAnalyzeConversationJob() + public void Example_AnalyzeConversations() { var credential = new AzureKeyCredential(""); var endpoint = new Uri(""); var client = new ConversationAnalysisClient(endpoint, credential); - var operation = client.CancelAnalyzeConversationJob(WaitUntil.Completed, Guid.NewGuid()); + var data = new + { + analysisInput = new + { + conversations = new[] { + new { + conversationItems = new[] { + new { + text = "", + id = "", + participantId = "", + } + }, + id = "", + language = "", + modality = "text", + } + }, + }, + tasks = new[] { + new { + kind = "ConversationalSummarizationTask", + } + }, + }; + + var operation = client.AnalyzeConversations(WaitUntil.Completed, RequestContent.Create(data)); + + BinaryData responseData = operation.Value; + JsonElement result = JsonDocument.Parse(responseData.ToStream()).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()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_AnalyzeConversations_AllParameters() + { + var credential = new AzureKeyCredential(""); + var endpoint = new Uri(""); + var client = new ConversationAnalysisClient(endpoint, credential); + + var data = new + { + displayName = "", + analysisInput = new + { + conversations = new[] { + new { + conversationItems = new[] { + new { + text = "", + id = "", + participantId = "", + language = "", + modality = "transcript", + role = "agent", + } + }, + id = "", + language = "", + modality = "text", + domain = "finance", + } + }, + }, + tasks = new[] { + new { + parameters = new { + summaryAspects = new[] { + "issue" + }, + modelVersion = "", + loggingOptOut = true, + }, + kind = "ConversationalSummarizationTask", + taskName = "", + } + }, + }; + + var operation = client.AnalyzeConversations(WaitUntil.Completed, RequestContent.Create(data), new RequestContext()); + + BinaryData responseData = operation.Value; + JsonElement result = JsonDocument.Parse(responseData.ToStream()).RootElement; + Console.WriteLine(result.GetProperty("displayName").ToString()); + Console.WriteLine(result.GetProperty("createdDateTime").ToString()); + Console.WriteLine(result.GetProperty("expirationDateTime").ToString()); + Console.WriteLine(result.GetProperty("jobId").ToString()); + Console.WriteLine(result.GetProperty("lastUpdatedDateTime").ToString()); + Console.WriteLine(result.GetProperty("status").ToString()); + Console.WriteLine(result.GetProperty("errors")[0].GetProperty("code").ToString()); + Console.WriteLine(result.GetProperty("errors")[0].GetProperty("message").ToString()); + Console.WriteLine(result.GetProperty("errors")[0].GetProperty("target").ToString()); + Console.WriteLine(result.GetProperty("errors")[0].GetProperty("details")[0].GetProperty("code").ToString()); + Console.WriteLine(result.GetProperty("errors")[0].GetProperty("details")[0].GetProperty("message").ToString()); + Console.WriteLine(result.GetProperty("errors")[0].GetProperty("details")[0].GetProperty("target").ToString()); + Console.WriteLine(result.GetProperty("errors")[0].GetProperty("details")[0].GetProperty("innererror").GetProperty("code").ToString()); + Console.WriteLine(result.GetProperty("errors")[0].GetProperty("details")[0].GetProperty("innererror").GetProperty("message").ToString()); + Console.WriteLine(result.GetProperty("errors")[0].GetProperty("details")[0].GetProperty("innererror").GetProperty("details").GetProperty("").ToString()); + Console.WriteLine(result.GetProperty("errors")[0].GetProperty("details")[0].GetProperty("innererror").GetProperty("target").ToString()); + Console.WriteLine(result.GetProperty("errors")[0].GetProperty("innererror").GetProperty("code").ToString()); + Console.WriteLine(result.GetProperty("errors")[0].GetProperty("innererror").GetProperty("message").ToString()); + Console.WriteLine(result.GetProperty("errors")[0].GetProperty("innererror").GetProperty("details").GetProperty("").ToString()); + Console.WriteLine(result.GetProperty("errors")[0].GetProperty("innererror").GetProperty("target").ToString()); + Console.WriteLine(result.GetProperty("nextLink").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_AnalyzeConversations_Async() + { + var credential = new AzureKeyCredential(""); + var endpoint = new Uri(""); + var client = new ConversationAnalysisClient(endpoint, credential); + + var data = new + { + analysisInput = new + { + conversations = new[] { + new { + conversationItems = new[] { + new { + text = "", + id = "", + participantId = "", + } + }, + id = "", + language = "", + modality = "text", + } + }, + }, + tasks = new[] { + new { + kind = "ConversationalSummarizationTask", + } + }, + }; + + var operation = await client.AnalyzeConversationsAsync(WaitUntil.Completed, RequestContent.Create(data)); + + BinaryData responseData = operation.Value; + JsonElement result = JsonDocument.Parse(responseData.ToStream()).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()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_AnalyzeConversations_AllParameters_Async() + { + var credential = new AzureKeyCredential(""); + var endpoint = new Uri(""); + var client = new ConversationAnalysisClient(endpoint, credential); + + var data = new + { + displayName = "", + analysisInput = new + { + conversations = new[] { + new { + conversationItems = new[] { + new { + text = "", + id = "", + participantId = "", + language = "", + modality = "transcript", + role = "agent", + } + }, + id = "", + language = "", + modality = "text", + domain = "finance", + } + }, + }, + tasks = new[] { + new { + parameters = new { + summaryAspects = new[] { + "issue" + }, + modelVersion = "", + loggingOptOut = true, + }, + kind = "ConversationalSummarizationTask", + taskName = "", + } + }, + }; + + var operation = await client.AnalyzeConversationsAsync(WaitUntil.Completed, RequestContent.Create(data), new RequestContext()); + + BinaryData responseData = operation.Value; + JsonElement result = JsonDocument.Parse(responseData.ToStream()).RootElement; + Console.WriteLine(result.GetProperty("displayName").ToString()); + Console.WriteLine(result.GetProperty("createdDateTime").ToString()); + Console.WriteLine(result.GetProperty("expirationDateTime").ToString()); + Console.WriteLine(result.GetProperty("jobId").ToString()); + Console.WriteLine(result.GetProperty("lastUpdatedDateTime").ToString()); + Console.WriteLine(result.GetProperty("status").ToString()); + Console.WriteLine(result.GetProperty("errors")[0].GetProperty("code").ToString()); + Console.WriteLine(result.GetProperty("errors")[0].GetProperty("message").ToString()); + Console.WriteLine(result.GetProperty("errors")[0].GetProperty("target").ToString()); + Console.WriteLine(result.GetProperty("errors")[0].GetProperty("details")[0].GetProperty("code").ToString()); + Console.WriteLine(result.GetProperty("errors")[0].GetProperty("details")[0].GetProperty("message").ToString()); + Console.WriteLine(result.GetProperty("errors")[0].GetProperty("details")[0].GetProperty("target").ToString()); + Console.WriteLine(result.GetProperty("errors")[0].GetProperty("details")[0].GetProperty("innererror").GetProperty("code").ToString()); + Console.WriteLine(result.GetProperty("errors")[0].GetProperty("details")[0].GetProperty("innererror").GetProperty("message").ToString()); + Console.WriteLine(result.GetProperty("errors")[0].GetProperty("details")[0].GetProperty("innererror").GetProperty("details").GetProperty("").ToString()); + Console.WriteLine(result.GetProperty("errors")[0].GetProperty("details")[0].GetProperty("innererror").GetProperty("target").ToString()); + Console.WriteLine(result.GetProperty("errors")[0].GetProperty("innererror").GetProperty("code").ToString()); + Console.WriteLine(result.GetProperty("errors")[0].GetProperty("innererror").GetProperty("message").ToString()); + Console.WriteLine(result.GetProperty("errors")[0].GetProperty("innererror").GetProperty("details").GetProperty("").ToString()); + Console.WriteLine(result.GetProperty("errors")[0].GetProperty("innererror").GetProperty("target").ToString()); + Console.WriteLine(result.GetProperty("nextLink").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_CancelAnalyzeConversations() + { + var credential = new AzureKeyCredential(""); + var endpoint = new Uri(""); + var client = new ConversationAnalysisClient(endpoint, credential); + + var operation = client.CancelAnalyzeConversations(WaitUntil.Completed, Guid.NewGuid()); Console.WriteLine(operation.GetRawResponse().Status); } [Test] [Ignore("Only validating compilation of examples")] - public void Example_CancelAnalyzeConversationJob_AllParameters() + public void Example_CancelAnalyzeConversations_AllParameters() { var credential = new AzureKeyCredential(""); var endpoint = new Uri(""); var client = new ConversationAnalysisClient(endpoint, credential); - var operation = client.CancelAnalyzeConversationJob(WaitUntil.Completed, Guid.NewGuid(), new RequestContext()); + var operation = client.CancelAnalyzeConversations(WaitUntil.Completed, Guid.NewGuid(), new RequestContext()); Console.WriteLine(operation.GetRawResponse().Status); } [Test] [Ignore("Only validating compilation of examples")] - public async Task Example_CancelAnalyzeConversationJob_Async() + public async Task Example_CancelAnalyzeConversations_Async() { var credential = new AzureKeyCredential(""); var endpoint = new Uri(""); var client = new ConversationAnalysisClient(endpoint, credential); - var operation = await client.CancelAnalyzeConversationJobAsync(WaitUntil.Completed, Guid.NewGuid()); + var operation = await client.CancelAnalyzeConversationsAsync(WaitUntil.Completed, Guid.NewGuid()); Console.WriteLine(operation.GetRawResponse().Status); } [Test] [Ignore("Only validating compilation of examples")] - public async Task Example_CancelAnalyzeConversationJob_AllParameters_Async() + public async Task Example_CancelAnalyzeConversations_AllParameters_Async() { var credential = new AzureKeyCredential(""); var endpoint = new Uri(""); var client = new ConversationAnalysisClient(endpoint, credential); - var operation = await client.CancelAnalyzeConversationJobAsync(WaitUntil.Completed, Guid.NewGuid(), new RequestContext()); + var operation = await client.CancelAnalyzeConversationsAsync(WaitUntil.Completed, Guid.NewGuid(), new RequestContext()); Console.WriteLine(operation.GetRawResponse().Status); } diff --git a/sdk/cognitivelanguage/Azure.AI.Language.Conversations/tests/Samples/Sample6_AnalyzeConversation_ConversationSummarization.cs b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/tests/Samples/Sample6_AnalyzeConversation_ConversationSummarization.cs index 5dd9e682809e4..beba2ebe8da8d 100644 --- a/sdk/cognitivelanguage/Azure.AI.Language.Conversations/tests/Samples/Sample6_AnalyzeConversation_ConversationSummarization.cs +++ b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/tests/Samples/Sample6_AnalyzeConversation_ConversationSummarization.cs @@ -89,7 +89,7 @@ public void AnalyzeConversation_ConversationSummarization() }, }; - Operation analyzeConversationOperation = client.AnalyzeConversation(WaitUntil.Completed, RequestContent.Create(data)); + Operation analyzeConversationOperation = client.AnalyzeConversations(WaitUntil.Completed, RequestContent.Create(data)); using JsonDocument result = JsonDocument.Parse(analyzeConversationOperation.Value.ToStream()); JsonElement jobResults = result.RootElement; @@ -194,7 +194,7 @@ public async Task AnalyzeConversationAsync_ConversationSummarization() }; #region Snippet:AnalyzeConversationAsync_ConversationSummarization - Operation analyzeConversationOperation = await client.AnalyzeConversationAsync(WaitUntil.Completed, RequestContent.Create(data)); + Operation analyzeConversationOperation = await client.AnalyzeConversationsAsync(WaitUntil.Completed, RequestContent.Create(data)); #endregion using JsonDocument result = JsonDocument.Parse(analyzeConversationOperation.Value.ToStream());