Skip to content

Wit.ai integration with Microsoft Bot Builder LuisDialog.

License

Notifications You must be signed in to change notification settings

adebisi-fa/Bot.Builder.WitAi

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Bot.Builder.WitAi

Wit.ai integration with Microsoft Bot Builder LuisDialog. It implements the Bot Builder ILuisService.

Installation

Install-Package Adfa.Bot.Builder.WitAi

Usage

[Serializable]
public class MyLuisDialog : LuisDialog<string> {
    public MyLuisDialog() : base(new WitAiLuisService("wit-token-goes-here")) { }
    
    [LuisIntent("")]
    public async Task None(IDialogContext context, LuisResult result)
    {
        await context.PostAsync($"Sorry I couldn't process that expression.");
        // ...
        // Close dialog and return to parent
        context.Done(result?.Query);
    }
}

Note

Since wit.ai doesn't have Intent as a first class feature (as available in Microsoft LIUS), your query must include at least an entity with the name "intent".

You can then setup a LuisIntent attribute with the value of the "intent" entity, in a LuisDialog derivative class. The following example setup a handler for an wit.ai entity with the name "intent", and value "register":

public class MyWitAiDialog : LuisDialog<string> {
    public MyLuisDialog() : base(new WitAiLuisService("wit-token-goes-here")) { }
    ...
    [LuisIntent("register")]
    public async Task Register(IDialogContext context, LuisResult result)
    {
        //
        // Retrieve registration information from 'result' parameter.
        // Registration logic goes here
        //
        
        // Report success
        await context.PostAsync($"Registration completed.");
        ...
    }
}

About

Wit.ai integration with Microsoft Bot Builder LuisDialog.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages