java - Enumerate Custom Slot Values from Speechlet -
is there way inspect or enumerate custom slot values set-up in interaction model? instance, have intent schema following intent:
{ "intent": "mysupercoolintent", "slots": [ { "name": "shapesnsuch", "type": "list_of_shapes" } ] }
furthermore, you've defined list_of_shapes custom slot have following values:
square triangle circle icosadecaheckaspeckahedron round husky
question: there method can call speechlet or requeststreamhandler give me enumeration of custom slot values??
i have looked through alexa skills kit's sdk javadocs located here
and i'm not finding anything.
i know can slot's value sent in intent:
string slotvalue = incomingintentrequest.getintent().getslot("list_of_shapes").getvalue();
i can enumerate all incoming slots (and values):
map<string, slot> slotmap = incomingintentrequest.getintent().getslots(); for(map.entry<string, slot> entry : slotmap.entryset()) { string key = entry.getkey(); slot slot = (slot)entry.getvalue(); string slotname = slot.getname(); string slotvalue = slot.getvalue(); //do nifty current slot info.... }
what like:
string myappid = "amzn1.echo-sdk-ams.app.<therestofmyid>"; list<string> posibleslotvalues = somemagicalexaapi.getallslotvalues(myappid, "list_of_shapes");
with information wouldn't have maintain 2 separate "lists" or "enumerations"; 1 within interaction model , 1 within request handler. seems should thing right?
no, api not allow this.
however, since interaction model intimately tied development, suggest check in model source code in source control system. if going that, might put source. depending on language, means can read during run-time.
using technique, can gain access interaction model @ run-time. instead of doing automatically through api, best practice.
you can see several examples of in action java in tsatsatzu's examples.