genie-toolkit icon indicating copy to clipboard operation
genie-toolkit copied to clipboard

Prompt Question customization

Open vinith-reddy25 opened this issue 2 years ago • 11 comments

I created a device to order pizza

inputs in manifest.tt or thingpedia.tt are given in the following code: in req type: Enum(margherita_pizza,pepperoni_pizza,BBQ_chicken_pizza) #_[prompt="which pizza would you like to order?"], in req size: Enum(small,medium,large) #_[prompt="which pizza size would you like to order?"], in req toppings: Enum(onion,mushroom,corn) #_[prompt="which pizza topping would you like?"],

I want to customize prompt questions in 2 ways, like:

  1. If type="margherita_pizza", are already given by user, then I want to ask the "size" of pizza as "As, you order margherita_pizza, what size of pizza you prefer?" So, propmt question need to extract type value.

  2. If type="margherita_pizza", are already given by user, can I combine other input parameter prompt questions? for example: "which pizza size would you like to order? and which pizza topping would you like?"

vinith-reddy25 avatar Apr 25 '22 08:04 vinith-reddy25

Both two customization you proposed can not be supported easily in the current system - it will involve dialogue policy and synthesis template changing. Technically, you can do that, but they are not designed to be modified by a third party in the current system, meaning that it will require quite a lot of understanding of the codebase in general to make changes. We have realized this is a huge issue for a lot of people who want to design their dialogue flow. So we are working on a new version of genie that has a different flexible design to allow developers easily change how the conversation goes.

sileix avatar Apr 25 '22 17:04 sileix

Is there a concept of default values for required input parameters? If yes, then can we ask confirmation question before prompt question? For example: If we set default value of "type" parameter as "margherita_pizza", then before asking prompt question of "type" parameter, can we ask "Should I order margherita pizza as you always orders it?"

vinith-reddy25 avatar Apr 26 '22 09:04 vinith-reddy25

We don't have default values - it can be implemented as an optional input parameter, and in the JavaScript backend of the skill, you can supply a default value when the input param is absent. There isn't any customizable prompt based on the default value.

sileix avatar Apr 26 '22 17:04 sileix

  1. Can I create custom datatype in thingtalk? I tried to create a new datatype, but it is giving errors. Is their any simplier approach to do that?

  2. I'm getting "expected ArgMap,Array,Boolean,Currency,Date,Entity,Enum,IDENTIFIER,Location,Measure,Number,Object,RecurrentTimeSpecification,String,Time" error, How to use "object" datatype and "compound" datatype?

vinith-reddy25 avatar Apr 29 '22 02:04 vinith-reddy25

  1. For entity types, you can declare them with a unique identifier. For a totally new type that is not available in thingtalk, well, you need to add the syntax to thingtalk, add type checking and compiler code for it. Then you will need to update genie-toolkit templates to generate synthetic sentences for the new syntax. I don't think there is any way around it in any system when you are introducing some new types with new behaviors.
  2. Check: https://wiki.genie.stanford.edu/references/thingtalk-reference#compound for how to use compound type.

sileix avatar Apr 29 '22 17:04 sileix

Just realize that we do have support for default values: https://wiki.genie.stanford.edu/references/genie-annotation#default-value

sileix avatar May 10 '22 16:05 sileix

We saw that before, It is only for "opt"(optional) input parameters.

vinith-reddy25 avatar May 11 '22 04:05 vinith-reddy25

Getting an error:

ThingTalkSyntaxError: Parse error: unexpected token Historyprev in state 623, expected ArgMap,Array,Boolean,Currency,Date,Entity,Enum,IDENTIFIER,Location,Measure,Number,Object,RecurrentTimeSpecification,String,Time,{ at ShiftReduceParser._helper (/home/binodyadav/Documents/genie-sdk/genie-toolkit/node_modules/thingtalk/dist/utils/sr_parser_runtime.js:99:27)

How to resolve this error

vinith-reddy25 avatar May 26 '22 09:05 vinith-reddy25

it looks like you are using 'Historyprev' as a type. If you are trying to create a new entity type, it needs to be in the form Entity(<your-skill-name>:<your-entity-name>)

sileix avatar Jun 01 '22 17:06 sileix

We are trying to create a new data type.

vinith-reddy25 avatar Jun 03 '22 09:06 vinith-reddy25

We are trying to create a new data type.

As I mentioned previously if you want to add a completely new type to Genie, you need to first add it to thingtalk. In the thingtalk repository, you need to add the syntax and make sure it is tested. Then you can try to use it in genie.

sileix avatar Jun 03 '22 18:06 sileix