ConversationAnalysisClient.AnalyzeConversation Method

Definition

Overloads

AnalyzeConversation(AnalyzeConversationInput, CancellationToken)

Analyzes the input conversation utterance.

AnalyzeConversation(RequestContent, RequestContext)

[Protocol Method] Analyzes the input conversation utterance.

AnalyzeConversation(AnalyzeConversationInput, CancellationToken)

Analyzes the input conversation utterance.

public virtual Azure.Response<Azure.AI.Language.Conversations.Models.AnalyzeConversationActionResult> AnalyzeConversation (Azure.AI.Language.Conversations.Models.AnalyzeConversationInput analyzeConversationInput, System.Threading.CancellationToken cancellationToken = default);
abstract member AnalyzeConversation : Azure.AI.Language.Conversations.Models.AnalyzeConversationInput * System.Threading.CancellationToken -> Azure.Response<Azure.AI.Language.Conversations.Models.AnalyzeConversationActionResult>
override this.AnalyzeConversation : Azure.AI.Language.Conversations.Models.AnalyzeConversationInput * System.Threading.CancellationToken -> Azure.Response<Azure.AI.Language.Conversations.Models.AnalyzeConversationActionResult>
Public Overridable Function AnalyzeConversation (analyzeConversationInput As AnalyzeConversationInput, Optional cancellationToken As CancellationToken = Nothing) As 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 AnalyzeConversation.

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 = client.AnalyzeConversation(analyzeConversationInput);

This sample shows how to call AnalyzeConversation 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 = client.AnalyzeConversation(analyzeConversationInput);

Applies to

AnalyzeConversation(RequestContent, RequestContext)

Source:
ConversationAnalysisClient.cs

[Protocol Method] Analyzes the input conversation utterance.

public virtual Azure.Response AnalyzeConversation (Azure.Core.RequestContent content, Azure.RequestContext context = default);
abstract member AnalyzeConversation : Azure.Core.RequestContent * Azure.RequestContext -> Azure.Response
override this.AnalyzeConversation : Azure.Core.RequestContent * Azure.RequestContext -> Azure.Response
Public Overridable Function AnalyzeConversation (content As RequestContent, Optional context As RequestContext = Nothing) As 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 AnalyzeConversation 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 = client.AnalyzeConversation(content);

JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement;
Console.WriteLine(result.GetProperty("kind").ToString());

This sample shows how to call AnalyzeConversation 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 = client.AnalyzeConversation(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://video2.skills-academy.com/rest/api/language/2023-04-01/conversation-analysis-runtime/analyze-conversation

Applies to