This post is a continuation of Creating Natural Conversations with amazon Lex QnAIntent and the amazon Bedrock Knowledge Base. In summary, we explored new capabilities available through amazon Lex QnAIntent, powered by amazon Bedrock, that allow you to leverage natural language understanding and your own knowledge repositories to deliver real-time conversational experiences.
In many cases, amazon Bedrock can generate accurate answers that meet the needs of a wide variety of questions and scenarios, using its knowledge content. However, some enterprise customers have more rigid regulatory requirements or brand guidelines, requiring certain questions to be answered verbatim with pre-approved answers. For these use cases, amazon Lex QnAIntent provides exact matching capabilities with amazon Kendra and amazon OpenSearch Service knowledge bases.
In this post, we explain how to install and configure an OpenSearch Service cluster as a knowledge base for your amazon Lex QnAIntent. Plus, exact match works with amazon Kendra and you can create an index and add FAQs to it. As detailed in Part 1 of this series, you can then select amazon Kendra as your knowledge base in amazon Lex QnA Settings, provide your amazon Kendra Index ID, and select the exact match to allow your bot to return the exact answer. returned by amazon Kendra.
Solution Overview
In the following sections, we explain the steps to create an OpenSearch Service domain, create an OpenSearch index and populate it with documents, and test the amazon Lex bot with QnAIntent.
Previous requirements
Before you create an OpenSearch Service cluster, you must create an amazon Lex V2 bot. If you do not have an amazon Lex V2 bot available, complete the following steps:
- In the amazon Lex console, choose robots in the navigation panel.
- Choose create robot.
- Select Start with an example.
- For Example robot, choose Book Trip.
- Enter a name and description for your bot.
- Select Create a role with amazon Lex basic permissions for your AWS Identity and Access Management (IAM) permissions runtime role.
- Select No to find out if your bot's use is subject to the Children's Online Privacy Protection Act (COPPA).
- Choose Next.
- Keep all the default values in the Add languages to bot section.
- Choose Done to create your bot.
Create an OpenSearch service domain
Complete the following steps to create your OpenSearch service domain:
- In the OpenSearch service console, choose Panel low Managed clusters in the navigation panel.
- Choose Create domain.
<img class="alignnone size-full wp-image-76311" style="margin: 10px 0px 10px 0px;border: 1px solid #CCCCCC" src="https://technicalterrence.com/wp-content/uploads/2024/06/1719267176_994_Implement-exact-match-with-Amazon-Lex-QnAIntent.png" alt="amazon OpenSearch Control Panel” height=”790″/>
- For Domain nameEnter a name for your domain (for this post, we used
my-domain
). - For Domain creation methodselect easy to create.
<img class="alignnone size-full wp-image-76312" style="margin: 10px 0px 10px 0px;border: 1px solid #CCCCCC" src="https://technicalterrence.com/wp-content/uploads/2024/06/1719267176_181_Implement-exact-match-with-Amazon-Lex-QnAIntent.png" alt="Create amazon OpenSearch domain” height=”789″/>
- Low Engine optionsfor Version, choose the latest engine version. At the time of writing this article, the latest engine is OpenSearch_2.11.
- Low Gridfor this post, select Public access.
- In an enterprise environment, you typically start your OpenSearch Service cluster in a VPC.
- Low Gridselect Dual stack mode.
- Dual stack allows you to share domain resources between IPv4 and IPv6 address types and is the recommended option.
- Low Detailed access controlselect Create master user.
- Enter the username and password of your choice.
- Leave all other settings at their default values.
- Choose Create.
It will take several minutes to start the cluster. When your cluster is ready, you will see a green color Asset low status Domain processing status.
Create an OpenSearch service index
Complete the following steps to create an index:
- On the domain details page, copy the domain endpoint to Domain endpoint (IPv4) to use later.
- Choose the IPv4 URL link.
The IPv4 link will open the OpenSearch Dashboards login page.
- Enter the username and password you created earlier.
- On the OpenSearch Dashboards welcome page, choose explore on my own.
- You can dismiss or cancel any additional modals or popups.
- Choose the options menu, then choose Development tools in the navigation panel.
- About him Development tools page, enter the following code to create an index, then choose the run icon to submit the request:
PUT my-domain-index
{
"mappings": {
"properties": {
"question": {
"type": "text"
},
"answer": {
"type": "text"
}
}
}
}
If successful, you will see the following message:
{
"acknowledged": true,
"shards_acknowledged": true,
"index": "my-domain-index"
}
- Enter the following code to bulk index multiple documents that you can use later for testing:
POST _bulk
{ "index": { "_index": "my-domain-index", "_id" : "mdi00001" } }
{ "question" : "What are the check-in and check-out times?", "answer": "Check-in time is 3pm and check-out time is 11am at all FictitiousHotels locations. Early check-in and late check-out may be available upon request and availability. Please inquire at the front desk upon arrival." }
{ "index": { "_index": "my-domain-index", "_id" : "mdi00002" } }
{ "question" : "Do you offer airport shuttles?", "answer": "Airport shuttles are available at the following FictitiousHotels locations: - FictitiousHotels Dallas: Complimentary airport shuttle available to and from Dallas/Fort Worth International Airport. Shuttle runs every 30 minutes from 5am-11pm. - FictitiousHotels Chicago: Complimentary airport shuttle available to and from O'Hare International Airport and Chicago Midway Airport. Shuttle runs every hour from 5am-11pm. - FictitiousHotels San Francisco: Complimentary airport shuttle available to and from San Francisco International Airport. Shuttle runs every 30 minutes from 5am11pm. - FictitiousHotels New York: Complimentary shuttle available to and from LaGuardia Airport and JFK Airport. Shuttle runs every hour from 5am-11pm. Please contact the front desk at your FictitiousHotels location to schedule airport shuttle service at least 24 hours in advance. Shuttle services and hours may vary by location." }
{ "index": { "_index": "my-domain-index", "_id" : "mdi00003" } }
{ "question" : "Is parking available? What is the daily parking fee?", "answer": "Self-parking and valet parking are available at most FictitiousHotels locations. Daily self-parking rates range from $15-$30 per day based on location. Valet parking rates range from $25-$40 per day. Please contact your FictitiousHotels location directly for specific parking information and rates." }
{ "index": { "_index": "my-domain-index", "_id" : "mdi00004" } }
{ "question" : "4. What amenities are available at FictitiousHotels?", "answer": "Amenities available at most FictitiousHotels locations include: - Free wireless high-speed internet access - 24-hour fitness center - Outdoor pool and hot tub - 24-hour business center - On-site restaurant and bar - Room service - Laundry facilities - Concierge services - Meeting rooms and event space Specific amenities may vary by location. Contact your FictitiousHotels for details onamenities available during your stay." }
{ "index": { "_index": "my-domain-index", "_id" : "mdi00005" } }
{ "question" : "Is there an extra charge for children staying at FictitiousHotels?", "answer": "There is no extra charge for children 18 years and younger staying in the same room as their parents or guardians at FictitiousHotels locations in the United States and Canada. Rollaway beds are available for an additional $15 fee per night, subject to availability. Cribs are available free of charge on request. Please contact the front desk to request cribs or rollaway beds. Additional charges for extra occupants may apply at international FictitiousHotels locations." }
{ "index": { "_index": "my-domain-index", "_id" : "mdi00006" } }
{ "question" : "Does FictitiousHotels have a pool? What are the pool hours?", "answer": "Most FictitiousHotels locations have an outdoor pool and hot tub available for guest use. Pool hours vary by location but are generally open from 6am-10pm daily. Specific FictitiousHotels pool hours: - FictitiousHotels Miami: Pool open 24 hours - FictitiousHotels Las Vegas: Pool open 8am-8pm - FictitiousHotels Chicago: Indoor and outdoor pools, open 6am-10pm - FictitiousHotels New York: Rooftop pool, open 9am-7pm Please contact your FictitiousHotels front desk for specific pool hours during your stay. Hours may be subject to change due to weather conditions or seasonal schedules. Proper swimwear is required and no lifeguard is on duty at any time." }
{ "index": { "_index": "my-domain-index", "_id" : "mdi00007" } }
{ "question" : "Is the fitness center free for guests? What are the hours?", "answer": "Yes, access to the 24-hour fitness center is included for all FictitiousHotels guests at no extra charge. The fitness center offers a range of cardio and strength training equipment. Some locations also offer fitness classes, saunas, steam rooms, and other amenities for a fee. Please contact your FictitiousHotels for specific fitness center details. Access may be restricted to guests 18 years and older. Proper athletic attire and footwear is required." }
{ "index": { "_index": "my-domain-index", "_id" : "mdi00008" } }
{ "question" : "Does FictitiousHotels offer room service? What are the hours?", "answer": "24-hour room service is available at most FictitiousHotels locations. In-room dining menus offer a variety of breakfast, lunch, and dinner options. Hours may vary by on-site restaurants. A $5 delivery fee and 18% service charge applies to all room service orders. For quick service, please dial extension 707 from your guest room phone. Room service hours: - FictitiousHotels San Francisco: 24-hour room service - FictitiousHotels Chicago: Room service 7am-10pm - FictitiousHotels New Orleans: Room service 7am-11pm Please contact the front desk at your FictitiousHotels location for specific room service hours and menu options. Room service availability may be limited based on on-site restaurants." }
{ "index": { "_index": "my-domain-index", "_id" : "mdi00009" } }
{ "question" : "Does FictitiousHotels provide toiletries like shampoo, soap, etc?", "answer": "Yes, each FictitiousHotels room is stocked with complimentary toiletries and bath amenities including shampoo, conditioner, soap, lotion, and bath gel. Additional amenities like toothbrushes, razors, and shaving cream are available upon request at the front desk. If any items are missing from your room, please contact housekeeping." }
{ "index": { "_index": "my-domain-index", "_id" : "mdi00010" } }
{ "question" : "How can I get extra towels or have my room cleaned?", "answer": "Fresh towels and daily housekeeping service are provided free of charge. To request extra towels or pillows, additional amenities, or to schedule midstay service, please contact the front desk by dialing 0 on your in-room phone. Daily housekeeping includes trash removal, changing sheets and towels, vacuuming, dusting, and bathroom cleaning. Just let us know your preferred service times. A Do Not Disturb sign can be placed on your door to opt out for the day." }
{ "index": { "_index": "my-domain-index", "_id" : "mdi00011" } }
{ "question" : "Does FictitiousHotels provide hair dryers in the room?", "answer": "Yes, each guest room at FictitiousHotels locations includes a hair dryer. Hair dryers are typically located in the bathroom drawer or mounted to the bathroom wall. Please contact the front desk immediately if the hair dryer is missing or malfunctioning so we can replace it." }
{ "index": { "_index": "my-domain-index", "_id" : "mdi00012" } }
{ "question" : "What type of WiFi or internet access is available at FictitiousHotels?", "answer": "Free high-speed wireless internet access is available throughout all FictitiousHotels locations. To connect, simply choose the FictitiousHotels WiFi network on your device and open a web browser. For questions or issues with connectivity, please contact the front desk for assistance. Wired internet access is also available in FictitiousHotels business centers and meeting rooms. Printers, computers, and IT support may be available for business services and events. Please inquire with your FictitiousHotels for details on business services." }
{ "index": { "_index": "my-domain-index", "_id" : "mdi00013" } }
{ "question" : "Does FictitiousHotels have electric car charging stations?", "answer": "Select FictitiousHotels locations offer electric vehicle charging stations on-site, typically located in self-parking areas. Availability varies by location. Please contact your FictitiousHotels to check availability and charging rates. Most stations offer Level 2 charging. Charging station locations include: - FictitiousHotels Portland: 2 stations - FictitiousHotels Los Angeles: 4 stations - FictitiousHotels San Francisco: 6 stations Guests can request an on-site parking spot nearest the charging stations when booking parking accommodations. Charging rates may apply." }
{ "index": { "_index": "my-domain-index", "_id" : "mdi00014" } }
{ "question" : "What is the pet policy at FictitiousHotels? Are dogs allowed?", "answer": "Pets are welcome at participating FictitiousHotels locations for an additional fee of $50 per stay. Restrictions may apply based on size, breed, or other factors. Please contact your FictitiousHotels in advance to confirm pet policies. FictitiousHotels locations in Atlanta, Austin, Chicago, Denver, Las Vegas and Seattle allow dogs under 50 lbs. Certain dog breeds may be restricted. Cats may also be permitted. Non-refundable pet fees apply. Pet owners are responsible for cleaning up after pets on hotel grounds. Pets must be attended at all times and may not be a disturbance to other guests. Pets are restricted from restaurants, lounges, fitness areas, and pool decks at all FictitiousHotels locations." }
{ "index": { "_index": "my-domain-index", "_id" : "mdi00015" } }
{ "question" : "Does FictitiousHotels have laundry facilities for guest use?", "answer": "Yes, self-service laundry facilities with washers and dryers are available for guests to use at all FictitiousHotels locations. Laundry facilities are typically located on the 2nd floor adjacent to vending machines and ice machines. Detergent is available for purchase via vending machines. The cost is $2.50 to wash and $2.50 to dry per load. Quarters can be obtained at the front desk. For any assistance with laundry services, please dial 0 and speak with the front desk. Valet laundry and dry-cleaning services may be offered for an additional fee." }
{ "index": { "_index": "my-domain-index", "_id" : "mdi00016" } }
{ "question" : "Can I request extra pillows or blankets for my FictitiousHotels room?", "answer": "Absolutely. Our housekeeping team is happy to bring additional pillows, blankets, towels and other necessities to make your stay more comfortable. We offer hypoallergenic pillows and have extra blankets available upon request. Please contact the FictitiousHotels front desk to make a special request. Dial 0 on your in-room phone. Extra amenities are subject to availability. Extra bedding must be left in the guest room at checkout to avoid additional fees." }
{ "index": { "_index": "my-domain-index", "_id" : "mdi00017" } }
{ "question" : "Does FictitiousHotels provide cribs or rollaway beds?", "answer": "Yes, cribs and rollaway beds are available upon request at all FictitiousHotels locations. Please contact the front desk as far in advance as possible to make arrangements, as these are limited in quantity. Cribs are provided complimentary as a courtesy. Rollaway beds are subject to an additional fee of $15 per night." }
{ "index": { "_index": "my-domain-index", "_id" : "mdi00018" } }
{ "question" : "What type of accessible rooms or ADA rooms does FictitiousHotels offer?", "answer": "FictitiousHotels provides accessible guest rooms tailored for those with disabilities and mobility needs. Accessible rooms feature widened doorways, lowered beds and sinks, accessible showers or tubs with grab bars, and other ADA compliant features. Please request an accessible room at the time of booking to ensure availability." }
{ "index": { "_index": "my-domain-index", "_id" : "mdi00019" } }
{ "question" : "Does FictitiousHotels provide microwaves and mini-fridges?", "answer": "Microwave and mini-refrigerator combos are available in select room types upon request and subject to availability. When booking your reservation, please inquire about availability of fridges and microwaves at your preferred FictitiousHotels location. A limited number are available. An additional $15 daily fee applies for use." }
{ "index": { "_index": "my-domain-index", "_id" : "mdi00020" } }
{ "question" : "Can I rent a conference or meeting room at FictitiousHotels?", "answer": "Yes, FictitiousHotels offers conference and meeting rooms available for rent at competitive rates. Options range from board rooms seating 8 to ballrooms accommodating up to 300 guests. State-of-the-art AV equipment is available for rent. Contact the Events Department to check availability and request a quote." }
{ "index": { "_index": "my-domain-index", "_id" : "mdi00021" } }
{ "question" : "Is there an ATM or cash machine at FictitiousHotels?", "answer": "For your convenience, ATMs are located near the front desk and lobby at all FictitiousHotels locations. The ATMs provide 24/7 access to cash in amounts up to $500 per transaction and accept all major credit and debit cards. Foreign transaction fees may apply. Please see the front desk if you need any assistance locating or using the ATM during your stay." }
{ "index": { "_index": "my-domain-index", "_id" : "mdi00022" } }
{ "question" : "Does FictitiousHotels have a spa or offer spa services?", "answer": "Select FictitiousHotels locations offer luxurious on-site spas providing massages, facials, body treatments, manicures and pedicures. For availability and booking at your FictitiousHotels, please ask the front desk for details or visit the spa directly. Day passes may be available for non-hotel guests. Additional spa access fees apply." }
{ "index": { "_index": "my-domain-index", "_id" : "mdi00023" } }
{ "question" : "Can I get a late checkout from FictitiousHotels?", "answer": "Late checkout may be available at participating FictitiousHotels locations based on availability. The standard checkout time is by 11am. Please inquire about late checkout options at check-in or contact the front desk at least 24 hours prior to your departure date to make arrangements. Late checkouts are subject to a half-day room rate charge." }
{ "index": { "_index": "my-domain-index", "_id" : "mdi00024" } }
{ "question" : "Does FictitiousHotels offer room upgrades?", "answer": "Room upgrades may be purchased upon check-in based on availability. Upgrades to suites, executive floors, or rooms with preferred views are subject to additional charges. Rates vary by date, room type, and location. Please inquire about upgrade options and pricing at the front desk during check-in. Advance reservations are recommended to guarantee upgrades." }
{ "index": { "_index": "my-domain-index", "_id" : "mdi00025" } }
{ "question" : "Do the FictitiousHotels rooms have air conditioning and heating?", "answer": "Yes, every guest room at all FictitiousHotels locations is equipped with individual climate controls allowing air conditioning or heating as desired. To operate, simply adjust the thermostat in your room. If you have any issues regulating the temperature, please contact the front desk immediately and we will send an engineer." }
{ "index": { "_index": "my-domain-index", "_id" : "mdi00026" } }
{ "question" : "Does FictitiousHotels provide wake-up call service?", "answer": "Complimentary wake-up calls are available upon request. Please contact the front desk to schedule a customized wake-up call during your stay. In-room alarm clocks are also provided for your convenience. For international locations, please specify if you need a domestic or international phone call." }
{ "index": { "_index": "my-domain-index", "_id" : "mdi00027" } }
{ "question" : "Can I smoke at FictitiousHotels? What is the smoking policy?", "answer": "For the comfort of all guests, FictitiousHotels enforces a non-smoking policy in all guest rooms and indoor public spaces. Designated outdoor smoking areas are available on-site. A minimum $200 cleaning fee will be charged for smoking detected in rooms. Smoking is prohibited by law on all hotel shuttle buses. Thank you for not smoking inside FictitiousHotels." }
{ "index": { "_index": "my-domain-index", "_id" : "mdi00028" } }
{ "question" : "Does FictitiousHotels offer child care services?", "answer": "No, we apologize that child care services are not available at FictitiousHotels locations. As an alternative, our front desk can provide recommendations for qualified local babysitting agencies and nanny services to assist families during their stay. Please let us know if you need any recommendations. Additional fees will apply." }
{ "index": { "_index": "my-domain-index", "_id" : "mdi00029" } }
{ "question" : "What restaurants are located in FictitiousHotels?", "answer": "Onsite dining options vary by location. Many FictitiousHotelss feature 24-hour cafes, coffee shops, trendy bars, steakhouses, and international cuisine. Please check with your FictitiousHotels front desk for all restaurants available on-site during your stay and operating hours. Room service is also available." }
{ "index": { "_index": "my-domain-index", "_id" : "mdi00030" } }
{ "question" : "Does FictitiousHotels provide transportation or town car service?", "answer": "FictitiousHotels can arrange transportation, car service, and limousine transfers for an additional fee. Please contact the concierge desk at least 24 hours in advance to make arrangements. We have relationships with reputable local car services and drivers. Airport shuttles, taxis, and other transportation can also be requested through your FictitiousHotels front desk." }
{ "index": { "_index": "my-domain-index", "_id" : "mdi00031" } }
{ "question" : "FictitiousHotels New York City", "answer" : "Ideally situated in Midtown Manhattan on 52nd Street, FictitiousHotels New York City positions you in the heart of the city's top attractions. This modern 25- story glass tower overlooks the bright lights of Broadway and Times Square, just minutes from your guestroom door. Inside, enjoy contemporary styling melded with classic New York flair. 345 well-appointed rooms feature plush bedding, marble bathrooms, room service, and scenic city views. On-site amenities include a state-of-the-art fitness center, business center, cocktail lounge with nightly live music, and farm-to-table restaurant serving sustainably sourced American fare. Venture outside to nearby Rockefeller Center, Radio City Music Hall, Central Park, the Museum of Modern Art and Fifth Avenue’s world-renowned shopping. Catch a Broadway show on the same block or take a short stroll to Restaurant Row’s vast culinary offerings. Grand Central Station sits under 10 minutes away." }
{ "index": { "_index": "my-domain-index", "_id" : "mdi00032" } }
{ "question" : "FictitiousHotels Chicago", "answer" : "Conveniently situated just steps from North Michigan Avenue in downtown Chicago, FictitiousHotels Chicago envelopes you in Midwestern hospitality and luxury. This sleek 50-story high rise showcases gorgeous city vistas in each of the 453 elegantly appointed guest rooms and suites. Wake up refreshed in pillowtop beds, slip into plush robes and enjoy gourmet in-room coffee service. The heated indoor pool and expansive fitness center help you stay active and refreshed, while the lobby cocktail lounge serves up local craft beers and signature cocktails. Start your day with breakfast at the Café before venturing out to the city’s top cultural attractions like the Art Institute, Millennium Park, Navy Pier and Museum Campus. Shoppers can walk just next door to Chicago’s best retail at high-end department stores and independent boutiques. Business travelers appreciate our central location and 40,000 square feet of modern event space. Enjoy easy access to Chicago’s finest dining, entertainment and more." }
{ "index": { "_index": "my-domain-index", "_id" : "mdi00033" } }
{ "question" : "FictitiousHotels Orlando", "answer" : "FictitiousHotels Orlando welcomes you with sunshine and hospitality just 3 miles from The theme parks. The resort hotel’s sprawling campus features 3 outdoor pools, 6 restaurants and lounges, full-service spa, waterpark and 27-hole championship golf course. 1,500 guestrooms cater to families and couples alike with amenities like mini-fridges, marble bathrooms, themed kids’ suites with bunk beds and separate family suites. Onsite activities range from Camp FictitiousHotels kids’ programs to poolside movies under the stars. Complimentary theme park shuttles take you directly to the theme parks and more. Area attractions like theme parks and water parks are just a short drive away. Golf fans are minutes from various golf courses. With endless recreation under the warm Florida sun, FictitiousHotels Orlando keeps the entire family entertained and happy." }
{ "index": { "_index": "my-domain-index", "_id" : "mdi00034" } }
{ "question" : "FictitiousHotels San Francisco", "answer" : "Rising over the San Francisco Bay, FictitiousHotels San Francisco treats you to panoramic waterfront views. Perched on the Embarcadero in the lively Financial District, this sleek downtown hotel blends innovative technology with California charm across 32 floors. Contemporary rooms feature voice activated controls, intuitive lighting, rainfall showers with built-in Bluetooth speakers and floor-to-ceiling windows perfect for gazing at the Bay Bridge. Sample bites from top NorCal chefs at our signature farm- to-table restaurant or sip craft cocktails beside the outdoor heated pool. Stay connected at the lobby work bar or get moving in the 24/7 fitness center. Union Square shopping sits just up the street, while iconic landmarks like the Golden Gate Bridge, Alcatraz and Fisherman's Wharf are only minutes away. Venture to Chinatown and North Beach's Italian flavors or catch a cable car straight up to Ghirardelli Square. Immerse yourself in the best of the City by the Bay." }
{ "index": { "_index": "my-domain-index", "_id" : "mdi00035" } }
{ "question" : "FictitiousHotels Honolulu", "answer" : "A true island escape awaits at FictitiousHotels Honolulu, nestled on the pristine shores of Waikiki Beach. Swaying palms frame our family-friendly resort featuring three outdoor pools, cultural activities like lei making and ukulele lessons and the island's largest lagoon waterpark. You’ll feel the spirit of ‘ohana – family – in our welcoming staff and signature Hawaiian hospitality. 1,200 newly renovated rooms open to lanais overlooking swaying palms and the sparkling blue Pacific. Five dining options include Polynesian cuisine, island-inspired plates and indulgent character breakfasts. Complimentary beach chairs and towels invite you to sunbathe on soft white sand just steps out the lobby. Take our shuttle to Pearl Harbor, historic ‘Iolani Palace or the famous North Shore. From snorkeling at Hanauma Bay to whale watching in winter, FictitiousHotels Honolulu lets you experience O’ahu's gorgeous island paradise." }
{ "index": { "_index": "my-domain-index", "_id" : "mdi00036" } }
{ "question" : "FictitiousHotels London", "answer" : "Situated in fashionable South Kensington overlooking Cromwell Road, FictitiousHotels London places you in the heart of Victorian grandeur and modern city buzz. This 19th century row house turned design hotel blends contemporary style with classic British sophistication across 210 rooms. Original touches like working fireplaces and ornate crown molding offset sleek decor and high-tech in-room tablets controlling lights, TV and 24-hour room service. Fuel up on full English breakfast and locally roasted coffee at our indoor café or unwind with afternoon tea in the English Garden. Work out in the fitness studio before indulging in an evening massage. Our concierge arranges VIP access at nearby museums and priority bookings for West End theatre. Top shopping at Harrod's and the King's Road are a quick Tube ride away. Whether here for business or pleasure, FictitiousHotels London provides five-star luxury in an unmatched location." }
If successful, you will see another message similar to the screenshot below.
If you want to update, delete or add your own test documents, see the OpenSearch Document API.
Before you configure QnAIntent, make sure you have added access to the amazon Bedrock model you want to use.
Now that the test data is populated in the OpenSearch service domain, you can test it with the amazon Lex bot.
Test your amazon Lex robot
To test the bot, complete the following steps:
- In the amazon Lex console, navigate to the QnAIntent function of the bot that you created as a prerequisite.
- Choose the language, which for this post is English United States).
- Low Generative ai configurationschoose Set up.
- Low QnA Settingschoose Create a QnA intent.
- For Intent nameenter a name (for this post,
FicticiousHotelsFAQ
). - Choose Add.
- Choose the intent you just added.
- Low QnA Settingschoose OpenSearch as your knowledge store.
- For Domain endpointenter the endpoint you copied earlier.
- For Index nameenter a name (for example,
my-domain-index
). - For exact answerselect Yeah.
- For Question fieldget into
question
. - For Response fieldget into
answer
. - Choose Save intent.
Why did you use the easy to create option to start your OpenSearch service domain, granular access was enabled by default. You must locate the amazon Lex IAM role and add permissions to the OpenSearch Service domain to allow amazon Lex to interact with the OpenSearch Service.
- Navigate to the draft version of your bot in the navigation panel.
- Choose the link to IAM Permissions Runtime Role.
- Copy the role's ARN for later use.
- Return to the OpenSearch dashboards.
- If you closed your browser tab or exited this page, you can find it again by locating the IPv4 URL in the OpenSearch service console from a previous step.
- From the options menu, choose Security.
- Choose Roles in the navigation panel.
- Select the role
all_access
.
- Choose Mapped usersthen choose Manage mapping.
- For Backend rolesEnter the ARN of the IAM runtime role you copied earlier.
- Choose Map.
- In the amazon Lex console, return to your bot and the English United States) language.
- Choose Build to build your bot.
- Choose Proof to test your bot.
Make sure your bot has the following permissions to use QnAIntent. These permissions should be added automatically by default.
- When the amazon Lex test chat window opens, enter a question from your OpenSearch Service sample documents, such as “What are the check-in and check-out times?”
Clean
To avoid incurring ongoing costs, delete the resources you created as part of this release:
- amazon Lex V2 Robot
- OpenSearch service domain
Conclusion
amazon Lex QnAIntent provides the flexibility and option to use a variety of different knowledge bases to generate accurate answers to questions based on your own documents and authoritative knowledge sources. You can choose to allow amazon Bedrock to generate an answer to questions based on results from its knowledge base, or you can generate exact answers using the amazon Kendra or OpenSearch Service knowledge bases.
In this post, we demonstrate how to start and configure an OpenSearch Service domain, populate an OpenSearch Service index with sample documents, and configure the exact response option using the index with amazon Lex QnAIntent.
You can start leveraging amazon Lex QnAIntent today and transform your customer experience.
About the authors
jose rodgers is a Senior Solutions Architect for AWS working with enterprise clients in the travel and hospitality industry. Josh enjoys working with clients to solve complex problems with a focus on serverless technologies, DevOps, and security. Outside of work, Josh enjoys hiking, playing music, skydiving, painting, and spending time with family.
Thomas Rindfuss is a Senior Solutions Architect on the amazon Lex team. He invents, develops, prototypes and evangelizes new features and technical solutions for linguistic ai services that improve customer experience and facilitate adoption.