0
votes

Can somebody help me interpret what the heck this means from the bot framework documention:

You can also pass in LUIS entities to bind to the state. If the EntityRecommendation.Type is a path to a field in your C# class then the EntityRecommendation.Entity will be passed through the recognizer to bind to your field. Just like initial state, any step for filling in that field will be skipped.

When I call my dialog I pass in my LuisResult result Entities collection like so:

context.Call(new FormDialog<ItemSearch>( new ItemSearch(), ItemSearch.BuildForm, options: FormOptions.PromptInStart,entities:result.Entities), null);

Within those entities is at least one which maps in both name and type to a public property on my dialog however the state never gets filled. What am I missing?

TIA.

2

2 Answers

1
votes

You can find an example of this in the PizzaOrderDialog. if you look at FormDialog implementation, it is using the entity.type to map the passed in entity recommendation to a step in the form. Then the detected entities will be provided as an input to that step of the form.

Here is an example of how form can skip the kind step based on the detected entities by Luis model in pizza form:

        var entities = new List<EntityRecommendation>(result.Entities);
        if (!entities.Any((entity) => entity.Type == "Kind"))
        {
            // Infer kind
            foreach (var entity in result.Entities)
            {
                string kind = null;
                switch (entity.Type)
                {
                    case "Signature": kind = "Signature"; break;
                    case "GourmetDelite": kind = "Gourmet delite"; break;
                    case "Stuffed": kind = "stuffed"; break;
                    default:
                        if (entity.Type.StartsWith("BYO")) kind = "byo";
                        break;
                }
                if (kind != null)
                {
                    entities.Add(new EntityRecommendation(type: "Kind") { Entity = kind });
                    break;
                }
            }
        }

        var pizzaForm = new FormDialog<PizzaOrder>(new PizzaOrder(), this.MakePizzaForm, FormOptions.PromptInStart, entities);
0
votes

It also appears that there is an issue with passing Entities in. It seems to work if the property you are mapping to is a Enum (as per the PizzaBot sample). However if the public property is a string, it doesn't map. I'm not sure about other types.

See here https://github.com/Microsoft/BotBuilder/issues/151