簡體   English   中英

Bot 框架 - 自適應對話框

[英]Bot framework - Adaptive dialog

我正在使用機器人框架自適應對話框。 我在通過使用識別器讀取 luis 數據來獲取意圖和解析實體時遇到問題。 只有通過在子自適應對話框中閱讀“turn.recognized”才能獲得響應中得分最高的意圖。我已將我的 luis 遷移到 v3 並在調用 luis 時將 IncludeAllIntents 屬性設置為 true。 我錯過了在 LuisAdaptiveRecognizer 中設置任何屬性嗎? 誰能幫我解決這個問題,因為我有一個場景來檢查機器人中第二個得分最高的意圖。 這是自適應對話的問題嗎?

我使用 Ms docs 來構建機器人自適應對話框。

還有一件事有沒有辦法從 turn.recognized 的結果中提取 luis 解析的實體作為 RecognizerResult 類型。

根對話框:

var rootDialog = new AdaptiveDialog(nameof(AdaptiveDialog))
{
    Recognizer = new LuisAdaptiveRecognizer()
    {
        ApplicationId = Configuration["LuisAppId"],
        EndpointKey = Configuration["LuisAPIKey"],
        Endpoint = Configuration["LuisAPIHostName"],
        PredictionOptions = new Microsoft.Bot.Builder.AI.LuisV3.LuisPredictionOptions
        {
            IncludeAllIntents = true,
            IncludeInstanceData = true,
            IncludeAPIResults = true,
            PreferExternalEntities = true,
            Slot = "producton"
        }
    },
    Triggers = new List<OnCondition>()
    {
         new OnIntent("Greetings")
        {
            Actions = new List<Dialog>()
            {
                new SendActivity("${HelpRootDialog()}")
            }
        },
    },

子對話框:

public FindLinks(IConfiguration configuration) : base(nameof(FindLinks))
{
    _configuration = configuration;
    this.LinksDialog = new AdaptiveDialog(nameof(FindLinks))
    {
        Triggers = new List<OnCondition>()
        {
            new OnBeginDialog()
            {
                Actions = new List<Dialog>()
                    {
                        new CodeAction(ResolveAndSendAnswer)
                    }
            },
        }
    };

    AddDialog(this._findLinksDialog);
    InitialDialogId = nameof(FindLinks);
}

private async Task<DialogTurnResult> ResolveAndSendAnswer(DialogContext dialogContext, System.Object options)
{
    JObject jObject;
    IList<string> queries = new List<string>();
    dialogContext.State.TryGetValue("turn.recognized", out jObject);

    ....This is how i resolved the luis data from the turn.
}

不幸的是,自適應對話框被設計為只包含一個turn.recognized 。無論您使用哪種識別器,都可以識別。 您可以在此處的源代碼中看到:

 result.Intents.Clear(); result.Intents.Add(topIntent, topScore);

看起來其他意圖可以訪問的唯一位置是在您的遙測中。 所以你有幾個選擇,雖然我知道它們並不理想。

  1. 顯式調用 LUIS 端點,而不是依賴LuisAdaptiveRecognizer 這可以使用 HTTP 請求作為自適應對話框內的操作來完成,也可以在對話框外完成。
  2. 從記錄的遙測中加載額外的意圖。 如果您制作了一個自定義遙測客戶端,使數據在您的機器人的本地 memory 中可用,這可能是最簡單的。
  3. 在 GitHub 上提出功能請求,要求他們在自適應對話框中提供所有意圖: https://github.com/microsoft/botbuilder-dotnet/issues/new/choose

暫無
暫無

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

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