簡體   English   中英

將Azure搜索與Virtual Assistant Template Bot集成

[英]Integrating Azure Search with Virtual Assistant Template bot

我目前有一個功能齊全的基於虛擬助手模板的聊天機器人,並且具有附加的技能。 我的目標是將該技能用作一種搜索功能,可以在CosmosDB中查找資源並將其拉回以供用戶使用。 經過一些研究,我相信最好的方法是使用Azure搜索來檢索所說的信息。 從我在Virtual Assistant模板文檔中看到的與Azure搜索的集成絕對應該是可能的...我只是沒有找到任何有關此操作的示例或教程。 如果有人知道如何創建天藍色搜索資源並將其集成到機器人中,或者知道可以告訴您如何執行此操作的資源,請告訴我!

對於您的方案,要做的事情概述是:

  1. 創建一個Azure搜索服務
  2. 在其中創建一個索引器 ,該索引器將指向您的Cosmos DB數據源。 以下是特定於您如何在Cosmos DB中爬網數據的文檔: https : //docs.microsoft.com/zh-cn/azure/search/search-search-howto-index-cosmosdb
  3. 一旦您的索引器運行並在您的數據中進行了爬網,就可以從搜索索引中的應用程序中對其進行搜索。

沒有關於與機器人集成的端到端教程,但是這里有一個Azure搜索教程,該教程顯示了通過SQL數據庫進行爬網然后使用全文本搜索進行搜索的完整方案。 https://docs.microsoft.com/en-us/azure/search/search-indexer-tutorial

除了上面鏈接中Cosmos DB indexer的詳細信息替換有關SQL indexer的部分以外,您應該能夠遵循那里的大多數指南。

我想進行類似的搜索(僅在AzureBlob中而不是Cosmos DB中)。 我正在將sdk v4用於我的機器人框架和Visual Studio 2019.我正在嘗試通過以下代碼調用該服務:

    public ISearchIndexClient CreateSearchIndexClient()
    {
        string searchServiceName = "MySearchServiceName";
        string queryApiKey = "MySearchServiceKey";
        string indexName = "MyIndexName";

        SearchIndexClient indexClient = new SearchIndexClient(searchServiceName, indexName, new SearchCredentials(queryApiKey));
        return indexClient;
    }

    public async Task StartAsync(ITurnContext turnContext, string searchText){
        ISearchIndexClient infoClient = CreateSearchIndexClient();

        string indexname = infoClient.IndexName;
        DocumentSearchResult<Document> results = infoClient.Documents.Search(searchText);

        await turnContext.SendActivityAsync(MessageFactory.Text($"Here should be the results: {results} \n...and then my index: {indexname}."));
    }

它運行無錯誤,因此可以使用它。 但是它永遠不會在StartAsync上顯示該消息。 如果有人看到我想念的東西,請先謝謝你。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM