我正尝试使用nuget Microsoft.Azure.CognitiveServices.Knowledge.QnAMaker来使用QnAMakerClient和Knowledgebase.DownloadWithHttpMessagesAsync,但是当我尝试实例化Microsoft.Azure.CognitiveServices.Knowledge.QnAMaker()时,参数是抽象类,所以我不知道如何使用QnAMakerClient下载Body.QnaDocuments的内容。
Microsoft.Azure.CognitiveServices.Knowledge.QnAMaker.QnAMakerClient z = new Microsoft.Azure.CognitiveServices.Knowledge.QnAMaker.QnAMakerClient(new ServiceClientCredentials(),HttpClient httpClient, bool disposeHttpClient);
var kb = z.Knowledgebase.DownloadWithHttpMessagesAsync("key", "test").Result;
感谢您的帮助。
答案 0 :(得分:0)
@elise您可以找到一个有关如何下载知识库here的示例。
本质上:
var client = new QnAMakerClient(new ApiKeyServiceClientCredentials(key)) { Endpoint = endpoint };
// Download the KB
Console.Write("Downloading KB...");
var kbData = await client.Knowledgebase.DownloadAsync(kbId, EnvironmentType.Prod);
Console.WriteLine("KB Downloaded. It has {0} QnAs.", kbData.QnaDocuments.Count);