Chat-based assistants have grow to be a useful software for offering automated customer support and help. This put up builds on a earlier put up, Combine QnABot on AWS with ServiceNow, and explores how one can construct an clever assistant utilizing Amazon Lex, Amazon Bedrock Information Bases, and a customized ServiceNow integration to create an automatic incident administration help expertise.
Amazon Lex is powered by the identical deep studying applied sciences utilized in Alexa. With it, builders can shortly construct conversational interfaces that may perceive pure language, interact in sensible dialogues, and fulfill buyer requests. Amazon Lex will be configured to reply to buyer questions utilizing Amazon Bedrock basis fashions (FMs) to look and summarize FAQ responses. Amazon Bedrock Information Bases offers the potential of amassing knowledge sources right into a repository of data. Utilizing data bases, you may effortlessly create an utility that makes use of Retrieval Augmented Technology (RAG), a way the place the retrieval of data from knowledge sources enhances the technology of mannequin responses.
ServiceNow is a cloud-based platform for IT workflow administration and automation. With its strong capabilities for ticketing, data administration, human assets (HR) providers, and extra, ServiceNow is already powering many enterprise service desks.
By connecting an Amazon Lex chat assistant with Amazon Bedrock Information Bases and ServiceNow, corporations can present 24/7 automated help and self-service choices to prospects and workers. On this put up, we reveal how one can combine Amazon Lex with Amazon Bedrock Information Bases and ServiceNow.
Resolution overview
The next diagram illustrates the answer structure.
The workflow consists of the next steps:
- The ServiceNow data financial institution is exported into Amazon Easy Storage Service (Amazon S3), which shall be used as the information supply for Amazon Bedrock Information Bases. Information in Amazon S3 is encrypted by default. You possibly can additional improve safety by Utilizing server-side encryption with AWS KMS keys (SSE-KMS).
- Amazon AppFlow can be utilized to sync between ServiceNow and Amazon S3. Different options like AWS Glue will also be used to ingest knowledge from ServiceNow.
- Amazon Bedrock Information Bases is created with Amazon S3 as the information supply and Amazon Titan (or another mannequin of your alternative) because the embedding mannequin.
- When customers of the Amazon Lex chat assistant ask queries, Amazon Lex fetches solutions from Amazon Bedrock Information Bases.
- If the person requests a ServiceNow ticket to be created, it invokes the AWS Lambda
- The Lambda perform fetches secrets and techniques from AWS Secrets and techniques Supervisor and makes an HTTP name to create a ServiceNow ticket.
- Software Auto Scaling is enabled on AWS Lambda to routinely scale Lambda in response to person interactions.
- The answer will seek advice from accountable AI insurance policies and Guardrails for Amazon Bedrock will implement organizational accountable AI insurance policies.
- The answer is monitored utilizing Amazon CloudWatch, AWS CloudTrail, and Amazon GuardDuty.
Remember to observe least privilege entry insurance policies whereas giving entry to any system assets.
Conditions
The next conditions must be accomplished earlier than constructing the answer.
- On the Amazon Bedrock console, join entry to the Anthropic Claude mannequin of your alternative utilizing the directions at Handle entry to Amazon Bedrock basis fashions. For details about pricing for utilizing Amazon Bedrock, see Amazon Bedrock pricing.
- Join a ServiceNow account if you happen to shouldn’t have one. Save your username and password. You will have to retailer them in AWS Secrets and techniques Supervisor later on this walkthrough.
- Create a ServiceNow occasion following the directions in Combine QnABot on AWS ServiceNow.
- Create a person with permissions to create incidents in ServiceNow utilizing the directions at Create a person. Make a remark of those credentials to be used later on this walkthrough.
The directions offered on this walkthrough are for demonstration functions. Comply with ServiceNow documentation to create group situations and observe their finest practices.
Resolution overview
To combine Amazon Lex with Amazon Bedrock Information Bases and ServiceNow, observe the steps within the subsequent sections.
Deployment with AWS CloudFormation console
On this step, you first create the answer structure mentioned within the answer overview, apart from the Amazon Lex assistant, which you’ll create later within the walkthrough. Full the next steps:
- On the CloudFormation console, confirm that you’re within the right AWS Area and select Create stack to create the CloudFormation stack.
- Obtain the CloudFormation template and add it within the Specify template Select Subsequent.
- For Stack identify, enter a reputation resembling
ServiceNowBedrockStack
. - Within the Parameters part, for ServiceNow particulars, present the values of ServiceNow host and ServiceNow username created earlier.
- Preserve the opposite values as default. Below Capabilities on the final web page, choose I acknowledge that AWS CloudFormation would possibly create IAM assets. Select Submit to create the CloudFormation stack.
- After the profitable deployment of the entire stack, from the Outputs tab, make an observation of the output key worth
BedrockKnowledgeBaseId
as a result of you have to it later throughout creation of the Amazon Lex assistant.
Integration of Lambda with Software Auto Scaling is past the scope of this put up. For steerage, consult with the directions at AWS Lambda and Software Auto Scaling.
Retailer the secrets and techniques in AWS Secrets and techniques Supervisor
Comply with these steps to retailer your ServiceNow username and password in AWS Secrets and techniques Supervisor:
- On the CloudFormation console, on the Assets tab, enter the phrase “secrets and techniques” to filter search outcomes. Below Bodily ID, choose the console URL of the AWS Secrets and techniques Supervisor secret you created utilizing the CloudFormation stack.
- On the AWS Secrets and techniques Supervisor console, on the Overview tab, beneath Secret worth, select Retrieve secret worth.
- Choose Edit and enter the username and password of the ServiceNow occasion you created earlier. Guarantee that each the username and password are right.
Obtain data articles
You want entry to ServiceNow data articles. Comply with these steps:
- Create a data base if you happen to don’t have one. Periodically, it’s possible you’ll have to sync your data base to maintain it updated.
- Sync the information from ServiceNow to Amazon S3 utilizing Amazon AppFlow by following directions at ServiceNow. Alternatively, you should use AWS Glue to ingest knowledge from ServiceNow to Amazon S3 by following directions on the weblog put up, Extract ServiceNow knowledge utilizing AWS Glue Studio in an Amazon S3 knowledge lake and analyze utilizing Amazon Athena.
- Obtain a pattern article.
Sync Amazon Bedrock Information Bases:
This answer makes use of the absolutely managed Information Base for Amazon Bedrock to seamlessly energy a RAG workflow, eliminating the necessity for customized integrations and knowledge circulation administration. As the information supply for the data base, the answer makes use of Amazon S3. The next steps define importing ServiceNow articles to an S3 bucket created by a CloudFormation template.
- On the CloudFormation console, on the Assets tab, enter “S3” to filter search outcomes. Below Bodily ID, choose the URL for the S3 bucket created utilizing the CloudFormation stack.
- Add the beforehand downloaded data articles to this S3 bucket.
Subsequent you should sync the information supply.
- On the CloudFormation console, on the Outputs tab, enter “Information” to filter search outcomes. Below Worth, choose the console URL of the data bases that you simply created utilizing the CloudFormation stack. Open that URL in a brand new browser tab.
- Scroll all the way down to Information supply and choose the information supply. Select Sync.
You possibly can take a look at the data base by selecting the mannequin within the Check the data base part and asking the mannequin a query.
Accountable AI utilizing Guardrails for Amazon Bedrock
Conversational AI purposes require strong guardrails to safeguard delicate person knowledge, adhere to privateness laws, implement moral rules, and mitigate hallucinations, fostering accountable improvement and deployment. Guardrails for Amazon Bedrock will let you configure your organizational insurance policies towards the data bases. They assist maintain your generative AI purposes protected by evaluating each person inputs and mannequin responses
To arrange guardrails, observe these steps:
- Comply with the directions on the Amazon Bedrock Person Information to create a guardrail.
You possibly can cut back the hallucinations of the mannequin responses by enabling grounding verify and relevance verify and adjusting the brink
- Create a model of the guardrail.
- Choose the newly created guardrail and duplicate the guardrail ID. You’ll use this ID later within the intent creation.
Amazon Lex setup
On this part, you configure your Amazon Lex chat assistant with intents to name Amazon Bedrock. This walkthrough makes use of Amazon Lex V2.
- On the CloudFormation console, on the Outputs tab, copy the worth of
BedrockKnowledgeBaseId
. You will have this ID later on this part. - On the Outputs tab, beneath Outputs, enter “bot” to filter search outcomes. Select the console URL of the Amazon Lex assistant you created utilizing the CloudFormation stack. Open that URL in a brand new browser tab.
- On the Amazon Lex Intents web page, select Create one other intent. On the Add intent dropdown menu, select Use built-in intent.
- On the Use built-in intent display, beneath Constructed-in intent, select QnAIntent- Gen AI function.
- For Intent identify, enter
BedrockKb
and choose Add. - Within the QnA configuration part, beneath Choose mannequin, select Anthropic and Claude 3 Haiku or a mannequin of your alternative.
- Develop Extra Mannequin Settings and enter the Guardrail ID for the guardrails you created earlier. Below Guardrail Model, enter a quantity that corresponds to the variety of variations you could have created.
- Enter the Information base for Amazon Bedrock Id that you simply captured earlier within the CloudFormation outputs part. Select Save intent on the backside.
Now you can add extra QnAIntents pointing to totally different data bases.
- Return to the intents record by selecting Again to intents record within the navigation pane.
- Choose Construct to construct the assistant.
A inexperienced banner on the highest of the web page with the message Efficiently constructed language English (US) in bot: servicenow-lex-bot signifies the Amazon Lex assistant is now prepared.
Check the answer
To check the answer, observe these steps:
- Within the navigation pane, select Aliases. Below Aliases, choose
TestBotAlias
. - Below Languages, select English (US). Select Check.
- A brand new take a look at window will pop up within the backside of the display.
- Enter the query “What advantages does AnyCompany supply to its workers?” Then press Enter.
The chat assistant generates a response primarily based on the content material in data base.
- To check Amazon Lex to create a ServiceNow ticket for info not current within the data base, enter the query “Create a ticket for password reset” and press Enter.
The chat assistant generates a brand new ServiceNow ticket as a result of this info isn’t accessible within the data base.
To seek for the incident, log in to the ServiceNow endpoint that you simply configured earlier.
Monitoring
You should utilize CloudWatch logs to overview the efficiency of the assistant and to troubleshoot points with conversations. From the CloudFormation stack that you simply deployed, you could have already configured your Amazon Lex assistant CloudWatch log group with applicable permissions.
To view the dialog logs from the Amazon Lex assistant, observe these instructions.
On the CloudFormation console, on the Outputs tab, enter “Log” to filter search outcomes. Below Worth, select the console URL of the CloudWatch log group that you simply created utilizing the CloudFormation stack. Open that URL in a brand new browser tab.
To guard delicate knowledge, Amazon Lex obscures slot values in dialog logs. As safety finest observe, don’t retailer any slot values in request or session attributes. Amazon Lex V2 doesn’t obscure the slot worth in audio. You possibly can selectively seize solely textual content utilizing the directions at Selective dialog log seize.
Allow logging for Amazon Bedrock ingestion jobs
You possibly can monitor Amazon Bedrock ingestion jobs utilizing CloudWatch. To configure logging for an ingestion job, observe the directions at Knowlege bases logging.
AWS CloudTrail logs
AWS CloudTrail is an AWS service that tracks actions taken by a person, position, or an AWS service. CloudTrail is enabled in your AWS account once you create the account. When exercise happens in that exercise is recorded in a CloudTrail occasion together with different AWS service occasions in Occasion historical past. You possibly can view, search, and obtain latest occasions in your AWS account. For extra info, see Working with CloudTrail Occasion historical past.
As safety finest observe, you must monitor any entry to your atmosphere. You possibly can configure Amazon GuardDuty to determine any sudden and doubtlessly unauthorized exercise in your AWS atmosphere.
Cleanup
To keep away from incurring future expenses, delete the assets you created. To wash up the AWS atmosphere, use the next steps:
- Empty the contents of the S3 bucket you created as a part of the CloudFormation stack.
- Delete the CloudFormation stack you created.
Conclusion
As buyer expectations proceed to evolve, embracing progressive applied sciences like conversational AI and data administration methods turns into important for companies to remain forward of the curve. By implementing this built-in answer, corporations can improve operational effectivity and ship superior service to each their prospects and workers, whereas additionally adapting the accountable AI insurance policies of the group.
Keep updated with the newest developments in generative AI and begin constructing on AWS. In case you’re in search of help on how one can start, take a look at the Generative AI Innovation Heart.
Concerning the Authors
Marcelo Silva is an skilled tech skilled who excels in designing, creating, and implementing cutting-edge merchandise. Beginning off his profession at Cisco, Marcelo labored on numerous high-profile tasks together with deployments of the primary ever service routing system and the profitable rollout of ASR9000. His experience extends to cloud know-how, analytics, and product administration, having served as senior supervisor for a number of corporations resembling Cisco, Cape Networks, and AWS earlier than becoming a member of GenAI. At present working as a Conversational AI/GenAI Product Supervisor, Marcelo continues to excel in delivering progressive options throughout industries.
Sujatha Dantuluri is a seasoned Senior Options Architect on the US federal civilian staff at AWS, with over 20 years of expertise supporting industrial and federal authorities shoppers. Her experience lies in architecting mission-critical options and dealing intently with prospects to make sure their success. Sujatha is an completed public speaker, steadily sharing her insights and data at business occasions and conferences. She has contributed to IEEE requirements and is obsessed with empowering others via her partaking shows and thought-provoking concepts.
NagaBharathi Challa is a options architect on the US federal civilian staff at Amazon Internet Companies (AWS). She works intently with prospects to successfully use AWS providers for his or her mission use instances, offering architectural finest practices and steerage on a variety of providers. Exterior of labor, she enjoys spending time with household and spreading the ability of meditation.
Pranit Raje is a Cloud Architect on the AWS Skilled Companies India staff. He makes a speciality of DevOps, operational excellence, and automation utilizing DevSecOps practices and infrastructure as code. Exterior of labor, he enjoys happening lengthy drives along with his beloved household, spending time with them, and watching motion pictures.