

# Using assisted slot resolution to clarify slot values in Amazon Lex V2
Using assisted slot resolution for slot values

**Note**  
Before you can take advantage of the generative AI features, you must fulfill the following prerequisites  
For information about pricing for using Amazon Bedrock, see [Amazon Bedrock pricing](https://aws.amazon.com/bedrock/pricing/).
Turn on the generative AI capabilities for your bot locale. To do so, follow the steps at [Optimize Lex V2 bot creation and performance by using generative AI](generative-features.md). 

You can improve the accuracy of some built-in slots in your bot's conversation flow by using assisted slot resolution. Assisted slot resolution uses Amazon Bedrock large language models (LLMs) to improve recognition of some built-in slots, which results in an improved interpretation of customer responses during slot elicitation. For utterances that could not be resolved normally, Amazon Lex V2 will attempt to resolve them a second time using Amazon Bedrock.

Assisted slot resolution allows you to use the power of Amazon Bedrock foundation models to improve the accuracy of the following built-in slots:
+ `AMAZON.Alphanumeric` without regex support
+ `AMAZON.City`
+ `AMAZON.Country`
+ `AMAZON.Date`
+ `AMAZON.Number `
+ `AMAZON.PhoneNumber`
+ `AMAZON.Confirmation`

You can enable assisted slot resolution for any intent that uses the above listed built-in slots. Assisted slot resolution does not apply to custom slots or Amazon built-in slots not listed above.

You can gather data on the accuracy improvements after you enable assisted slot resolution in your Amazon Lex V2 bot by using conversation logs and metrics.
+ Conversation logs - Interpretations will have the `interpretationSource` as `Bedrock`, if Amazon Bedrock was used to resolve the slot.
+ CloudWatch metrics - Metrics will be published under the dimentions listed in CloudWatch metric. To learn more, see [Monitoring Amazon Lex with Amazon CloudWatch](https://docs.aws.amazon.com/lex/latest/dg/monitoring-aws-lex-cloudwatch.html).

To use the descriptive bot builder, ensure that your IAM role has the proper permissions by following the steps at [Permissions needed in Lex V2 for assisted slot resolution](assisted-slot-permissions.md).

**Topics**
+ [

# Examples of assisted slot resolution used in Lex V2
](assisted-slot-examples.md)
+ [

# Enable assisted slot resolution in the Generative AI configuration screen
](assisted-slot-genai.md)
+ [

# Enable assisted slot resolution in the slot settings in Lex V2
](assisted-slot-level.md)
+ [

# Permissions needed in Lex V2 for assisted slot resolution
](assisted-slot-permissions.md)

# Examples of assisted slot resolution used in Lex V2
Examples of assisted slot resolution

Below are some examples where assisted slot resolution is able to intelligently resolve user utterances into a value.

AMAZON.Number


| Vertical | slotType | slotName | slotPrompt | utterance | Resolved Value | 
| --- | --- | --- | --- | --- | --- | 
| Travel | AMAZON.Number | numberOfNightsStayed | How many nights did you stay for the trip? | A whole week, 7 nights. | 7 | 
| Banking | AMAZON.Number | numberOfPeopleOnTheAccount | How many people are on the account? | Me and my wife. | 2 | 
| Travel | AMAZON.Number | numberOfStops | How many stops? | Once in Japan. Once in LA. | 2 | 

AMAZON.AlphaNumeric


| Vertical | slotType | slotName | slotPrompt | utterance | Resolved Value | 
| --- | --- | --- | --- | --- | --- | 
| Car Rental | AMAZON.Alphanumeric | transactionId | What is your transaction id? | I believe it was alpha whiskey echo eight three four nine romeo juliet. | AWE8349RJ | 
| Travel | AMAZON.Alphanumeric | confirmationCode | What is the confirmation number for your reservation? | The confirmation number is BLT2UE. | BLT2UE | 

AMAZON.Date


| Vertical | slotType | slotName | slotPrompt | utterance | Resolved Value | currentDate | 
| --- | --- | --- | --- | --- | --- | --- | 
| Car Rental | AMAZON.Date | dueDate | When is the rental agreement due to expire? | The lease is up on the 1st of next month. | 2023-12-01 | 2023-11-09 | 
| Travel | AMAZON.Date | returnDate | When are you returning? | Later today around 7. | 2023-11-09 | 2023-11-09 | 

AMAZON.PhoneNumber


| Vertical | slotType | slotName | slotPrompt | utterance | Resolved Value | 
| --- | --- | --- | --- | --- | --- | 
| Insurance | AMAZON.PhoneNumber | policyHolder | What is the phone number of the policy holder? | The phone number for the policy holder is 123-456-7890. | 1234567890 | 
| Retail | AMAZON.PhoneNumber | phoneLookup | What is your phone number so I can find your account? | I think it's under 413-570-9617, let me double check. | 4135709617 | 

AMAZON.Country


| Vertical | slotType | slotName | slotPrompt | utterance | Resolved Value | 
| --- | --- | --- | --- | --- | --- | 
| Travel | AMAZON.Country | nativeCountry | What is your country of origin? | I am Indian. | India | 
| Banking | AMAZON.Country | countryItinerary | What countries will you be traveling to with your debit card? | I will be travelling to New Delhi. | India | 

AMAZON.City


| Vertical | Slot Type | Intent | Question | Response | Resolved Value | 
| --- | --- | --- | --- | --- | --- | 
| Insurance | AMAZON.City | policyHolderCity | What city does the policy holder reside in? | I live in Springfield. | Springfield | 
| Travel | AMAZON.City | destinationCity | Which city are you traveling to? | I'm traveling to Tokyo. | Tokyo | 

AMAZON.Confirmation


| Vertical | slotType | slotName | slotPrompt | utterance | Resolved Value | 
| --- | --- | --- | --- | --- | --- | 
| Insurance | AMAZON.Confirmation | policyExpired | Has the insurance policy expired? | Yes, unfortunately it has expired. | Yes | 
| Banking | AMAZON.Confirmation | hasInvestments | Do you have any investments? | I haven't invested in anything yet. | No | 

# Enable assisted slot resolution in the Generative AI configuration screen
Enable in generative AI configurations

You can enable assisted slot resolution for supported built-in slots by navigating to the Generative AI screen.

If the slot is an supported built-in slot, you will have the option to activate the assisted slot resolution at the slot level.

1. Sign in to the AWS Management Console and open the Amazon Lex V2 console at [https://console.aws.amazon.com/lexv2/home](https://console.aws.amazon.com/lexv2/home).

1. In the navigation pane under **Bots**, select the bot you want to use for assisted slot resolution.

1. Select the language **English (US**) for the bot you want to enable.

1. Go to the **Generative AI configuration** section on the screen.

1. Select **Go to Amazon Bedrock** to sign up and enable the feature, if the feature has not been enabled.
**Note**  
If you do not have access to Amazon Bedrock foundation models, you should see **Go to Amazon Bedrock**. Click on **Go to Amazon Bedrock** to go to the Amazon Bedrock page where you can sign up for access to foundation models. Assisted slot resolution currently supports Anthropic Claude. We suggest using Anthropic Claude for best results.

1. If you already have access to Amazon Bedrock Foundation models, you should see a **Configure** button. Click on this button to go the generative AI configuration page to activate generative AI features in Lex.  
![\[Image of configure button for generative AI.\]](http://docs.aws.amazon.com/lexv2/latest/dg/images/assist-slot/assist-slot-genai.png)

1. In the upper right corner of the box, move the slider to the right to choose the **Enabled** setting.

1. Choose the **Enable** button to activate assisted slot resolution for the selected slots.

1. You can disable assisted slot resolution by selecting the slots from the list and selecting the **Disable** button.

# Enable assisted slot resolution in the slot settings in Lex V2
Enable assisted slot resolution for your slot

You can enable assisted slot resolution for supported built-in slots by navigating to the slot level for each intent that has slots. The slots must be one of the supported built-in slots listed above to have the option of activating assisted slot resolution. If the slot does not have the option to activate assisted slot resolution, the option will be greyed out.

**Note**  
You must first activate the assisted slot resolution feature on the Generative AI panel in order to activate the feature for individual slots. 

1. Sign in to the AWS Management Console and open the Amazon Lex V2 console at https://console.aws.amazon.com/lexv2/home.

1. In the navigation pane under **Bots**, select the bot you want to use for the assisted slot resolution.

1. Under All languages, select **English (US**) to expand the list.

1. In the left side panel, choose **Intents** to view a list of intents in the bot you selected.

1. In the **Intents** screen, choose the intent that contains the slots you want to modify.

1. Select the intent name to view the slots for that intent.

1. Select the **Advanced Options** button in the **Slots** section.

1. Select the check box for **Enable assisted slot resolution** to enable the feature.  
![\[Image of enable button for assisted slot resolution.\]](http://docs.aws.amazon.com/lexv2/latest/dg/images/assist-slot/assist-slot-enable.png)

1. Choose the **Update Slot** button in the bottom right corner of the screen. This will activate assisted slot resolution for the slots you have chosen.

**You can enable assisted slot resolution for supported built-in slots by making API calls.**
+ Follow the steps at [Optimize Lex V2 bot creation and performance by using generative AI](generative-features.md) to enable assisted slot resolution for your bot locale.
+ Send an [UpdateSlot](https://docs.aws.amazon.com/lexv2/latest/APIReference/API_UpdateSlot.html) request, specifying the slot for which you want to enable assisted slot resolution. In the `slotResolutionSetting` field, set the `slotResolutionStrategy` value as `EnhancedFallback`. To create a new slot with assisted slot resolution enabled, send an [CreateSlot](https://docs.aws.amazon.com/lexv2/latest/APIReference/API_CreateSlot.html) request instead.

# Permissions needed in Lex V2 for assisted slot resolution
Permissions for assisted slot resolution
+ To access this feature on Amazon Lex V2 console, ensure your console role has `bedrock:ListFoundationModels` and `bedrock:ListInferenceProfiles` permissions.
+ The IAM role associated with the bot should have `bedrock:InvokeModel` permission. When you enable the feature with the Amazon Lex V2 console the policy will get automatically added to the bot role provided your bot is using a service-linked role generated by Amazon Lex V2.

------
#### [ JSON ]

****  

  ```
  {
      "Version":"2012-10-17",		 	 	 
      "Statement": [
          {
              "Effect": "Allow",
              "Action": [
                  "bedrock:InvokeModel"
              ],
              "Resource": [
                  "arn:aws:bedrock:us-east-1::foundation-model/modelId"
              ]
          }
      ]
  }
  ```

------