Drive efficiencies with CI/CD best practices on Amazon Lex

海外精选
海外精选的内容汇集了全球优质的亚马逊云科技相关技术内容。同时,内容中提到的“AWS” 是 “Amazon Web Services” 的缩写,在此网站不作为商标展示。
0
0
{"value":"Let’s say you have identified a use case in your organization that you would like to handle via a chatbot. You familiarized yourself with [Amazon Lex](https://aws.amazon.com/cn/lex/), built a prototype, and did a few trial interactions with the bot. You liked the overall experience and now want to deploy the bot in your production environment, but aren’t sure about best practices for [Amazon Lex](https://aws.amazon.com/cn/lex/?trk=cndc-detail). In this post, we review the best practices for developing and deploying [Amazon Lex](https://aws.amazon.com/cn/lex/?trk=cndc-detail) bots, enabling you to streamline the end-to-end bot lifecycle and optimize your operations.\n\nWe have covered the planning, design, and configuration phases in previous [blog posts](https://aws.amazon.com/cn/blogs/machine-learning/part-1-approach-conversation-design-the-basics/). We suggest reviewing these posts to help you build engaging conversations with your bot before you proceed. After you’ve initially configured the bot, you should test it internally and iterate on the bot definition. You’re now ready to deploy it in your production environment (such as a call center), where the bot will process live conversations. Once in production, you should monitor it continuously to make sure it’s meeting your desired business goals. This cycle repeats as you add new use cases and enhancements.\n\nLet’s review the best practices for development, testing, deployment, and monitoring bots.\n\n#### **Development**\n\nConsider the following best practices when developing your bot:\n\n- **Manage bot schema via code** – The [Amazon Lex](https://aws.amazon.com/cn/lex/?trk=cndc-detail) console provides an easy-to-use interface as you design and configure the bot, but relies on manual actions to replicate the setup. We recommend converting the bot schema into code after finishing the design to simplify this step. You can use [APIs](https://docs.aws.amazon.com/lexv2/latest/dg/API_Operations_Amazon_Lex_Model_Building_V2.html) or [AWS CloudFormation](https://aws.amazon.com/cn/cloudformation/) (see [Creating Amazon Lex V2 resources with AWS CloudFormation](Creating Amazon Lex V2 resources with AWS CloudFormation)) to manage the bot programmatically.\n- **Checkpoint bot schema with bot versioning** – Checkpointing is a common approach often used to revert an application to a last-known stable state. [Amazon Lex](https://aws.amazon.com/cn/lex/?trk=cndc-detail) offers this functionality via [bot versioning](https://docs.aws.amazon.com/lexv2/latest/dg/versions.html). We recommend using a new version at each milestone in your development process. This allows you to make incremental changes to your bot definition, with an easy way to revert them in case they don’t work as expected.\n- **Identify data handling requirements and configure appropriate controls** – [Amazon Lex](https://aws.amazon.com/cn/lex/?trk=cndc-detail) follows the AWS [shared responsibility model](https://aws.amazon.com/cn/compliance/shared-responsibility-model/), which includes guidelines for data protection to comply with industry regulations and with your company’s own data privacy standards. Additionally, [Amazon Lex](https://aws.amazon.com/cn/lex/?trk=cndc-detail) adheres to [compliance programs](https://aws.amazon.com/cn/compliance/services-in-scope/) such as SOC, PCI, and FedRAMP. [Amazon Lex](https://aws.amazon.com/cn/lex/?trk=cndc-detail) provides the ability to obfuscate slots that are considered sensitive. You should identify your data privacy requirements and configure the appropriate controls in your bot.\n\n#### **Testing**\n\nAfter you have a bot definition, you should test the bot to ensure that it works as intended and is configured correctly. For example, it should have permissions to trigger other services, such as [AWS Lambda](https://aws.amazon.com/cn/lambda/) functions. In addition, you should also test the bot to confirm it’s able to interpret different types of user requests. \nConsider the following best practices for testing:\n\n- **Identify test data** – You should gather relevant test data to test bot performance. The test data should include a comprehensive representation of expected user conversations with the bot, especially for IVR use cases where the bot will need to understand voice inputs. The test data should cover different speaking styles and accents. Such test data can provide experience validation for your target customer base.\n- **Identify user experience metrics** – Defining the conversational experience can be hard. You have to anticipate and plan for all the different ways users might engage with the bot. How do you guide the caller without sounding too prescriptive? How do you recover if the caller provides incorrect or incomplete information? To manage the dialog through many different scenarios, you should set a clear goal that covers different speaking styles, acoustic conditions, and modality, and identify objective metrics that you can track. For example, an objective indicator would be “90% of conversations should have less than two re-prompts played to the user,” versus a subjective indicator such as “the majority of conversations should not ask users to repeat their input.”\n- **Evaluate user experience along the way** – In some cases, seemingly small changes can have a big impact on the user experience. For example, consider a situation where you inadvertently introduce a typo in the regular expression used for an account ID slot type, which leads to bot re-prompting the user to provide input again. You should evaluate the user experience, and invest in an automated testing to generate key metrics. You can refer to [Evaluating an automatic speech recognition service](https://aws.amazon.com/cn/blogs/machine-learning/evaluating-an-automatic-speech-recognition-service/) and [Testing accuracy and regression with Amazon Connect and Amazon Lex ](https://aws.amazon.com/cn/blogs/contact-center/testing-accuracy-and-regression-with-amazon-connect-and-amazon-lex/)for examples of how to test and generate key metrics.\n\n#### **Deployment**\n\nOnce you’re satisfied with the bot’s performance, you’ll want to deploy the bot to start serving your production traffic. As you iterate the bot over the course of its lifecycle, you repeat the deployments, making it a continuous process, so it’s critical to have a streamlined, automated deployment to reduce the chance of errors. Consider the following best practices for deployment:\n\n- **Use a multi-account environment** – You should follow the AWS recommended [multi-account environment setup](https://aws.amazon.com/cn/organizations/getting-started/best-practices/) in your organization and use separate AWS accounts for your development stage and production stage. If you have a multi-Region presence, then you should also use a separate AWS account per Region for production. Using separate AWS accounts per stage offers you security, access, and billing boundaries for your AWS resources.\n- **Automate promoting a bot from development through to production** – When replicating the bot setup in your development stage to your production stage, you should use automated solutions and minimize manual touch points. You should use CloudFormation templates to create your bots. Alternatively, you can use [Amazon Lex export and import APIs](https://docs.aws.amazon.com/lexv2/latest/dg/importing-exporting.html) to provide an automated means to copy a bot schema across accounts.\n- **Roll out changes in a phased manner** – You should deploy changes to your production environment in a phased manner, so that changes are released to a subset of your production traffic before being released to all users. Such an approach gives you the chance to limit the blast radius in case there are any issues with the change. One way you can achieve this is by having a two-phased deployment approach: you create two aliases for a bot (for example, prod-05 and prod-95). You first associate the new bot version with one alias (prod-05 in this example). After you validate the key metrics meet the success criteria, you associate the second alias (prod-95) with the new bot version.\n\nNote that you need to control the distribution of traffic on the client application used to integrate with [Amazon Lex](https://aws.amazon.com/cn/lex/?trk=cndc-detail) bots. For example, if you’re using [Amazon Connect](https://aws.amazon.com/cn/connect/) to integrate with your bots, you can use a [Distribute by percentage](https://docs.aws.amazon.com/connect/latest/adminguide/distribute-by-percentage.html) contact block in conjunction with two or more [Get customer input](https://docs.aws.amazon.com/connect/latest/adminguide/get-customer-input.html) blocks.\n\nIt’s important to note that [Amazon Lex](https://aws.amazon.com/cn/lex/?trk=cndc-detail) provides a test alias out of the box. The test alias is meant to be used for ad hoc manual testing via the [Amazon Lex](https://aws.amazon.com/cn/lex/?trk=cndc-detail) console only, and is not meant to handle production-scale loads. We recommend using a dedicated alias for your production traffic.\n\n#### **Monitoring**\n\nMonitoring is important for maintaining reliability, availability, and an effective end-user experience. You should analyze your bot’s metrics and use the learnings as a feedback mechanism to improve the bot schema as well your development, testing, and deployment practices. [Amazon Lex](https://aws.amazon.com/cn/lex/?trk=cndc-detail) supports multiple mechanisms to [monitor bots](https://docs.aws.amazon.com/lexv2/latest/dg/monitoring-overview.html). Consider the following best practices for monitoring your Lex bots:\n\n- **Monitor constantly and iterate**– [Amazon Lex](https://aws.amazon.com/cn/lex/?trk=cndc-detail) integrates with [Amazon CloudWatch](https://aws.amazon.com/cn/cloudwatch/?trk=cndc-detail) to provide near-real-time metrics that can provide you with key insights into your users’ interactions with the bot. These insights can help you gain perspective on the end-user experience. To learn more about the different types of metrics that [Amazon Lex](https://aws.amazon.com/cn/lex/?trk=cndc-detail) emits, see [Monitoring Amazon Lex V2 with Amazon CloudWatch](https://docs.aws.amazon.com/lexv2/latest/dg/monitoring-cloudwatch.html). We recommend setting up thresholds to trigger alarms. Similarly, [Amazon Lex](https://aws.amazon.com/cn/lex/?trk=cndc-detail) gives you visibility into the raw input utterances from your users’ interactions with the bot. You should use [utterance statistics](https://docs.aws.amazon.com/lexv2/latest/dg/monitoring-utterances.html) or [conversation](https://docs.aws.amazon.com/lexv2/latest/dg/monitoring-logs.html) logs to gain insights to identify communication patterns and make appropriate changes to your bot as necessary. To learn how to create a personalized analytics dashboard for your bots, refer to [Monitor operational metrics for your Amazon Lex chatbot](https://aws.amazon.com/cn/blogs/machine-learning/monitor-operational-metrics-for-your-amazon-lex-chatbot/).\n\nThe best practices discussed in this post focus primarily on [Amazon Lex](https://aws.amazon.com/cn/lex/?trk=cndc-detail)-specific use cases. In addition to these, you should review and adhere to best practices when managing your cloud infrastructure in AWS. Make sure that your cloud infrastructure is secure and only accessible by authorized users. You should also review and adopt the appropriate [AWS security best practices](AWS security best practices) within your organization. Lastly, you should proactively review the [AWS quotas](https://docs.aws.amazon.com/general/latest/gr/aws_service_limits.html) for individual AWS services (including [Amazon Lex](https://aws.amazon.com/cn/lex/?trk=cndc-detail) quotas) and request appropriate changes if necessary.\n\n#### **Conclusion**\n\nYou can use [Amazon Lex](https://aws.amazon.com/cn/lex/?trk=cndc-detail) to enable sophisticated natural language conversations and drive customer service efficiencies. In this post, we reviewed the best practices for the development, testing, deployment, and monitoring phases of a bot lifecycle. With these guidelines, you can improve the end-user experience and achieve better customer engagement. Start building your [Amazon Lex](https://aws.amazon.com/cn/lex/?trk=cndc-detail) conversational experience today!\n\t_____________________________________\n\n\n#### **About the Author**\n\n![image.png](https://dev-media.amazoncloud.cn/ffd5eeaa0b714d64a74f9d0b3c926810_image.png)\n**Swapandeep Singh** is an engineer with the [Amazon Lex](https://aws.amazon.com/cn/lex/?trk=cndc-detail) team. He works on making interactions with bots smoother and more human-like. Outside of work, he likes to travel and learn about different cultures.","render":"<p>Let’s say you have identified a use case in your organization that you would like to handle via a chatbot. You familiarized yourself with <a href=\\"https://aws.amazon.com/cn/lex/\\" target=\\"_blank\\">Amazon Lex</a>, built a prototype, and did a few trial interactions with the bot. You liked the overall experience and now want to deploy the bot in your production environment, but aren’t sure about best practices for [Amazon Lex](https://aws.amazon.com/cn/lex/?trk=cndc-detail). In this post, we review the best practices for developing and deploying [Amazon Lex](https://aws.amazon.com/cn/lex/?trk=cndc-detail) bots, enabling you to streamline the end-to-end bot lifecycle and optimize your operations.</p>\\n<p>We have covered the planning, design, and configuration phases in previous <a href=\\"https://aws.amazon.com/cn/blogs/machine-learning/part-1-approach-conversation-design-the-basics/\\" target=\\"_blank\\">blog posts</a>. We suggest reviewing these posts to help you build engaging conversations with your bot before you proceed. After you’ve initially configured the bot, you should test it internally and iterate on the bot definition. You’re now ready to deploy it in your production environment (such as a call center), where the bot will process live conversations. Once in production, you should monitor it continuously to make sure it’s meeting your desired business goals. This cycle repeats as you add new use cases and enhancements.</p>\\n<p>Let’s review the best practices for development, testing, deployment, and monitoring bots.</p>\n<h4><a id=\\"Development_6\\"></a><strong>Development</strong></h4>\\n<p>Consider the following best practices when developing your bot:</p>\n<ul>\\n<li><strong>Manage bot schema via code</strong> – The [Amazon Lex](https://aws.amazon.com/cn/lex/?trk=cndc-detail) console provides an easy-to-use interface as you design and configure the bot, but relies on manual actions to replicate the setup. We recommend converting the bot schema into code after finishing the design to simplify this step. You can use <a href=\\"https://docs.aws.amazon.com/lexv2/latest/dg/API_Operations_Amazon_Lex_Model_Building_V2.html\\" target=\\"_blank\\">APIs</a> or <a href=\\"https://aws.amazon.com/cn/cloudformation/\\" target=\\"_blank\\">AWS CloudFormation</a> (see [Creating Amazon Lex V2 resources with AWS CloudFormation](Creating Amazon Lex V2 resources with AWS CloudFormation)) to manage the bot programmatically.</li>\\n<li><strong>Checkpoint bot schema with bot versioning</strong> – Checkpointing is a common approach often used to revert an application to a last-known stable state. [Amazon Lex](https://aws.amazon.com/cn/lex/?trk=cndc-detail) offers this functionality via <a href=\\"https://docs.aws.amazon.com/lexv2/latest/dg/versions.html\\" target=\\"_blank\\">bot versioning</a>. We recommend using a new version at each milestone in your development process. This allows you to make incremental changes to your bot definition, with an easy way to revert them in case they don’t work as expected.</li>\\n<li><strong>Identify data handling requirements and configure appropriate controls</strong> – [Amazon Lex](https://aws.amazon.com/cn/lex/?trk=cndc-detail) follows the AWS <a href=\\"https://aws.amazon.com/cn/compliance/shared-responsibility-model/\\" target=\\"_blank\\">shared responsibility model</a>, which includes guidelines for data protection to comply with industry regulations and with your company’s own data privacy standards. Additionally, [Amazon Lex](https://aws.amazon.com/cn/lex/?trk=cndc-detail) adheres to <a href=\\"https://aws.amazon.com/cn/compliance/services-in-scope/\\" target=\\"_blank\\">compliance programs</a> such as SOC, PCI, and FedRAMP. [Amazon Lex](https://aws.amazon.com/cn/lex/?trk=cndc-detail) provides the ability to obfuscate slots that are considered sensitive. You should identify your data privacy requirements and configure the appropriate controls in your bot.</li>\\n</ul>\n<h4><a id=\\"Testing_14\\"></a><strong>Testing</strong></h4>\\n<p>After you have a bot definition, you should test the bot to ensure that it works as intended and is configured correctly. For example, it should have permissions to trigger other services, such as <a href=\\"https://aws.amazon.com/cn/lambda/\\" target=\\"_blank\\">AWS Lambda</a> functions. In addition, you should also test the bot to confirm it’s able to interpret different types of user requests.<br />\\nConsider the following best practices for testing:</p>\n<ul>\\n<li><strong>Identify test data</strong> – You should gather relevant test data to test bot performance. The test data should include a comprehensive representation of expected user conversations with the bot, especially for IVR use cases where the bot will need to understand voice inputs. The test data should cover different speaking styles and accents. Such test data can provide experience validation for your target customer base.</li>\\n<li><strong>Identify user experience metrics</strong> – Defining the conversational experience can be hard. You have to anticipate and plan for all the different ways users might engage with the bot. How do you guide the caller without sounding too prescriptive? How do you recover if the caller provides incorrect or incomplete information? To manage the dialog through many different scenarios, you should set a clear goal that covers different speaking styles, acoustic conditions, and modality, and identify objective metrics that you can track. For example, an objective indicator would be “90% of conversations should have less than two re-prompts played to the user,” versus a subjective indicator such as “the majority of conversations should not ask users to repeat their input.”</li>\\n<li><strong>Evaluate user experience along the way</strong> – In some cases, seemingly small changes can have a big impact on the user experience. For example, consider a situation where you inadvertently introduce a typo in the regular expression used for an account ID slot type, which leads to bot re-prompting the user to provide input again. You should evaluate the user experience, and invest in an automated testing to generate key metrics. You can refer to <a href=\\"https://aws.amazon.com/cn/blogs/machine-learning/evaluating-an-automatic-speech-recognition-service/\\" target=\\"_blank\\">Evaluating an automatic speech recognition service</a> and <a href=\\"https://aws.amazon.com/cn/blogs/contact-center/testing-accuracy-and-regression-with-amazon-connect-and-amazon-lex/\\" target=\\"_blank\\">Testing accuracy and regression with Amazon Connect and Amazon Lex </a>for examples of how to test and generate key metrics.</li>\\n</ul>\n<h4><a id=\\"Deployment_23\\"></a><strong>Deployment</strong></h4>\\n<p>Once you’re satisfied with the bot’s performance, you’ll want to deploy the bot to start serving your production traffic. As you iterate the bot over the course of its lifecycle, you repeat the deployments, making it a continuous process, so it’s critical to have a streamlined, automated deployment to reduce the chance of errors. Consider the following best practices for deployment:</p>\n<ul>\\n<li><strong>Use a multi-account environment</strong> – You should follow the AWS recommended <a href=\\"https://aws.amazon.com/cn/organizations/getting-started/best-practices/\\" target=\\"_blank\\">multi-account environment setup</a> in your organization and use separate AWS accounts for your development stage and production stage. If you have a multi-Region presence, then you should also use a separate AWS account per Region for production. Using separate AWS accounts per stage offers you security, access, and billing boundaries for your AWS resources.</li>\\n<li><strong>Automate promoting a bot from development through to production</strong> – When replicating the bot setup in your development stage to your production stage, you should use automated solutions and minimize manual touch points. You should use CloudFormation templates to create your bots. Alternatively, you can use <a href=\\"https://docs.aws.amazon.com/lexv2/latest/dg/importing-exporting.html\\" target=\\"_blank\\">Amazon Lex export and import APIs</a> to provide an automated means to copy a bot schema across accounts.</li>\\n<li><strong>Roll out changes in a phased manner</strong> – You should deploy changes to your production environment in a phased manner, so that changes are released to a subset of your production traffic before being released to all users. Such an approach gives you the chance to limit the blast radius in case there are any issues with the change. One way you can achieve this is by having a two-phased deployment approach: you create two aliases for a bot (for example, prod-05 and prod-95). You first associate the new bot version with one alias (prod-05 in this example). After you validate the key metrics meet the success criteria, you associate the second alias (prod-95) with the new bot version.</li>\\n</ul>\n<p>Note that you need to control the distribution of traffic on the client application used to integrate with Amazon Lex bots. For example, if you’re using <a href=\\"https://aws.amazon.com/cn/connect/\\" target=\\"_blank\\">Amazon Connect</a> to integrate with your bots, you can use a <a href=\\"https://docs.aws.amazon.com/connect/latest/adminguide/distribute-by-percentage.html\\" target=\\"_blank\\">Distribute by percentage</a> contact block in conjunction with two or more <a href=\\"https://docs.aws.amazon.com/connect/latest/adminguide/get-customer-input.html\\" target=\\"_blank\\">Get customer input</a> blocks.</p>\\n<p>It’s important to note that Amazon Lex provides a test alias out of the box. The test alias is meant to be used for ad hoc manual testing via the Amazon Lex console only, and is not meant to handle production-scale loads. We recommend using a dedicated alias for your production traffic.</p>\n<h4><a id=\\"Monitoring_35\\"></a><strong>Monitoring</strong></h4>\\n<p>Monitoring is important for maintaining reliability, availability, and an effective end-user experience. You should analyze your bot’s metrics and use the learnings as a feedback mechanism to improve the bot schema as well your development, testing, and deployment practices. Amazon Lex supports multiple mechanisms to <a href=\\"https://docs.aws.amazon.com/lexv2/latest/dg/monitoring-overview.html\\" target=\\"_blank\\">monitor bots</a>. Consider the following best practices for monitoring your Lex bots:</p>\\n<ul>\\n<li><strong>Monitor constantly and iterate</strong>– [Amazon Lex](https://aws.amazon.com/cn/lex/?trk=cndc-detail) integrates with [Amazon CloudWatch](https://aws.amazon.com/cn/cloudwatch/?trk=cndc-detail) to provide near-real-time metrics that can provide you with key insights into your users’ interactions with the bot. These insights can help you gain perspective on the end-user experience. To learn more about the different types of metrics that [Amazon Lex](https://aws.amazon.com/cn/lex/?trk=cndc-detail) emits, see <a href=\\"https://docs.aws.amazon.com/lexv2/latest/dg/monitoring-cloudwatch.html\\" target=\\"_blank\\">Monitoring Amazon Lex V2 with Amazon CloudWatch</a>. We recommend setting up thresholds to trigger alarms. Similarly, [Amazon Lex](https://aws.amazon.com/cn/lex/?trk=cndc-detail) gives you visibility into the raw input utterances from your users’ interactions with the bot. You should use <a href=\\"https://docs.aws.amazon.com/lexv2/latest/dg/monitoring-utterances.html\\" target=\\"_blank\\">utterance statistics</a> or <a href=\\"https://docs.aws.amazon.com/lexv2/latest/dg/monitoring-logs.html\\" target=\\"_blank\\">conversation</a> logs to gain insights to identify communication patterns and make appropriate changes to your bot as necessary. To learn how to create a personalized analytics dashboard for your bots, refer to <a href=\\"https://aws.amazon.com/cn/blogs/machine-learning/monitor-operational-metrics-for-your-amazon-lex-chatbot/\\" target=\\"_blank\\">Monitor operational metrics for your Amazon Lex chatbot</a>.</li>\\n</ul>\n<p>The best practices discussed in this post focus primarily on Amazon Lex-specific use cases. In addition to these, you should review and adhere to best practices when managing your cloud infrastructure in AWS. Make sure that your cloud infrastructure is secure and only accessible by authorized users. You should also review and adopt the appropriate [AWS security best practices](AWS security best practices) within your organization. Lastly, you should proactively review the <a href=\\"https://docs.aws.amazon.com/general/latest/gr/aws_service_limits.html\\" target=\\"_blank\\">AWS quotas</a> for individual AWS services (including [Amazon Lex](https://aws.amazon.com/cn/lex/?trk=cndc-detail) quotas) and request appropriate changes if necessary.</p>\\n<h4><a id=\\"Conclusion_43\\"></a><strong>Conclusion</strong></h4>\\n<p>You can use Amazon Lex to enable sophisticated natural language conversations and drive customer service efficiencies. In this post, we reviewed the best practices for the development, testing, deployment, and monitoring phases of a bot lifecycle. With these guidelines, you can improve the end-user experience and achieve better customer engagement. Start building your Amazon Lex conversational experience today!<br />\\n_____________________________________</p>\n<h4><a id=\\"About_the_Author_49\\"></a><strong>About the Author</strong></h4>\\n<p><img src=\\"https://dev-media.amazoncloud.cn/ffd5eeaa0b714d64a74f9d0b3c926810_image.png\\" alt=\\"image.png\\" /><br />\\n<strong>Swapandeep Singh</strong> is an engineer with the [Amazon Lex](https://aws.amazon.com/cn/lex/?trk=cndc-detail) team. He works on making interactions with bots smoother and more human-like. Outside of work, he likes to travel and learn about different cultures.</p>\n"}
目录
亚马逊云科技解决方案 基于行业客户应用场景及技术领域的解决方案
联系亚马逊云科技专家
亚马逊云科技解决方案
基于行业客户应用场景及技术领域的解决方案
联系专家
0
目录
关闭