Skip to content

IBotConversationTalkingPoint

CogniSim Soft edited this page Jul 26, 2018 · 1 revision

IBotConversationTalkingPoint

Essentially, a "Talking Point" defines the context of the conversation such as talking about your dog. Talking points can transition from one to another as the context of the conversation is changed.

Variables

    Guid uuid { get; set; }

    string Name { get; set; }

    string Text { get; set; }

    ICollection<IBotConversationTalkingPoint> Transitions { get; set; }

    IDictionary<IBotConversationTalkingPoint, int> TransitionPriorities { get; set; }

Methods

    Func<EchoState, IBotConversationTalkingPoint, LuisResult, (bool success, Action<object> callback)> ActivateOn { get; set; }

    bool SetPriority(IBotConversationTalkingPoint talkingPoint, uint priority);

    public BotConversationTalkingPoint(string name = null)

Instantiation

    // Talking Point Name, Just For Reference Purposes
    IBotConversationTalkingPoint botConversation = new BotConversationTalkingPoint("talkingPoint_AboutMyDog");

Transitions

Transitions essentially allows for a seamless conversation that can follow the user context. For instance, if you're talking about your dog, you may have several talking point transitions that includes things like asking about the color/size of the dog, the dogs' age, etc.

The Transitions variable is just a collection reference of other talking points you have defined.

TransitionPriorities

Higher priority transitions will take precedence over the lower. Basically, if two talking points are transition-able and meet conversation requirements, the talking point with the highest priority will be used.

ActivateOn

This function is what determines whether a talking point should be transitioned to. For instance, if you're currently speaking about flight details, you would only want to proceed in booking the flight when the user has responded with where he/she would like to go and when. In this case, entities 'location' and 'time' should be retrieved from Luis prior to moving along the conversation.

Example

        IBotConversationTalkingPoint bookMeAFlightTalkingPoint = new BotConversationTalkingPoint()
        {
            Text = "Where would you like to go?",
            Transitions = new List<IBotConversationTalkingPoint>()
            {

            }
        };

        bookMeAFlightTalkingPoint.ActivateOn = new System.Func<EchoState, IBotConversationTalkingPoint, Microsoft.Bot.Builder.Luis.Models.LuisResult, (bool success, System.Action<object> callback)>((EchoState state, IBotConversationTalkingPoint contextTalkingPoint, Microsoft.Bot.Builder.Luis.Models.LuisResult luisResult) =>
        {
            var bookFlightIntent = luisResult.Intents.FirstOrDefault(intent => intent.Type.Equals("bookFlight", StringComparison.CurrentCultureIgnoreCase));


            return (success: bookFlightIntent != null, callback: null);
        });

        IBotConversationTalkingPoint defaultTalkingPoint = new BotConversationTalkingPoint()
        {
            Text = "What would you like to do?",
            Transitions = new List<IBotConversationTalkingPoint>()
            {
                bookMeAFlightTalkingPoint
            }
        };

In this example, there are two talking points.

Default Talking Point: Entry of Conversation.

bookMeAFlghtTalkingPoint: This talking point is transitioned to via ActivateOn whenever the intent returned by luis is 'bookFlight'. If this is true, the bot will ask the user where he/she would like to go.

Clone this wiki locally