GithubHelp home page GithubHelp logo

kaylerch / alexa-skills-kit-tellask-java Goto Github PK

View Code? Open in Web Editor NEW
15.0 15.0 7.0 588 KB

This SDK is an extension to the Alexa Skills SDK for Java. It provides a framework for handling speechlet requests with multi-variant utterances organized in YAML files.

Home Page: https://kaylerch.github.io/alexa-skills-kit-tellask-java/

License: Apache License 2.0

Java 100.00%

alexa-skills-kit-tellask-java's People

Contributors

kaylerch avatar philippst avatar ryanhollander avatar

Stargazers

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

Watchers

 avatar  avatar  avatar  avatar  avatar

alexa-skills-kit-tellask-java's Issues

AlexaIntentHandlerFactoryImpl is not found

I tried to gave alexa-skills-kit-tellask a try, but when testing my skill, I get:

The remote endpoint could not be called, or the response it returned was invalid.

When I open my log, it says:

java.lang.ClassNotFoundException: io.klerch.alexa.tellask.util.factory.AlexaIntentHandlerFactoryImpl

Indeed, there is no such class but your AlexaIntentHandlerFactory tries to create one.

I directly followed your example.

What am I missing?

Class not found: index.handler

I took the default sample and created a jar from it via Maven, uploaded it to lambda under java 8 and as soon i hit the LaunchIntent I get this error

{
  "errorMessage": "Class not found: index.handler",
  "errorType": "java.lang.ClassNotFoundException"
}

The conventional way was that I used to create a command line java project, install lambda sdk and something like this

public class ClassName implements RequestHandler<Map<String, Object>, Object> {

@Override
    public Object handleRequest(Map<String, Object> input, Context context) {
        String data = input.toString();
        return  doAction(input.toString());
    }

Please do guide me if I am doing something wrong here

Access on Alexa SystemState object

Hi Kay,

thanks for this great library. Really love the annotation based approach. ๐Ÿ‘

Just one small question, feature request or wish: Is there any way to access the SystemState object (from AlexaInput) within AlexaIntentHandler? I think that SystemState object would be the only way to get alexa DeviceId and ApiEndpoint, which are needed in order to implement the new alexa address features.

Amzn sample implementation: https://github.com/amzn/alexa-skills-kit-java/blob/master/samples/src/main/java/address/DeviceAddressSpeechlet.java#L138

Thanks & Regards,
Philipp

Sample coding

Hi Kay,

Sorry to post this here though this is not an issue.

I' am an Alexa developer(Java) and I code the way that is given in the amazon sample code library.

I've seen your code, but sorry to say that I didn't understand this quite well.(Problem from my end, not your end). As this is divided into multiple files and you are using an YAML instead of the regular utterances and intents in the UI, also the divided files are confusing me a lot on terms like where does the flow start from and on how it goes on.

Can you please make one of the sample codes in the way that you created this, so that I can match the sample code(the default provided by alexa) to this and understand on how to be a better coder in terms of following the semantics and make it more readable and user friendly.

I request you to do it using the sessions example(the colors)

Thanks & Regards,
Rakesh

Even the simplest hello-world example gives me "Could not find a handler for speechlet request"

So I tried to dig into this library as it seems to make coding for Alexa using Java (and Scala) easier. I set up a build.sbt like this:

name := "hello-world"
version := "0.0.1-SNAPSHOT"
scalaVersion := "2.12.2"

libraryDependencies += "com.amazon.alexa" % "alexa-skills-kit" % "1.3.1"
libraryDependencies += "io.klerch" % "alexa-skills-kit-tellask-java" % "0.2.2"

I now created an utterances.yml in resources/de-DE like this:

SayWelcome:
  Utterances:
    - "Hallo. Das ist ein Test."

SayTest:
  Utterances:
    - "Das ist ein Test."

SaySorry:
  Utterances:
    - "Irgendwas ist schief gelaufen."

I created the speechlet handler:

@AlexaApplication(applicationIds = Array("amzn1.ask.skill.xxxxx"))
class HelloWorldSpeechletHandler extends AlexaRequestStreamHandler {
}

I created the error handler:

@AlexaLaunchListener
class HelloWorldLaunchHandler extends AlexaLaunchHandler {

