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

Knowledgebase - Replace

替换知识库内容。

PUT {Endpoint}/qnamaker/v5.0-preview.2/knowledgebases/{kbId}

URI 参数

名称 必需 类型 说明
Endpoint
path True

string

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

kbId
path True

string

知识库 ID。

请求头

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

string

请求正文

名称 必需 类型 说明
qnAList True

QnADTO[]

要添加到知识库的 Q-A(QnADTO)列表。 Q-A ID 由服务分配,应省略。

响应

名称 类型 说明
204 No Content

HTTP 204 无内容。

Other Status Codes

ErrorResponse

错误响应。

安全性

Ocp-Apim-Subscription-Key

类型: apiKey
在: header

示例

Successful query

示例请求

PUT {Endpoint}/qnamaker/v5.0-preview.2/knowledgebases/9d091697-fb8c-4ed5-9ac0-35bf8273bfff


{
  "qnAList": [
    {
      "id": 0,
      "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": []
    },
    {
      "id": 0,
      "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

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

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 对象中

QnADTO

Q-A 对象。

ReplaceKbDTO

替换 KB作的后正文架构。

Context

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

名称 类型 说明
isContextOnly

boolean

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

promptsToAdd

PromptDTO[]

要添加到 qna 的提示列表。

promptsToDelete

integer[] (int32)

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

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。

lastUpdatedTimestamp

string

maxLength: 300

上次更新 QnA 时的时间戳。

metadata

MetadataDTO[]

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

questions

string[]

与答案关联的问题列表。

source

string

maxLength: 300

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

QnADTO

Q-A 对象。

名称 类型 说明
answer

string

minLength: 1
maxLength: 25000

应答文本

context

Context

QnA 的上下文

id

integer (int32)

Q-A 的唯一 ID。

lastUpdatedTimestamp

string

maxLength: 300

上次更新 QnA 时的时间戳。

metadata

MetadataDTO[]

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

questions

string[]

与答案关联的问题列表。

source

string

maxLength: 300

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

ReplaceKbDTO

替换 KB作的后正文架构。

名称 类型 说明
qnAList

QnADTO[]

要添加到知识库的 Q-A(QnADTO)列表。 Q-A ID 由服务分配,应省略。