你当前正在访问 Microsoft Azure Global Edition 技术文档网站。 如果需要访问由世纪互联运营的 Microsoft Azure 中国技术文档网站,请访问 https://docs.azure.cn。
ConversationAnalysisClient.AnalyzeConversation 方法
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
[协议方法]分析输入对话话语。
- 此 协议方法 允许显式创建请求并处理高级方案的响应。
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
参数
- content
- RequestContent
要作为请求正文发送的内容。
- context
- RequestContext
请求上下文,它可以基于每个调用替代客户端管道的默认行为。
返回
从服务返回的响应。
例外
content
为 null。
服务返回了不成功状态代码。
示例
此示例演示如何使用所需的请求内容调用 AnalyzeConversation,以及如何分析结果。
var credential = new AzureKeyCredential("<key>");
var endpoint = new Uri("<https://my-service.azure.com>");
var client = new ConversationAnalysisClient(endpoint, credential);
var data = new {
analysisInput = new {
conversationItem = new {
text = "<text>",
id = "<id>",
participantId = "<participantId>",
},
},
parameters = new {
projectName = "<projectName>",
deploymentName = "<deploymentName>",
},
kind = "Conversation",
};
Response response = client.AnalyzeConversation(RequestContent.Create(data));
JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement;
Console.WriteLine(result.GetProperty("kind").ToString());
此示例演示如何使用所有请求内容调用 AnalyzeConversation,以及如何分析结果。
var credential = new AzureKeyCredential("<key>");
var endpoint = new Uri("<https://my-service.azure.com>");
var client = new ConversationAnalysisClient(endpoint, credential);
var data = new {
analysisInput = new {
conversationItem = new {
text = "<text>",
id = "<id>",
participantId = "<participantId>",
language = "<language>",
modality = "transcript",
role = "agent",
},
},
parameters = new {
projectName = "<projectName>",
deploymentName = "<deploymentName>",
verbose = true,
isLoggingEnabled = true,
stringIndexType = "Utf16CodeUnit",
directTarget = "<directTarget>",
targetProjectParameters = new {
key = new {
query = "<query>",
callingOptions = new {
verbose = true,
log = true,
show_all_intents = true,
timezoneOffset = 123.45f,
spellCheck = true,
bing_spell_check_subscription_key = "<bing-spell-check-subscription-key>",
},
targetProjectKind = "Luis",
apiVersion = "<apiVersion>",
},
},
},
kind = "Conversation",
};
Response response = client.AnalyzeConversation(RequestContent.Create(data));
JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement;
Console.WriteLine(result.GetProperty("kind").ToString());
注解
可以在服务 REST API 文档中找到其他信息: https://video2.skills-academy.com/rest/api/language/2023-04-01/conversation-analysis-runtime/analyze-conversation