你当前正在访问 Microsoft Azure Global Edition 技术文档网站。 如果需要访问由世纪互联运营的 Microsoft Azure 中国技术文档网站,请访问 https://docs.azure.cn

Knowledgebase - Download

下载知识库。

GET {Endpoint}/qnamaker/v4.0/knowledgebases/{kbId}/{environment}/qna
GET {Endpoint}/qnamaker/v4.0/knowledgebases/{kbId}/{environment}/qna?source={source}&changedSince={changedSince}

URI 参数

名称 必需 类型 说明
Endpoint
path True

string

支持的认知服务终结点(例如,https://< qnamaker-resource-name> .api.cognitiveservices.azure.com)。

environment
path True

EnvironmentType

指定环境是测试环境还是 Prod。

kbId
path True

string

知识库 ID。

changedSince
query

string

changedSince 属性用于返回在特定时间段后创建或更新的所有 QnA。 用户可以按秒(秒)、分钟(m)、小时(h)和天(d)筛选 QnA。 用户可以将任何整型值与后缀一起用于时间。 例如,5m 的值返回在过去 5 分钟内更新或创建的所有 QnA 对。

source
query

string

要应用的源属性筛选器。 示例值:编辑、smartLight%20FAQ.tsv。

请求头

名称 必需 类型 说明
Ocp-Apim-Subscription-Key True

string

响应

名称 类型 说明
200 OK

QnADocumentsDTO

知识库中所有 Q-A 的集合。

Other Status Codes

ErrorResponse

错误响应。

安全性

Ocp-Apim-Subscription-Key

类型: apiKey
在: header

示例

Successful query

示例请求

GET {Endpoint}/qnamaker/v4.0/knowledgebases/9d091697-fb8c-4ed5-9ac0-35bf8273bfff/Test/qna

示例响应

{
  "qnaDocuments": [
    {
      "id": 1,
      "answer": "You can change the default message if you use the QnAMakerDialog. See this for details: https://docs.botframework.com/en-us/azure-bot-service/templates/qnamaker/#navtitle",
      "source": "Custom Editorial",
      "questions": [
        "How can I change the default message from QnA Maker?"
      ],
      "metadata": [],
      "context": {
        "isContextOnly": false,
        "prompts": []
      }
    },
    {
      "id": 2,
      "answer": "You can use our REST apis to create a KB. See here for details: https://docs.microsoft.com/en-us/rest/api/cognitiveservices/qnamaker/knowledgebase/create",
      "source": "Custom Editorial",
      "questions": [
        "How do I programmatically create a KB?"
      ],
      "metadata": [
        {
          "name": "category",
          "value": "api"
        }
      ],
      "context": {
        "isContextOnly": false,
        "prompts": [
          {
            "displayOrder": 1,
            "qnaId": 3,
            "displayText": "Update KB"
          }
        ]
      }
    },
    {
      "id": 3,
      "answer": "You can use our REST apis to update your KB. See here for details: https://docs.microsoft.com/en-us/rest/api/cognitiveservices/qnamaker/knowledgebase/update",
      "source": "Editorial",
      "questions": [
        "How do I programmatically update my KB?"
      ],
      "metadata": [
        {
          "name": "category",
          "value": "api"
        }
      ],
      "context": {
        "isContextOnly": false,
        "prompts": [
          {
            "displayOrder": 1,
            "qnaId": 4,
            "displayText": "Refresh Endpoint Keys"
          }
        ]
      }
    },
    {
      "id": 4,
      "answer": "You can use our REST apis to refresh endpoint keys. See here for details: https://docs.microsoft.com/en-us/rest/api/cognitiveservices/qnamaker/endpointkeys/refreshkeys",
      "source": "Editorial",
      "questions": [
        "How do I programmatically refresh endpoint keys?"
      ],
      "metadata": [],
      "context": {
        "isContextOnly": false,
        "prompts": []
      }
    }
  ]
}

定义

名称 说明
Context

与要更新的 Qna 关联的上下文。

EnvironmentType

指定环境是测试环境还是 Prod。

Error

错误对象。 根据Microsoft一个 API 指南 - https://github.com/Microsoft/api-guidelines/blob/vNext/Guidelines.md#7102-error-condition-responses

ErrorCodeType

服务器定义的错误代码集之一。

ErrorResponse

错误响应。 根据Microsoft一个 API 指南 - https://github.com/Microsoft/api-guidelines/blob/vNext/Guidelines.md#7102-error-condition-responses

InnerErrorModel

包含有关错误的更具体信息的对象。 根据Microsoft一个 API 指南 - https://github.com/Microsoft/api-guidelines/blob/vNext/Guidelines.md#7102-error-condition-responses

MetadataDTO

名称 - 元数据值对。

PromptDTO

提示输入答案。

Qna

QnADTO - QnaId 或 QnADTO 需要存在于 PromptDTO 对象中

QnADocumentsDTO

QnADTO 列表

QnADTO

Q-A 对象。

Context

与要更新的 Qna 关联的上下文。

名称 类型 说明
isContextOnly

boolean

如果提示仅与前面的问题相关,则进行标记。 true - 请勿将此 QnA 作为没有上下文 false 的查询的搜索结果包含 - 忽略上下文并在搜索结果中包含此 QnA

promptsToAdd

PromptDTO[]

要添加到 qna 的提示列表。

promptsToDelete

integer[] (int32)

要删除的 qna 关联的提示列表

EnvironmentType

指定环境是测试环境还是 Prod。

说明
Prod
Test

Error

错误对象。 根据Microsoft一个 API 指南 - https://github.com/Microsoft/api-guidelines/blob/vNext/Guidelines.md#7102-error-condition-responses

名称 类型 说明
code

ErrorCodeType

服务器定义的错误代码集之一。

details

Error[]

导致此报告错误的特定错误的详细信息数组。

innerError

InnerErrorModel

包含与当前对象有关错误的更具体信息的对象。

message

string

错误的人工可读表示形式。

target

string

错误的目标。

ErrorCodeType

服务器定义的错误代码集之一。

说明
BadArgument
EndpointKeysError
ExtractionFailure
Forbidden
KbNotFound
NotFound
OperationNotFound
QnaRuntimeError
QuotaExceeded
SKULimitExceeded
ServiceError
Unauthorized
Unspecified
ValidationFailure

ErrorResponse

错误响应。 根据Microsoft一个 API 指南 - https://github.com/Microsoft/api-guidelines/blob/vNext/Guidelines.md#7102-error-condition-responses

名称 类型 说明
error

Error

错误对象。

InnerErrorModel

包含有关错误的更具体信息的对象。 根据Microsoft一个 API 指南 - https://github.com/Microsoft/api-guidelines/blob/vNext/Guidelines.md#7102-error-condition-responses

名称 类型 说明
code

string

比包含的错误提供的错误代码更具体。

innerError

InnerErrorModel

包含与当前对象有关错误的更具体信息的对象。

MetadataDTO

名称 - 元数据值对。

名称 类型 说明
name

string

minLength: 1
maxLength: 100

元数据名称。

value

string

minLength: 1
maxLength: 500

元数据值。

PromptDTO

提示输入答案。

名称 类型 说明
displayOrder

integer (int32)

提示的索引 - 用于提示排序

displayText

string

maxLength: 200

显示以表示后续问题提示的文本

qna

Qna

QnADTO - QnaId 或 QnADTO 需要存在于 PromptDTO 对象中

qnaId

integer (int32)

与提示对应的 Qna ID - 如果 QnaId 存在,则忽略 QnADTO 对象。

Qna

QnADTO - QnaId 或 QnADTO 需要存在于 PromptDTO 对象中

名称 类型 说明
answer

string

minLength: 1
maxLength: 25000

应答文本

context

Context

QnA 的上下文

id

integer (int32)

Q-A 的唯一 ID。

metadata

MetadataDTO[]

与答案关联的元数据列表。

questions

string[]

与答案关联的问题列表。

source

string

maxLength: 300

从中为 Q-A 编制索引的源。例如https://docs.microsoft.com/en-us/azure/cognitive-services/QnAMaker/FAQs

QnADocumentsDTO

QnADTO 列表

名称 类型 说明
qnaDocuments

QnADTO[]

答案列表。

QnADTO

Q-A 对象。

名称 类型 说明
answer

string

minLength: 1
maxLength: 25000

应答文本

context

Context

QnA 的上下文

id

integer (int32)

Q-A 的唯一 ID。

metadata

MetadataDTO[]

与答案关联的元数据列表。

questions

string[]

与答案关联的问题列表。

source

string

maxLength: 300

从中为 Q-A 编制索引的源。例如https://docs.microsoft.com/en-us/azure/cognitive-services/QnAMaker/FAQs