  def handleError(exception: AlexaRequestHandlerException): AlexaOutput = AlexaOutput.tell("SaySorry").build()
  def handleRequest(input: AlexaInput): AlexaOutput = AlexaOutput.tell("SayWelcome").build()
}

And my test error handler (this time in Java to make sure Scala is not the cause for the problem):

@AlexaIntentListener(customIntents = "ThisIsATest")
public class ListThingsHandler implements AlexaIntentHandler {

    @Override
    public boolean verify(final AlexaInput input) {
        return false;
    }

    @Override
    public AlexaOutput handleRequest(final AlexaInput input) throws AlexaRequestHandlerException, AlexaStateException {
        return AlexaOutput.tell("SayTest").build();
    }

    @Override
    public AlexaOutput handleError(final AlexaRequestHandlerException exception) {
        return AlexaOutput.tell("SaySorry").build();
    }
}

In the interaction model builder (the new interactive one) I created a "ThisIsATest" intent and compiled the interaction model.

When I want to test my skill, I get this error in my log:

com.amazon.speech.speechlet.SpeechletException: Could not find a handler for speechlet request: java.io.IOException
java.io.IOException: com.amazon.speech.speechlet.SpeechletException: Could not find a handler for speechlet request
at io.klerch.alexa.tellask.model.wrapper.AlexaRequestStreamHandler.handleRequest(AlexaRequestStreamHandler.java:92)
Caused by: com.amazon.speech.speechlet.SpeechletException: Could not find a handler for speechlet request
at io.klerch.alexa.tellask.model.wrapper.AlexaSpeechlet.handleRequest(AlexaSpeechlet.java:105)
at io.klerch.alexa.tellask.model.wrapper.AlexaSpeechlet.onIntent(AlexaSpeechlet.java:90)
at com.amazon.speech.speechlet.SpeechletToSpeechletV2Adapter.onIntent(SpeechletToSpeechletV2Adapter.java:51)
at com.amazon.speech.speechlet.SpeechletRequestDispatcher.dispatchSpeechletCall(SpeechletRequestDispatcher.java:218)
at com.amazon.speech.speechlet.SpeechletRequestHandler.internalHandleSpeechletCall(SpeechletRequestHandler.java:152)
at com.amazon.speech.speechlet.SpeechletRequestHandler.handleSpeechletCall(SpeechletRequestHandler.java:91)
at io.klerch.alexa.tellask.model.wrapper.AlexaRequestStreamHandler.handleRequest(AlexaRequestStreamHandler.java:88)

I packed my Jar with the SBT assembly plugin which embeds all dependencies similar to the maven-shade-plugin.

What am I missing?

AlexaOutput throws exception if regex special characters are present in a slot text

Hi, If I try to build AlexaOutput with a $ symbol in the string, for example: AlexaOutput.ask("UtteranceKey").putSlot("slot1","$5.00"); the handler fails to error state with the exception: "io.klerch.alexa.tellask.util.AlexaRequestHandlerException: General error occured." A little debugging digs up the real issue: "java.lang.indexoutofboundsexception no group 3" which happens in the while loop starting on line 109 of AlexaSpeechletResponse.class in the method resolveSlotsInUtterance. This happens because the regex engine thinks "$5" is a token, it should be escaped before processing.

A workaround is to use "Matcher.quoteReplacement" in the input for the slot, for example:
AlexaOutput.ask("UtteranceKey").putSlot("slot1",Matcher.quoteReplacement("$5.00"));

While the workaround is sufficient for my purposes, it would be great if the library took care of this detail for me and I didn't have to worry about it. Thanks!

Alexa Version Update to 1.3.1

Hi @KayLerch first a big thank you for this amazing sdk , this is a very well written piece and my concern is how often can I expect an update of the version in sync with the amazon skill set sdk . The current version 1.3.1 but the tell ask sdk has 1.3.0 on it . Any info on this , kindly advise

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.