首先需要获取资源密钥和终结点:
在 Azure 门户中,转到资源概述页面。 在左侧菜单中,选择“密钥和终结点”。 你将为 API 请求使用终结点和密钥。
使用以下 URL、标头和 JSON 正文创建 POST 请求,开始测试业务流程工作流模型。
{ENDPOINT}/language/:analyze-conversations?api-version={API-VERSION}
占位符 |
值 |
示例 |
{ENDPOINT} |
用于对 API 请求进行身份验证的终结点。 |
https://<your-custom-subdomain>.cognitiveservices.azure.com |
{API-VERSION} |
要调用的 API 的版本。 |
2023-04-01 |
使用以下标头对请求进行身份验证。
键 |
值 |
Ocp-Apim-Subscription-Key |
资源密钥。 用于对 API 请求进行身份验证。 |
{
"kind": "Conversation",
"analysisInput": {
"conversationItem": {
"text": "Text1",
"participantId": "1",
"id": "1"
}
},
"parameters": {
"projectName": "{PROJECT-NAME}",
"deploymentName": "{DEPLOYMENT-NAME}",
"directTarget": "qnaProject",
"targetProjectParameters": {
"qnaProject": {
"targetProjectKind": "QuestionAnswering",
"callingOptions": {
"context": {
"previousUserQuery": "Meet Surface Pro 4",
"previousQnaId": 4
},
"top": 1,
"question": "App Service overview"
}
}
}
}
}
发送请求后,你将获得预测的以下响应!
{
"kind": "ConversationResult",
"result": {
"query": "App Service overview",
"prediction": {
"projectKind": "Orchestration",
"topIntent": "qnaTargetApp",
"intents": {
"qnaTargetApp": {
"targetProjectKind": "QuestionAnswering",
"confidenceScore": 1,
"result": {
"answers": [
{
"questions": [
"App Service overview"
],
"answer": "The compute resources you use are determined by the *App Service plan* that you run your apps on.",
"confidenceScore": 0.7384000000000001,
"id": 1,
"source": "https://learn.microsoft.com/azure/app-service/overview",
"metadata": {},
"dialog": {
"isContextOnly": false,
"prompts": []
}
}
]
}
}
}
}
}
}