ConversationAnalysisClient.AnalyzeConversationAsync Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Overloads
AnalyzeConversationAsync(AnalyzeConversationInput, CancellationToken) |
Analyzes the input conversation utterance. |
AnalyzeConversationAsync(RequestContent, RequestContext) |
[Protocol Method] Analyzes the input conversation utterance.
|
AnalyzeConversationAsync(AnalyzeConversationInput, CancellationToken)
Analyzes the input conversation utterance.
public virtual System.Threading.Tasks.Task<Azure.Response<Azure.AI.Language.Conversations.Models.AnalyzeConversationActionResult>> AnalyzeConversationAsync (Azure.AI.Language.Conversations.Models.AnalyzeConversationInput analyzeConversationInput, System.Threading.CancellationToken cancellationToken = default);
abstract member AnalyzeConversationAsync : Azure.AI.Language.Conversations.Models.AnalyzeConversationInput * System.Threading.CancellationToken -> System.Threading.Tasks.Task<Azure.Response<Azure.AI.Language.Conversations.Models.AnalyzeConversationActionResult>>
override this.AnalyzeConversationAsync : Azure.AI.Language.Conversations.Models.AnalyzeConversationInput * System.Threading.CancellationToken -> System.Threading.Tasks.Task<Azure.Response<Azure.AI.Language.Conversations.Models.AnalyzeConversationActionResult>>
Public Overridable Function AnalyzeConversationAsync (analyzeConversationInput As AnalyzeConversationInput, Optional cancellationToken As CancellationToken = Nothing) As Task(Of Response(Of AnalyzeConversationActionResult))
Parameters
- analyzeConversationInput
- AnalyzeConversationInput
The input for the analyze conversations operation.
- cancellationToken
- CancellationToken
The cancellation token to use.
Returns
Exceptions
analyzeConversationInput
is null.
Examples
This sample shows how to call AnalyzeConversationAsync.
Uri endpoint = new Uri("<https://my-service.azure.com>");
AzureKeyCredential credential = new AzureKeyCredential("<key>");
ConversationAnalysisClient client = new ConversationAnalysisClient(endpoint, credential);
AnalyzeConversationInput analyzeConversationInput = new ConversationLanguageUnderstandingInput(new ConversationAnalysisInput(new TextConversationItem("<id>", "<participantId>", "<text>")), new ConversationLanguageUnderstandingActionContent("<projectName>", "<deploymentName>"));
Response<AnalyzeConversationActionResult> response = await client.AnalyzeConversationAsync(analyzeConversationInput);
This sample shows how to call AnalyzeConversationAsync with all parameters.
Uri endpoint = new Uri("<https://my-service.azure.com>");
AzureKeyCredential credential = new AzureKeyCredential("<key>");
ConversationAnalysisClient client = new ConversationAnalysisClient(endpoint, credential);
AnalyzeConversationInput analyzeConversationInput = new ConversationLanguageUnderstandingInput(new ConversationAnalysisInput(new TextConversationItem("<id>", "<participantId>", "<text>")
{
Language = "<language>",
Modality = InputModality.Transcript,
Role = ParticipantRole.Customer,
}), new ConversationLanguageUnderstandingActionContent("<projectName>", "<deploymentName>")
{
Verbose = true,
IsLoggingEnabled = true,
StringIndexType = StringIndexType.TextElementsV8,
DirectTarget = "<directTarget>",
TargetProjectParameters =
{
["key"] = new LuisConfig
{
Query = "<query>",
CallingOptions = new LuisCallingConfig
{
Verbose = true,
Log = true,
ShowAllIntents = true,
TimezoneOffset = 1234,
SpellCheck = true,
BingSpellCheckSubscriptionKey = "<bing-spell-check-subscription-key>",
},
ApiVersion = "<apiVersion>",
}
},
});
Response<AnalyzeConversationActionResult> response = await client.AnalyzeConversationAsync(analyzeConversationInput);
Applies to
AnalyzeConversationAsync(RequestContent, RequestContext)
[Protocol Method] Analyzes the input conversation utterance.
- This protocol method allows explicit creation of the request and processing of the response for advanced scenarios.
- Please try the simpler AnalyzeConversationAsync(AnalyzeConversationInput, CancellationToken) convenience overload with strongly typed models first.
public virtual System.Threading.Tasks.Task<Azure.Response> AnalyzeConversationAsync (Azure.Core.RequestContent content, Azure.RequestContext context = default);
abstract member AnalyzeConversationAsync : Azure.Core.RequestContent * Azure.RequestContext -> System.Threading.Tasks.Task<Azure.Response>
override this.AnalyzeConversationAsync : Azure.Core.RequestContent * Azure.RequestContext -> System.Threading.Tasks.Task<Azure.Response>
Public Overridable Function AnalyzeConversationAsync (content As RequestContent, Optional context As RequestContext = Nothing) As Task(Of Response)
Parameters
- content
- RequestContent
The content to send as the body of the request.
- context
- RequestContext
The request context, which can override default behaviors of the client pipeline on a per-call basis.
Returns
The response returned from the service.
Exceptions
content
is null.
Service returned a non-success status code.
Examples
This sample shows how to call AnalyzeConversationAsync and parse the result.
Uri endpoint = new Uri("<https://my-service.azure.com>");
AzureKeyCredential credential = new AzureKeyCredential("<key>");
ConversationAnalysisClient client = new ConversationAnalysisClient(endpoint, credential);
using RequestContent content = RequestContent.Create(new
{
kind = "Conversation",
analysisInput = new
{
conversationItem = new
{
id = "<id>",
participantId = "<participantId>",
text = "<text>",
},
},
parameters = new
{
projectName = "<projectName>",
deploymentName = "<deploymentName>",
},
});
Response response = await client.AnalyzeConversationAsync(content);
JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement;
Console.WriteLine(result.GetProperty("kind").ToString());
This sample shows how to call AnalyzeConversationAsync with all request content and parse the result.
Uri endpoint = new Uri("<https://my-service.azure.com>");
AzureKeyCredential credential = new AzureKeyCredential("<key>");
ConversationAnalysisClient client = new ConversationAnalysisClient(endpoint, credential);
using RequestContent content = RequestContent.Create(new
{
kind = "Conversation",
analysisInput = new
{
conversationItem = new
{
id = "<id>",
participantId = "<participantId>",
language = "<language>",
modality = "transcript",
role = "customer",
text = "<text>",
},
},
parameters = new
{
projectName = "<projectName>",
deploymentName = "<deploymentName>",
verbose = true,
isLoggingEnabled = true,
stringIndexType = "TextElements_v8",
directTarget = "<directTarget>",
targetProjectParameters = new
{
key = new
{
targetProjectKind = "Luis",
query = "<query>",
callingOptions = new Dictionary<string, object>
{
["verbose"] = true,
["log"] = true,
["show-all-intents"] = true,
["timezoneOffset"] = 1234,
["spellCheck"] = true,
["bing-spell-check-subscription-key"] = "<bing-spell-check-subscription-key>"
},
apiVersion = "<apiVersion>",
},
},
},
});
Response response = await client.AnalyzeConversationAsync(content);
JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement;
Console.WriteLine(result.GetProperty("kind").ToString());
Remarks
Additional information can be found in the service REST API documentation: https://learn.microsoft.com/rest/api/language/2023-04-01/conversation-analysis-runtime/analyze-conversation
Applies to
Azure SDK for .NET