Knowledgebase - Update
修改知識庫的異步操作。
PATCH {Endpoint}/qnamaker/v5.0-preview.2/knowledgebases/{kbId}
URI 參數
名稱 | 位於 | 必要 | 類型 | Description |
---|---|---|---|---|
Endpoint
|
path | True |
string |
支持的認知服務端點 (例如,https://< qnamaker-resource-name >.api.cognitiveservices.azure.com) 。 |
kb
|
path | True |
string |
知識庫標識碼。 |
要求標頭
名稱 | 必要 | 類型 | Description |
---|---|---|---|
Ocp-Apim-Subscription-Key | True |
string |
要求本文
名稱 | 類型 | Description |
---|---|---|
add |
用於新增作業的 CreateKbInputDTO 實例 |
|
defaultAnswerUsedForExtraction |
string |
任何 Q-A 中沒有擷取答案但具有階層的 Q-A 中,要當做答案使用的文字字串。 EnableHierarchicalExtraction 字段設定為 True 時為必要項。 |
delete |
刪除作業的DeleteKbContentsDTO實例 |
|
enableHierarchicalExtraction |
boolean |
從檔案和 URL 啟用 Q-A 的階層式擷取。 如果此欄位不存在,則會使用 KB 建立期間設定的值。 |
update |
UpdateKbContentsDTO for Update Operation 的實例 |
回應
名稱 | 類型 | Description |
---|---|---|
202 Accepted |
異步操作的詳細數據。 Headers Location: string |
|
Other Status Codes |
錯誤回應。 |
安全性
Ocp-Apim-Subscription-Key
Type:
apiKey
In:
header
範例
Successful query
Sample Request
PATCH {Endpoint}/qnamaker/v5.0-preview.2/knowledgebases/9d091697-fb8c-4ed5-9ac0-35bf8273bfff
{
"add": {
"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": []
}
],
"urls": [
"https://docs.microsoft.com/en-us/azure/cognitive-services/Emotion/FAQ"
],
"files": [
{
"fileName": "SurfaceManual.pdf",
"fileUri": "https://download.microsoft.com/download/2/9/B/29B20383-302C-4517-A006-B0186F04BE28/surface-pro-4-user-guide-EN.pdf"
}
]
},
"delete": {
"ids": [
13,
35
]
},
"update": {
"name": "QnA Maker FAQ Prompts Bot",
"qnaList": [
{
"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": {
"add": [],
"delete": []
},
"metadata": {
"add": [],
"delete": []
},
"context": {
"isContextOnly": false,
"promptsToAdd": [
{
"displayText": "Add Prompts",
"displayOrder": 0,
"qna": {
"id": 0,
"answer": "Click here to know more https://docs.microsoft.com/en-us/azure/cognitive-services/qnamaker/how-to/multiturn-conversation",
"source": "Editorial",
"questions": [
"How can I add prompts?"
],
"metadata": [],
"context": {
"isContextOnly": false,
"prompts": []
}
},
"qnaId": 0
},
{
"displayText": "Delete Prompts",
"displayOrder": 0,
"qna": {
"id": 0,
"answer": "Click here to know more https://docs.microsoft.com/en-us/azure/cognitive-services/qnamaker/how-to/multiturn-conversation",
"source": "Editorial",
"questions": [
"How can I delete delete prompts?"
],
"metadata": [],
"context": {
"isContextOnly": false,
"prompts": []
}
},
"qnaId": 0
},
{
"displayText": "Update Knowledgebase",
"displayOrder": 0,
"qna": null,
"qnaId": 3
}
],
"promptsToDelete": [
3
]
}
},
{
"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": "Custom Editorial",
"questions": {
"add": [],
"delete": []
},
"metadata": {
"delete": [
{
"name": "category",
"value": "api"
}
],
"add": [
{
"name": "category",
"value": "programmatic"
}
]
},
"context": {
"isContextOnly": false,
"promptsToAdd": [
{
"displayText": "Regenerate Endpoint keys",
"displayOrder": 1,
"qna": null,
"qnaId": 4
}
],
"promptsToDelete": [
4
]
}
}
]
}
}
Sample Response
{
"operationState": "NotStarted",
"createdTimestamp": "2018-03-19T07:38:46Z",
"lastActionTimestamp": "2018-03-19T07:39:29Z",
"userId": "86bb8390-56c0-42c2-9f81-3de161981191",
"operationId": "03a4f4ce-30a6-4ec6-b436-02bcdf6153e1"
}
定義
名稱 | Description |
---|---|
Add |
用於新增作業的 CreateKbInputDTO 實例 |
Context |
與要更新之 Qna 相關聯的內容。 |
Delete |
刪除作業的DeleteKbContentsDTO實例 |
Error |
error 物件。 根據 Microsoft One API 指導方針 - https://github.com/Microsoft/api-guidelines/blob/vNext/Guidelines.md#7102-error-condition-responses。 |
Error |
其中一組伺服器定義的錯誤碼。 |
Error |
錯誤回應。 根據 Microsoft One API 指導方針 - https://github.com/Microsoft/api-guidelines/blob/vNext/Guidelines.md#7102-error-condition-responses。 |
FileDTO |
DTO 可保存已上傳檔案的詳細數據。 |
Inner |
物件,包含錯誤的詳細資訊。 根據 Microsoft One API 指導方針 - https://github.com/Microsoft/api-guidelines/blob/vNext/Guidelines.md#7102-error-condition-responses。 |
Metadata |
與要更新之答案相關聯的元數據清單 |
MetadataDTO |
名稱 -元數據的值組。 |
Operation |
記錄以追蹤長時間執行的作業。 |
Operation |
作業狀態。 |
PromptDTO |
提示輸入答案。 |
Qna |
QnADTO - QnaId 或 QnADTO 必須存在於 PromptDTO 物件中 |
QnADTO |
Q-A 物件。 |
Questions |
與答案相關聯的問題清單。 |
Update |
UpdateKbContentsDTO for Update Operation 的實例 |
Update |
包含要更新的 QnA 清單 |
Update |
更新 Qna 清單的 PATCH 本文架構 |
Add
用於新增作業的 CreateKbInputDTO 實例
名稱 | 類型 | Description |
---|---|---|
files |
FileDTO[] |
要新增至知識庫的檔案清單。 |
qnaList |
QnADTO[] |
要新增至索引的 QNA 清單。 服務會產生標識碼,而且應該省略。 |
urls |
string[] |
要新增至知識庫的URL清單。 |
Context
與要更新之 Qna 相關聯的內容。
名稱 | 類型 | Description |
---|---|---|
isContextOnly |
boolean |
若要標示提示是否只與先前的問題相關。 true - 請勿將此 QnA 作為沒有內容 false 的查詢搜尋結果 - 忽略內容並在搜尋結果中包含此 QnA |
promptsToAdd |
要新增至 qna 的提示清單。 |
|
promptsToDelete |
integer[] |
要刪除之 qna 相關聯的提示清單 |
Delete
刪除作業的DeleteKbContentsDTO實例
名稱 | 類型 | Description |
---|---|---|
ids |
integer[] |
要刪除的 Qna 識別符清單 |
sources |
string[] |
要從知識庫中刪除的來源清單。 |
Error
error 物件。 根據 Microsoft One API 指導方針 - https://github.com/Microsoft/api-guidelines/blob/vNext/Guidelines.md#7102-error-condition-responses。
名稱 | 類型 | Description |
---|---|---|
code |
其中一組伺服器定義的錯誤碼。 |
|
details |
Error[] |
導致此錯誤之特定錯誤的詳細數據陣列。 |
innerError |
物件,包含比目前對象有關錯誤更具體的資訊。 |
|
message |
string |
人類可讀取的錯誤表示法。 |
target |
string |
錯誤的目標。 |
ErrorCodeType
其中一組伺服器定義的錯誤碼。
名稱 | 類型 | Description |
---|---|---|
BadArgument |
string |
|
EndpointKeysError |
string |
|
ExtractionFailure |
string |
|
Forbidden |
string |
|
KbNotFound |
string |
|
NotFound |
string |
|
OperationNotFound |
string |
|
QnaRuntimeError |
string |
|
QuotaExceeded |
string |
|
SKULimitExceeded |
string |
|
ServiceError |
string |
|
Unauthorized |
string |
|
Unspecified |
string |
|
ValidationFailure |
string |
ErrorResponse
錯誤回應。 根據 Microsoft One API 指導方針 - https://github.com/Microsoft/api-guidelines/blob/vNext/Guidelines.md#7102-error-condition-responses。
名稱 | 類型 | Description |
---|---|---|
error |
error 物件。 |
FileDTO
DTO 可保存已上傳檔案的詳細數據。
名稱 | 類型 | Description |
---|---|---|
fileName |
string |
檔案名稱 支援的檔類型為 “.tsv”、“.pdf”、“.txt”、“.docx”、“.xlsx”。 |
fileUri |
string |
檔案的公用 URI。 |
isUnstructured |
boolean |
選擇性旗標,指定指定的檔案是否為非結構化。 |
InnerErrorModel
物件,包含錯誤的詳細資訊。 根據 Microsoft One API 指導方針 - https://github.com/Microsoft/api-guidelines/blob/vNext/Guidelines.md#7102-error-condition-responses。
名稱 | 類型 | Description |
---|---|---|
code |
string |
比包含的錯誤所提供更明確的錯誤碼。 |
innerError |
物件,包含比目前對象有關錯誤更具體的資訊。 |
Metadata
與要更新之答案相關聯的元數據清單
名稱 | 類型 | Description |
---|---|---|
add |
要新增之回應相關聯的元數據清單 |
|
delete |
與要刪除之答案相關聯的元數據清單 |
MetadataDTO
名稱 -元數據的值組。
名稱 | 類型 | Description |
---|---|---|
name |
string |
中繼資料名稱。 |
value |
string |
中繼資料值。 |
Operation
記錄以追蹤長時間執行的作業。
名稱 | 類型 | Description |
---|---|---|
createdTimestamp |
string |
建立作業時的時間戳。 |
errorResponse |
發生失敗時的錯誤詳細數據。 |
|
lastActionTimestamp |
string |
輸入目前狀態時的時間戳。 |
operationId |
string |
作業識別碼。 |
operationState |
作業狀態。 |
|
resourceLocation |
string |
已完成資源的目標資源位置相對 URI。 |
userId |
string |
使用者識別碼 |
OperationStateType
作業狀態。
名稱 | 類型 | Description |
---|---|---|
Failed |
string |
|
NotStarted |
string |
|
Running |
string |
|
Succeeded |
string |
PromptDTO
提示輸入答案。
名稱 | 類型 | Description |
---|---|---|
displayOrder |
integer |
提示的索引 - 用於排序提示 |
displayText |
string |
顯示代表後續問題提示的文字 |
qna |
QnADTO - QnaId 或 QnADTO 必須存在於 PromptDTO 物件中 |
|
qnaId |
integer |
對應至提示的 Qna 識別碼 - 如果 QnaId 存在,則會忽略 QnADTO 物件。 |
Qna
QnADTO - QnaId 或 QnADTO 必須存在於 PromptDTO 物件中
名稱 | 類型 | Description |
---|---|---|
answer |
string |
回應簡訊 |
context |
QnA 的內容 |
|
id |
integer |
Q-A 的唯一標識碼。 |
lastUpdatedTimestamp |
string |
上次更新 QnA 時的時間戳。 |
metadata |
與答案相關聯的元數據清單。 |
|
questions |
string[] |
與答案相關聯的問題清單。 |
source |
string |
Q-A 編製索引的來源。例如 https://docs.microsoft.com/en-us/azure/cognitive-services/QnAMaker/FAQs |
QnADTO
Q-A 物件。
名稱 | 類型 | Description |
---|---|---|
answer |
string |
回應簡訊 |
context |
QnA 的內容 |
|
id |
integer |
Q-A 的唯一標識碼。 |
lastUpdatedTimestamp |
string |
上次更新 QnA 時的時間戳。 |
metadata |
與答案相關聯的元數據清單。 |
|
questions |
string[] |
與答案相關聯的問題清單。 |
source |
string |
Q-A 編製索引的來源。例如 https://docs.microsoft.com/en-us/azure/cognitive-services/QnAMaker/FAQs |
Questions
與答案相關聯的問題清單。
名稱 | 類型 | Description |
---|---|---|
add |
string[] |
要新增的問題清單 |
delete |
string[] |
要刪除的問題清單。 |
Update
UpdateKbContentsDTO for Update Operation 的實例
名稱 | 類型 | Description |
---|---|---|
defaultAnswer |
string |
如果 KB 中找不到相符專案,則傳送給用戶的預設答案。 |
name |
string |
知識庫的易記名稱。 |
qnaList |
要新增至知識庫的 Q-A (UpdateQnaDTO) 清單。 |
|
urls |
string[] |
要重新整理的現有URL清單。 內容會再次擷取並重新編製索引。 |
UpdateKbOperationDTO
包含要更新的 QnA 清單
名稱 | 類型 | Description |
---|---|---|
add |
用於新增作業的 CreateKbInputDTO 實例 |
|
defaultAnswerUsedForExtraction |
string |
任何 Q-A 中沒有擷取答案但具有階層的 Q-A 中,要當做答案使用的文字字串。 EnableHierarchicalExtraction 字段設定為 True 時需要。 |
delete |
刪除作業的DeleteKbContentsDTO實例 |
|
enableHierarchicalExtraction |
boolean |
從檔案和 URL 啟用 Q-A 的階層式擷取。 如果此欄位不存在,則會使用 KB 建立期間設定的值。 |
update |
UpdateKbContentsDTO for Update Operation 的實例 |
UpdateQnaDTO
更新 Qna 清單的 PATCH 本文架構
名稱 | 類型 | Description |
---|---|---|
answer |
string |
回應簡訊 |
context |
與要更新之 Qna 相關聯的內容。 |
|
id |
integer |
Q-A 的唯一標識碼 |
metadata |
與要更新之答案相關聯的元數據清單 |
|
questions |
與答案相關聯的問題清單。 |
|
source |
string |
Q-A 編製索引的來源。例如 https://docs.microsoft.com/en-us/azure/cognitive-services/QnAMaker/FAQs |