anjishnu / ask-alexa-pykit

A minimalist SDK for developing skills for the Amazon Echo's ASK - Alexa Skills Kit using Amazon Web Services's Python Lambda Functions. Currently supported profiles are for Linux servers and AWS Lambda. Check the appropriate release branch. The cherrypy release branches have added components for request validation.
MIT License
275 stars 58 forks source link

How to elicit slot #35

Open mickster04 opened 7 years ago

mickster04 commented 7 years ago

The create response method doesn't seem documented in terms of how to do things like elicitSlot/ElicityIntent etc. if the create response method should not be responsible for this, I can't find how else to create responses back to alexa.

I would have anticipated it to look something like

alexa.elicit_slot(slot='myMissingSlot', message='can you please provide the missing detail about "missingSlot"') the reason I do this is because the slot value may be present in the session (and so I shouldn't make it manditory), but not until it has been submitted the first time. Not sure how to do this with this library.

anjishnu commented 7 years ago

Hi Mick,

I haven't gotten around to figuring out how the new slot elicitation APIs work due to busyness at work and some visa expiration issues. (This project is a bit old now). Your API design looks good. Send a PR if you get the chance otherwise I will implement it once I have some free time.

mickster04 commented 7 years ago

Right, so basically your reponse object seems to be missing enough https://developer.amazon.com/public/solutions/alexa/alexa-skills-kit/docs/dialog-interface-reference

the bits below in Bold are what you have already, the directives are what is missing it seems. I actually have very little experience with python so I'm not sure I can help!

I think the updated intent will be provided in the request object. so we probably just need a way to access that slot in the request to check it and a way to request an elicit slot message, so the API should be almost identical to what you already have but we just need to be able to specific a dialog directive

{
  **"version": "1.0",**
  "sessionAttributes": {},
  **"response": {
    "outputSpeech": {
      "type": "PlainText",
      "text": "From where did you want to start your trip?"
    },
    "shouldEndSession": false**,
    "directives": [
      {
        "type": "Dialog.ElicitSlot",
        "slotToElicit": "fromCity",
        "updatedIntent": {
          "name": "PlanMyTrip",
          "confirmationStatus": "NONE",
          "slots": {
            "toCity": {
              "name": "toCity",
              "confirmationStatus": "NONE"
            },
            "travelDate": {
              "name": "travelDate",
              "confirmationStatus": "NONE",
              "value": "2017-04-21"
            },
            "fromCity": {
              "name": "fromCity",
              "confirmationStatus": "NONE"
            },
            "activity": {
              "name": "activity",
              "confirmationStatus": "NONE"
            },
            "travelMode": {
              "name": "travelMode",
              "confirmationStatus": "NONE"
            }
          }
        }
      }
    ]
  }
}
anjishnu commented 7 years ago

Sounds good. I'll take a look at it in a few days now that I have some time :) It's time to build a new skill and make sure everything is working smoothly.