Giter VIP home page Giter VIP logo

anjishnu / ask-alexa-pykit Goto Github PK

View Code? Open in Web Editor NEW
275.0 275.0 58.0 166 KB

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.

License: MIT License

Python 100.00%
alexa-pykit alexa-skills-kit aws-lambda python

ask-alexa-pykit's People

Contributors

anjishnu avatar hassanshamim avatar joegermuska avatar ysak-y avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

ask-alexa-pykit's Issues

Failure to import IntentSchema

Line 6 of ask/write_sample.py

Change from intent_schema import IntentSchema to from ask.intent_schema import IntentSchema.

Python 3.5, installed via pip

The included basic example

Step 3a for the basic example says "go to 3b", but I don't understand what 3b means in this context. I don't see an utterance text file.

Perhaps because of this, when I complete all the steps, I do not understand what should happen. There are no Intent Schema or Sample Utterances in the Interaction Model.

Install with --target fails

pip install --target Scratch/dev/alexa/simplesms/ ask-alexa-pykit
Collecting ask-alexa-pykit
Exception:
Traceback (most recent call last):
  File "/usr/lib/python2.7/dist-packages/pip/basecommand.py", line 209, in main
    status = self.run(options, args)
  File "/usr/lib/python2.7/dist-packages/pip/commands/install.py", line 328, in run
    wb.build(autobuilding=True)
  File "/usr/lib/python2.7/dist-packages/pip/wheel.py", line 748, in build
    self.requirement_set.prepare_files(self.finder)
  File "/usr/lib/python2.7/dist-packages/pip/req/req_set.py", line 360, in prepare_files
    ignore_dependencies=self.ignore_dependencies))
  File "/usr/lib/python2.7/dist-packages/pip/req/req_set.py", line 512, in _prepare_file
    finder, self.upgrade, require_hashes)
  File "/usr/lib/python2.7/dist-packages/pip/req/req_install.py", line 276, in populate_link
    self.link = self._wheel_cache.cached_wheel(self.link, self.name)
  File "/usr/lib/python2.7/dist-packages/pip/wheel.py", line 68, in cached_wheel
    self._cache_dir, link, self._format_control, package_name)
  File "/usr/lib/python2.7/dist-packages/pip/wheel.py", line 137, in cached_wheel
    wheel = Wheel(wheel_name)
  File "/usr/lib/python2.7/dist-packages/pip/wheel.py", line 637, in __init__
    self.pyversions = wheel_info.group('pyver').split('.')
AttributeError: 'NoneType' object has no attribute 'split'

Instead passing install-purelib via install-option works:

pip install --install-option="--install-purelib=Scratch/dev/alexa/simplesms" ask-alexa-pykit

Cannot store new session attributes.

The end of the alexa_io.route_request reads as follows:

response = handler_fn(request)
response['sessionAttributes'] = request.session
return response

The request variable is the incoming request from Alexa which will always have None attributes unless we explicitly store some. This means that the code above removes any attributes we assign before returning the response.

I think the correct behaviour would be to simply remove the line that reassigns the attributes? This would allow the user to specify any sessionAttributes in their responses. To allow for this we modified the create_response method as so:

@classmethod
def create_response(self, message=None, end_session=False, card_obj=None,
                    reprompt_message=None, is_ssml=None, session_attributes=None):
   # ... Removed some stuff
   if session_attributes:
      response['sessionAttributes'] = session_attributes
   return response

Of course - it is likely I'm misunderstanding the intended usage! I'm happy to file a PR if you do want the above changes.

README.md - Step 3 - No module named ask.generate_training_data

version: 0.54
installed via: pip

$ python -m ask.generate_training_data -i intent_schema.json  -o .
/home/jlh/projects/alexa/bin/python: No module named ask.generate_training_data

The module generate_training_data only appears in the .5 branch and does not exist in the current version on pypi or the master branch.

Revive server version or Unify with Lambda

After focusing on Lambda for a while to get the core library down - I think we are at the point that we can start looking at having a simple push-button server implementation as well.

The main issue with the server implementation is the SSL hell I had to go through when I wrote my first alexa skill: visible in gory detail here: https://github.com/anjishnu/ask-alexa-pykit/blob/cherrypy_0.3_release/lib/validation_utils.py

This also introduced a PyCrypto dependency (and literally shelling out to OpenSSL) to the library which was a big mess. We should be able to replicate this without relying on too many external libraries, and hopefully python's ssl module is up to the task.

I didn't want to spend too much time on it because it ended up in a dead end where it was impossible to publish anything because of the trusted SSL cert authority requirement - with this that might also be possible for free https://console.aws.amazon.com/acm/home?region=us-east-1#/firstrun/

Needs better documentation

The README.md is ok general documentation if you already have experience with the package. However, it would be great if there was a walk-through where you re-create alexa-skills-kit-color-expert example but using ask-alexa-pykit.

