取得專案的分析

自訂問題解答會使用 Azure 診斷記錄來儲存遙測資料和聊天記錄。 請遵循下列步驟來執行範例查詢,以取得您自訂問題解答專案使用方式的分析。

  1. 為語言資源啟用診斷記錄,並啟用自訂問題解答。

  2. 在上一個步驟中,除了 [Audit, RequestResponse and AllMetrics] \(稽核、要求回應及所有計量\) 之外,選取 [Trace] \(追蹤\) 以進行記錄

    在自訂問題解答中啟用追蹤記錄

Kusto 查詢

聊天記錄

// All QnA Traffic
AzureDiagnostics
| where ResourceProvider == "MICROSOFT.COGNITIVESERVICES"
| where OperationName=="CustomQuestionAnswering QueryKnowledgebases" // This OperationName is valid for custom question answering enabled resources
| extend answer_ = tostring(parse_json(properties_s).answer)
| extend question_ = tostring(parse_json(properties_s).question)
| extend score_ = tostring(parse_json(properties_s).score)
| extend kbId_ = tostring(parse_json(properties_s).kbId)
| project question_, answer_, score_, kbId_

每個專案和使用者在一段時間內的流量計數

// Traffic count per KB and user in a time period
let startDate = todatetime('2019-01-01');
let endDate = todatetime('2020-12-31');
AzureDiagnostics
| where ResourceProvider == "MICROSOFT.COGNITIVESERVICES"
| where OperationName=="CustomQuestionAnswering QueryKnowledgebases" // This OperationName is valid for custom question answering enabled resources
| where TimeGenerated <= endDate and TimeGenerated >=startDate
| extend kbId_ = tostring(parse_json(properties_s).kbId)
| extend userId_ = tostring(parse_json(properties_s).userId)
| summarize ChatCount=count() by bin(TimeGenerated, 1d), kbId_, userId_

GenerateAnswer API 的延遲

// Latency of GenerateAnswer
AzureDiagnostics
| where ResourceProvider == "MICROSOFT.COGNITIVESERVICES"
| where OperationName=="Generate Answer"
| project TimeGenerated, DurationMs
| render timechart

所有作業的平均延遲

// Average Latency of all operations
AzureDiagnostics
| where ResourceProvider == "MICROSOFT.COGNITIVESERVICES"
| project DurationMs, OperationName
| summarize count(), avg(DurationMs) by OperationName
| render barchart

未回答的問題

// All unanswered questions
AzureDiagnostics
| where ResourceProvider == "MICROSOFT.COGNITIVESERVICES"
| where OperationName=="CustomQuestionAnswering QueryKnowledgebases" // This OperationName is valid for custom question answering enabled resources
| extend answer_ = tostring(parse_json(properties_s).answer)
| extend question_ = tostring(parse_json(properties_s).question)
| extend score_ = tostring(parse_json(properties_s).score)
| extend kbId_ = tostring(parse_json(properties_s).kbId)
| where score_ == 0
| project question_, answer_, score_, kbId_

預建的問題解答推斷呼叫

// Show logs from AzureDiagnostics table 
// Lists the latest logs in AzureDiagnostics table, sorted by time (latest first). 
AzureDiagnostics
| where OperationName == "CustomQuestionAnswering QueryText"
| extend answer_ = tostring(parse_json(properties_s).answer)
| extend question_ = tostring(parse_json(properties_s).question)
| extend score_ = tostring(parse_json(properties_s).score)
| extend requestid = tostring(parse_json(properties_s)["apim-request-id"])
| project TimeGenerated, requestid, question_, answer_, score_

後續步驟