Skip to content

A query for slot types to be run in cloudwatch

0

fields @timestamp, @message, sessionState.intent.name as Intent, inputTranscript as Customer_transcript, sessionId as Contact_ID, sessionState.sessionAttributes.action as action, sessionState.sessionAttributes.queue_lookup_id as queue_lookup_id, sessionState.sessionAttributes.dialed_number as dialed_number. | sort sessionId, @timestamp | filter bot.name like /Prod_Families_Information_Service/ | limit 10000

Looking to add in an extra piece of code to include slot types when we run cloudwatch reports. Services want a deeper insight than just intent level - any ideas? Thank you.

asked 2 years ago144 views

1 Answer
0

To include slot types in your CloudWatch query for Amazon Lex, you can modify your existing query to extract and display slot information. Here's an enhanced version of your query that includes slot types:

fields @timestamp, @message, sessionState.intent.name as Intent, inputTranscript as Customer_transcript, sessionId as Contact_ID, sessionState.sessionAttributes.action as action, sessionState.sessionAttributes.queue_lookup_id as queue_lookup_id, sessionState.sessionAttributes.dialed_number as dialed_number, sessionState.intent.slots.* as Slots | sort sessionId, @timestamp | filter bot.name like /Prod_Families_Information_Service/ | limit 10000

The key addition here is the line sessionState.intent.slots.* as Slots. This will extract all slot information for each intent, giving you a deeper insight beyond just the intent level.

To further refine this, you could specify particular slot types if you know them in advance. For example, if you have a slot type called "Genre", you could add:

sessionState.intent.slots.Genre.value as Genre_Value, sessionState.intent.slots.Genre.resolvedValues[0] as Resolved_Genre

This would give you both the raw value entered by the user and the resolved value that Amazon Lex determined.

Remember that slot types are custom to your bot, so you'll need to adjust the query based on the specific slot types you've defined in your Lex bot.

If you want to see all possible resolutions for a slot (up to five), you could use:

sessionState.intent.slots.Genre.resolvedValues[0:4] as Genre_Resolutions

This will give you an array of up to five resolved values for the Genre slot.

By including these slot-specific fields, you'll be able to gain deeper insights into how your bot is interpreting user inputs and resolving them to specific slot values, which can be very valuable for improving your bot's performance and understanding user interactions better.
Sources
Custom slot type - Amazon Lex
Use CloudWatch Metrics Insights to identify the most used APIs | AWS re:Post

answered 2 years ago

EXPERT

reviewed 2 years ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.