Since color-expert / what's my fav color is the "hello world" of Alexa and is well documented on aws, it would be an outstanding example to use to show how it would be accomplished using ask-alexa-pykit. It was my goal to recreate it using your toolkit for the reason I outlined above.

Hey lets work togeather

Hello,

I just recently found out about this kit, but i've been writing my own alexa integration for django - it seems like there are a few core features that we could share between this package and mine. Would you be willing to work togeather on creating a library that both your project and my project use to handle those overlaps?

I've been working to isolate them in my codebase, have a look at everything under
https://github.com/rocktavious/django-alexa/tree/develop/django_alexa/internal

It's amazing how we've basically come up with very similar tech to cover the boiler plate.

I think it would be cool if we could come up with a good shared base and make that a package that our two libraries could leverage, because i'd also like to extend support to other web frameworks like Flask IE Flask-Alexa etc

It would be great to have such a wide package array all using the same core lib:

  • core lib (maybe "py-alexa")
    • Lambda Alexa
    • Django Alexa
    • Flask Alexa

Let me know what you think.

VoiceHandler error when deploying to Lambda

When I attempt to deploy my very simple Alexa skill to Lambda and test it, I get the following error in the logs:

module initialization error: 'VoiceHandler' object has no attribute 'default'

What information can I provide to help troubleshoot?

Dialogue Support

It's relatively hard to structure dialogue in Alexa Skills Kit. This library can supply some primitives to make life easier.

Error with generate_intent_schema.py

~/ask-alexa-pykit/scripts$ python3 generate_intent_schema.py File "generate_intent_schema.py", line 25 6 : ["AMAZON.US_CITY", ^ SyntaxError: invalid syntax

Issues deploying the sample app Basic on AWS

module initialization error: 'VoiceHandler' object has no attribute 'default'

I'm getting the above error message when attempting to deploy the same sample AWS skill as a lambda.

Unit test suite

Come up with a suite of unit tests to ensure no degradation in functionality.

Support dialog 'context'

Overview

For example, we want to implement another function when YesIntent is passed. Because Yes is used some situation like Do you want to call to this hotel? or Do you want to book this hotel?. What can we recognize it?

To use context attribute, we can recognize what means 'Yes'.

So I want to add context option like alexa.create_response(text).with_context(context). and something logic for routing intent properly.

What do you think?

How to elicit slot

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.

git checkout

whenever you checkout you have no write_sample.py in ask

Request Object should validate applicationId

Hey,

According to the Amazon guidelines for developing an Alexa skill, there should be some validation of Alexa requests within Lambda function codes.

https://developer.amazon.com/public/solutions/alexa/alexa-skills-kit/docs/handling-requests-sent-by-alexa

The Request object seems like a good place to do that, since it's already doing some wrapping of Request JSONs anyways. I'm not sure how to go about raising an HTTP 400 Error without using some more robust framework, but I think this should at least raise an Assertion Error if the applicationIds don't line up

https://github.com/peterpanning/AlexaTransit/commit/2d7fdbcca77cd45514990be4fe478e417064cce6

Thoughts?

Better Custom Slot Support

ask-alexa-pykit doesn't do anything to support custom slots - can we do something to make working with custom slots easier?

Usage of Alexa WITHOUT AWS / Lambda?

Is it possible to make use of the Alexa API on a local machine? Ie. I want to host my own script that will make calls to the API, get responses, and do other things accordingly.

Does the ask-alexa-pykit support that in any manner?

Some errors on Readme.md and script

Hi,
I’ve found some problems on your Readme.md, point 2:

_$ python -m ask.intent_schema -i FILEPATH _ <--- Wrong Script!

is instead:

$ python -m ask.generate_intent_schema -i intents

On step6 you should add to "select [Virgina] on the top right", the other amazon's state doesn't have alexa skill available.

On the generate_intent_schema, if you select "0 Exit program" option, it fails brutally :)

  1. Exit program
    0
    Schema created:
    Traceback (most recent call last):
    File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/runpy.py", line 162, in _run_module_as_main
    "main", fname, loader, pkg_name)
    File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/runpy.py", line 72, in _run_code
    exec code in run_globals
    File "/Users/dega1999/Programming/Alexa/ask-alexa-pykit/alexa/ask/generate_intent_schema.py", line 91, in
    print (json.dumps(output, indent=2))
    NameError: name 'output' is not defined

BTW, I have succesfully loaded a new alexa skill, very fast, thanks to your work!
Thanks you!

Handling session attributes

I'm still pretty new to Alexa development, but I find the session management kind of weird. It seems as though you have to make a point to send back session attributes every time, which is counter to web programming models where you can trust the framework to manage that.

If you and other people using this code are interested, I'd like to talk about a good approach to handling it, and I'm happy to implement it and/or test it since session management seems likely to be part of what I need.

It would be easy enough to expose what comes in as request['session']['attributes'] as something like request.session and just use it as a dictionary. But then in the current model, you'd need to remember to pass it to create_response -- some design which protected against forgetting to make that explicit seems worth looking for.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.