Is there a way to get more than one intent (and their related scores) as a result when using AWS LEX? - amazon-web-services

When calling the AWS LEX API (put-text) or even when we are testing the bot by using the AWS Console, we receive only one intent as the output that matches our input.
However, for the feature that we are building, we would like to see not only the intent that best fits our input, but also some other intents that could be related with a lower score.
Ideally, we would also want to get the score for each one of the intents.
We know that this is something that is possible with Azure LUIS, but we are trying to develop this by using AWS.
Is there any way to do this?
Thanks a lot

Related

Positive/Negative Feedback from Amazon Lex/CloudFormation

Please forgive the completely noob question.
Background: I am not a developer - at best a hobby programmer who has enough knowledge to be dangerous/useful to my superiors. The AWS/Cloud expert at my company just left, gave me a 30 minutes whirlwind tour of AWS and said I'm now the expert...
AWS Cloudformation allows me to provide (basically) a "user" utterance that signifies Positive/Negative Feedback from the user of the bot: WebAppConfNegativeFeedback WebAppConfPositiveFeedback.
How do I process those utterances to provide useful information to improve the bot's responses?
It's stateless, so I'm not sure how to grab the context of the question and feedback to notify our company that some question provided a bad answer (good answer not so important.)
Any help you can provide, at least to point to me how to interpret this information is more than welcome. I hate feeling like a fish out of water...
Hi there and sorry to hear about your predicament.
AWS Cloudformation is a tool set that allows a developer to script the creation of resources; Cloudformation itself is not processing your user's requests.
As you've alluded to, AWS Lex is the service that is used to interact with users.
Here's a link to the Getting Started guide which I hope will help you get a better understanding of just how Lex works so that the rest of this answer makes more sense.
Essentially Lex uses a combination of intents with slots to complete a task. An intent uses utterances as an entry point to understanding what action a user wants to take while slots are used to collect the detail surrounding that action.
As an example, we could have an utterance "set my alarm clock" that activates an intent called SetAlarm. We then need to ask the user for the time that they'd like the alarm to be set for. This value is store in a slot of type date.
We then harness the power of AWS Lambda functions to 'fulfill' the intent. In this case, we will use the given information to set the alarm at the user's specified time.
With regards to your scenario, I am making an assumption that you have two fields called WebAppConfNegativeFeedback and WebAppConfPositiveFeedback somewhere in your Cloudformation script. These contain positive and negative utterances respectively. Again, making an assumption then that these fields are used to either build a Lex bot or it could be that these values are used in a supporting Lambda function to categorise the utterance as either positive or negative.
If it is a case that you have a Lambda function, you should be able to use that function to fire all another process should it be determined that the user's interaction was negative. That process could be an email to a support team etc. The Lambda function would have the conversation state passed in as an argument. You could interrogate this argument to get the context of the conversation.
Please provide more insight if you can so that a more specific answer can be provided.

How do I use Amazon Lex to take speech input from a customer and pass that information to a correct path using amazon connect?

So I am trying to streamline a customer support service by removing the need to listen to a set of options, and instead let the customer explain their issue, or say what they need support for. The list of possible service offerings exceeds 400 separate options. And I need to use Lex, Connect, and Lambda to solve this. (I do not want the customer to input a number corresponding to an option or service. I want them to explain their issue and be routed to a correct agent that can help them with the specific issue)
I went from a 100% manual input option to a speech to text option using Amazon Lex. Connect would say the list of options and the customer could say the option they needed help with instead of hitting a number on the phone. I converted all 12 or so options to speech to text. I read through the documentation and its not very helpful with my specific issue. (I also am not an expert in AWS and only just started learning a few weeks ago)
I would like to streamline this further by using Lex, connect, and lambda. But if I could avoid any one of those services, I would like to.
For what you want to do, you will need all three because they each handle a different part of what you want to achieve.
Connect is the channel the user can call and use voice input that is converted to text and passed to your Lex bot. It also converts the Lex response into voice output back to the user.
The Lex bot handles intent recognition and slot value recognition and passes that information to your Lambda. (Very simple bots that only have single responses for each intent do not need Lambda.)
The Lambda function is where you can verify, parse, correct, and build the logic for the smart interaction you want to create. Any time you want to build a response based on the variations of user input more than just the recognition of intents, then you will need Lambda to do that.
Note that Lex is great for parsing user input in Lambda because Lex delivers the inputTranscript along with Lex's interpretation of the intent and slot values. However, Connect has to put the voice input through voice-to-text before delivering to Lex, so this can cause Lex to misinterpret a poorly converted voice input. So you will need to do a lot of testing of inputs and improve your validation code in Lambda to correct common mistakes.
(If you have a more specific problem/question, you should ask a new question and give the details of what you have tried, some code or examples and a clear question. You'll get better answers that way too.)

Capturing missed utterances

Does anybody know if it is at all possible to capture missed utterances? I don't see the missed ones being logged into CloudWatch. I know that you can view them in the Lex Console after 24 hours, but I'm trying to capture them with data attached to them.
As of right now the console only gives you what the missed utterances is, how many times it was said, and when the last time it was said. I want the rest of the "Data" attached to these missed utterances; for example what customer said it.
Does anybody know if this is possible with AWS or the SDK(.NET) currently with a lambda or something like that?
Missed slot inputs can be caught and logged in your Lambda.
I suggest using sessionAttributes to keep track of something like last_elicit and you can determine if that slot was not filled, then log the missed input from inputTranscript any way you want.
I often force the slot to be filled by what ever is in inputTranscript and then handle it myself, because I found that Lex sometimes ignores legitimate slot inputs.
Missed Intent inputs are handled by Lex and responded to automatically.
The only control you have in Lex with handling missed Intent inputs is to customize the responses. Go to your Lex Console, under the "Editor" Tab, look at the bottom left for "Error Handling",
Open that menu and you will see:
Lex prepares one of these "Clarification Prompts" and returns that without passing anything to your Lambda Function.
That is why you cannot log any information about missed intent utterances with a basic set up of Lex. So here's a more complicated set up using two Lambda Functions:
This "Pre-Lex Lambda" acts as a Proxy between your users and your Lex bot. This means you do not use Lex's built in Channel settings, and you have to build your own integrations between your Channels and the "Pre-Lex Lambda".
Then you also need to use either PostContent or PostText to pass your user's input to your Lex bot.
After setting this up you will finally be able to catch the Lex response for one of the Clarification Prompts, and then log your own details about the missed intent input.
Helpful References:
AWS SDK for .NET
SDK .NET API Docs for Lex
SDK .NET API Docs for Lambda
Example setting up a Lambda using SDK(.NET)

Google Tag Manager clickstream to Amazon

So the questions has more to do with what services should i be using to have the efficient performance.
Context and goal:
So what i trying to do exactly is use tag manager custom HTML so after each Universal Analytics tag (event or pageview) send to my own EC2 server a HTTP request with a similar payload to what is send to Google Analytics.
What i think, planned and researched so far:
At this moment i have two big options,
Use Kinesis AWS which seems like a great idea but the problem is that it only drops the information in one redshift table and i would like to have at least 4 o 5 so i can differentiate pageviews from events etc ... My solution to this would be to divide from the server side each request to a separated stream.
The other option is to use Spark + Kafka. (Here is a detail explanation)
I know at some point this means im making a parallel Google Analytics with everything that implies. I still need to decide what information (im refering to which parameters as for example the source and medium) i should send, how to format it correctly, and how to process it correctly.
Questions and debate points:
Which options is more efficient and easiest to set up?
Send this information directly from the server of the page/app or send it from the user side making it do requests as i explained before.
Does anyone did something like this in the past? Any personal recommendations?
You'd definitely benefit from Google Analytics custom task feature instead of custom HTML. More on this from Simo Ahava. Also, Google Big Query is quite a popular destination for streaming hit data since it allows many 'on the fly computations such as sessionalization and there are many ready-to-use cases for BQ.

Is there any way to have multiple intents code flow in the chatbot created using Amazon Lex?

I am trying to build a conversation chatbot which has branching conversations resulting in different intents being called based on the results. Something like
A
|\
| C
|/
D
So the intent A is the trigger for the bot and based on inputs taken in A it might go to C for further data or go to D. I was going through the documentation but couldn't find anything to implement this kind of interface. How can i implement this kind of chat interface in Lex.
Thanks for your time and help
This is possible by using lambda.
you have to write a middle ware service using aws lambda and then your lex service will call lambda service for the results and that result can be now trigger the next bot using lambda trigger service.
Might need lot of work around but it is possible.
For more information http://docs.aws.amazon.com/lex/latest/dg/using-lambda.html