The Zurich release has arrived! Interested in new features and functionalities? Click here for more

Eliza
ServiceNow Employee
ServiceNow Employee

Eliza_0-1727889845739.png

Overview

Now Assist Skill Kit (NASK) allows you to create new generative AI skills using the generic Now LLM or your own LLM.  NASK has been designed to easily manage and integrate new skills into the ServiceNow platform via a UI Action and soon into the Now Assist Panel. With NASK you define the input data, leverage tools to process the data, activate the new skill, and deploy it to the platform (see below).

Eliza_1-1727889893258.png

 

For our use case, we will use NASK to ask the LLM to generate a new knowledge article using branding and compliance policies outlined within our instance.
Eliza_0-1727893897263.png


We covered this use case in our AI Academy:

 

 

To build this use case, you will need:

  1. Your own instance on at least the Xanadu release. You need to have the following plugins:
    • Knowledge Management Advanced [com.snc.knowedge_advanced.installer]
    • Now Assist for IT Service Management [sn_itsm_gen_ai]
    • GRC: Policy and Compliance [sn_compliance]
  2. At least one record in the kb_knowledge table in the published state.

 

Prework: Grant access to Now Assist Skill Kit

  1. First, we need to grant our current user permission to use Now Assist Skill Kit. Click on your avatar, then Profile.
    Eliza_8-1727225196467.png

     

  2. Click on the three bar menu in the top left corner, then View > Default View.

    Eliza_7-1727225189149.png

     

  3. Scroll down to the related list named Roles and click Edit.Eliza_9-1727225203605.png

     

  4. Add the role named sn_skill_builder.admin to your user. Click Save.Eliza_10-1727225210563.png

     

  5. Log out and log back into your user. You should now have access to Now Assist Skill Kit!

Phase 1: Review the policies and knowledge article

  1. Type sn_compliance_policy.list into your filter navigator to see the list of policy records. Click New.
  2. Populate the form with the following values:
    • Name: Web Content Accessibility Guideline Policies
    • Type: Policy
    • Owner: Any user – we chose Cary Mccamey
    • Valid to: Any date. Set the year to 2034 to avoid errors
    • Reviewers: Add yourself
    • Policy categories: Create a new category record named Branding Category
    • Policy Text: Web Content Accessibility Guidelines (WCAG) 2.1 covers a wide range of recommendations for making Web content more accessible. Following these guidelines will make content more accessible to a wider range of people with disabilities, including accommodations for blindness and low vision, deafness and hearing loss, limited movement, speech disabilities, photosensitivity, and combinations of these, and some accommodation for learning disabilities and cognitive limitations; but will not address every user need for people with these disabilities. These guidelines address accessibility of web content on desktops, laptops, tablets, and mobile devices. Following these guidelines will also often make Web content more usable to users in general. Eliza_1-1727894660640.png
  3. Save the policy record by clicking Submit. Navigate back to the policy record.
  4. Scroll down to find the Control objectives related list. Click New.
    Eliza_2-1727894718176.png
  5. In the new control objective record, populate it as seen below:
    1. Name: Voice and Tone
    2. Reference: Web Content Accessibility Guidelines (WCAG)
    3. Active: True
    4. Category: Compliance and Governance Manual of Style
    5. Classification: Preventative
    6. Type: Data and Information Management
    7. Description:

Use plain language that makes content easy to read, easy to understand, and accessible to everyone. Write short sentences and use simple words and phrases. Avoid jargon, acronyms, and unfamiliar technical terms.

 

Use active voice: Active voice is direct and easy to read. Talk to the person who’ll be reading your content.

 

Use positive language: Positive language is energetic and supportive. One way to detect negative language is to look for words like “can’t,” “don’t,” etc.

 

Inclusive language: Avoid using terms that may have racist, gendered, ableist, or other negative connotations, like “blacklist”, “whitelist”, “grandfathered”, “slave”, “master”, “deaf”, and “blind”.

Eliza_3-1727894753053.png

 

  1. Click Submit. Return to your policy record and create another control objective.
  2. Populate it as seen below:
    • Name: Article Structure
    • Reference: Web Content Accessibility Guidelines (WCAG)
    • Active: True
    • Category: Compliance and Governance Manual of Style
    • Classification: Preventative
    • Type: Data and Information Management
    • Description:

Prioritize the actionable information that people need. Keep it brief, specific, and clear. Don’t overload people with information they already know or don’t need to know.

 

Use lists: Use numbered lists for step-by-step instructions or hierarchical information. Separate steps into logical chunks, with no more than two related actions per step. Use bullets when the list’s order doesn’t matter.

 

Abbreviations and acronyms: If it’s likely your reader won’t recognize an abbreviation or acronym, spell it out the first time you mention it and include the abbreviation in parentheses. Then use the short version for all other references.

Eliza_4-1727894788951.png

  1. Click Submit. You have now finished creating the policies we will use when generating our knowledge article!
  2. Type kb_knowledge.list into the filter navigator and hit enter. You should see a list of knowledge articles.Eliza_11-1727225281103.png
  3. Identify a published knowledge article that you will use as a test record for NASK. The ideal candidate for selection is an article that contains a number of spelling, grammar, and structural issues. If you don’t have a good article to leverage, you may replace the text in an existing demo  knowledge article with the below text:

R u having trouble with ur Outlook inbox? It can b a real pain in the butt when things aren't working rite, huh? Well, let me break it down 4 u and give u sum tips on how to fix those pesky issues.

First of all, one common problem peepl have with their Outlook inbox is that emails are not showing up or they r disappearing randomly. This can b super frustrating, especially if you're waiting for an important email. One possible reason for this is that ur inbox is getting too full and causing Outlook to glitch out. So, what u can do is try clearing out sum old emails or moving them to a different folder to free up sum space.

Another issue u might encounter is that ur inbox is running super slow or freezing up. This could be due to a bunch of different factors, like a slow internet connection, a bug in the Outlook program, or a problem with ur computer's hardware. To help speed things up, try closing out of any unnecessary programs or tabs, restarting ur computer, and checking for any updates to the Outlook program.

Sumtimes, u might find that emails r not sending or receiving properly in ur inbox. This could b because of incorrect email settings, a problem with ur internet connection, or issues with the recipient's email server. To troubleshoot this problem, double-check ur email settings to make sure everything is set up correctly, restart ur internet connection, and reach out to ur email provider if necessary.

Overall, dealing with issues in ur Outlook inbox can b a real headache. But by following these tips and staying patient, u should b able to troubleshoot and fix those problems like a pro. Good luck!

  1. Note down the number of the knowledge article you will be using.

 

Phase 2: Build a Subflow to collect the relevant policies

  1. Navigate to All > Flow Designer. Click New > Subflow.
    Eliza_5-1727894931330.png
  2. If you have Now Assist for Creator installed, you have the option to build your subflow with Now Assist. For today however, we will build it ourselves. Click the Build on your own tab.
  3. Name your subflow Get relevant policies, then click Build subflow on your own.
    Eliza_6-1727894961717.png
  4. Click Select to create the inputs & outputs of your subflow. Click the plus icon next to Outputs.Eliza_7-1727894973650.png
  5. Set the label of your output as Compiled policies, then click Done.Eliza_8-1727895038806.png
  6. Open the More Actions menu in the upper right corner of the screen as denoted by the three dots (…), then click Flow Variables.
    Eliza_10-1727895134820.png
  7. Click the plus icon to add a new flow variable. Set the label to Compiled Control Objectives as a string, then click Save.
    Eliza_11-1727895169416.png
  8. Click Add an Action, Flow Logic, or Subflow. Select Action, then type Look up records in the search bar. Click on ServiceNow Core, then finally click on the Look Up Records action.
    Eliza_0-1728426300526.png

     

  9. Populate the action as seen below, then click Done:
    • Table: Policy to Control Objective
    • Conditions: Policy.Policy categories CONTAINS Branding Policies
      Eliza_1-1728426329848.png
  10. Click on Flow Logic, then select For Each.
    Eliza_2-1728426357340.png
  11. Drag and drop the Policy to Control Objective records data pill into the Items field, then click Done.
    Eliza_3-1728426370234.png
  12. Click the small plus icon under the For Each loop, and select Flow Logic again. This time, click Set Flow Variables.

Eliza_4-1728426384247.png

 

  1. Click the plus icon, then set the flow variable to Compiled Control Objectives. Click the script icon next to the text bow that appears to make a script field appear. Copy and past the below code into the area:

var result = fd_data.flow_var.compiled_control_objectives

            + fd_data._2__for_each.item.content.description

            + "\n";

 

return result;

Eliza_5-1728426412874.png

  1. Click Done.
  2. Lastly, add another Flow Logic item, and click Assign Subflow Outputs.
    Eliza_6-1728426429172.png
  3. Click the plus icon to open the item, then set the subflow output variable to be Compiled policies. Drag and drop the flow variable into the data field. Click Done.
    Eliza_7-1728426464704.png
  4. Click Save, then Run Test. In the module that appears, click Run Test again.
  5. Once the test has finished running, click on the link that appears as seen below:
    Eliza_11-1728426546442.png
  6. Click on the Assign Subflow Outputs box to review the action that took place. Click on the Runtime Value to see the list of policies that were returned.
    Eliza_10-1728426528384.png
  7. If content with the output, return to your subflow by clicking its name in the tabs at the top. Click Publish in the top right of the screen. If you get a message stating that this is associated to 0 flows, please ignore it and publish it anyway.

Eliza_12-1728426582412.png

Congratulations! We now have all the input data we need to run this custom skill.

 

Phase 3: Build the custom skill

  1. Navigate to All > Now Assist Skill Kit > Home from the filter navigator.
  2. Click Create new skill.
    Eliza_2-1728437391487.png

     

  3. Name the skill Knowledge Article Compliance Review. In this lab, we will be using the Now LLM service to complete our task, so ensure the Default provider and Provider API values are both set to Now LLM Generic. Click Create skill.
    Eliza_0-1728437316034.png

     

  4. Add a new skill input by clicking the plus icon next to it. This is where we add the reference to a knowledge article to use within the prompt.
    Eliza_3-1728437418007.png

     

  5. Populate the skill input form as seen below, replacing the test record with the number of your knowledge article from phase 1. Once complete, click Add skill input.
    Eliza_4-1728437431538.png

     

  6. Next to Tools, click the plus icon.
    Eliza_5-1728437506346.png

     

  7. Populate the form as seen below. Note the lack of spaces in the Name, and the resource is the name of our published subflow.
    Eliza_7-1728437630742.png
  8. [Optional] Click the Pencil Icon Eliza_8-1728437676208.png next to the prompt name to rename the prompt. We are renaming it to Knowledge Reviewer here. Click Save changes.Eliza_1-1728437327092.png

     

  9. In the prompt field, remove the template text and replace it with the following:

You are an expert technical writer. Your task is to create an improved clear, concise, and helpful knowledge base article based on an existing knowledge article. The article should adhere to the branding and formatting policies laid out below:


The knowledge article that is to be improved is the following:

  1. Click in the prompt field after the words …policies laid out below. Click on Insert inputs, GetPolicies > Compiled policies.
    Eliza_10-1728437753926.png

     

  2. Repeat the process to add the knowledge article text to the prompt. Click in the prompt field after the words …improved is the following. Click Insert inputs > Knowledge > Article body.Eliza_9-1728437726690.png
  3. Your prompt should look like the below:
    Eliza_12-1728437797653.png

 

Phase 4: Test the custom skill

  1. Scroll down to the Test prompt section. Click Run tests.
    Eliza_13-1728437825768.png
  2. From the dialog box that appears, verify which knowledge article you wish to test your skill against, then click Run Tests.
    Eliza_14-1728437832884.png

     

  3. Verify that the LLM's output is to your liking. If you desire, you can iterate upon the provided prompt.
    Eliza_15-1728437886772.png
  4. To verify if information from your skill inputs is being brought in correctly, click on the tab named Grounded prompt. You will see the input that was delivered to the LLM, including the policies and knowledge article text.

Eliza_16-1728437915141.png

  1. Once content with the output of your skill, click Finalize prompt.
    Eliza_17-1728437924320.png
  2. In the module that opens, click Finalize prompt again.
    Eliza_18-1728437930903.png

     

 

Phase 4: Deploy the custom skill

  1. Click on Skill settings at the top of the page.
    Eliza_21-1728437985850.png

     

  2. Click on the option named Deployment Settings.
    Eliza_20-1728437965469.png
  3. Underneath the workflow header, set the value to Other.
  4. Tick the option marked UI Action, and set the table to Knowledge (to do so, type in kb_knowledge and scroll down until you find it.)
     
    Eliza_11-1727225768471.png
  5. Click Create UI Action, then Link to UI Action once it appears.
    Eliza_23-1728438075345.png
  6. A new window containing your UI Action will appear. Change the value in the Name field to Perform Compliance Review.

Eliza_25-1728438119553.png

 

  1. In the script field, replace everything from the try statement and below with the code provided below.
    Eliza_26-1728438151604.png

     

 

try {
    var output = sn_one_extend.OneExtendUtil.execute(request)['capabilities'][request.executionRequests[0].capabilityId]['response'];
     var newArticle = new KBVersioning().checkout(current);
newArticle.short_description =current.short_description;
//populate the article with the output of the model. we first need to replace the new line breaks with html break line tags so it appears correctly in the HTML field
var modelOutput = JSON.parse(output).model_output;
newArticle.text = modelOutput.replace(/\n/g, '<br></br>');
newArticle.valid_to = current.valid_to;
newArticle.version = current.version + 1;
var articleSysId= newArticle.insert();
        //publish an info message
        gs.addInfoMessage("We have finished updating your Knowledge article per your organization's policies. Please review for accuracy.");
} catch(e) {
    gs.error(e);
    gs.addErrorMessage('Something went wrong while executing skill.');
}

action.setRedirectURL(current);

 

 

  1. Click Update to save the record.
  2. Return to your skill within Now Assist Skill Kit.
  3. In the top right corner, click Publish.
    Eliza_27-1728438214094.png

     

  4. In the module that opens, tick the box containing your finalized prompt, then click Publish.
    Eliza_28-1728438243734.png

Phase 4: Activate the custom skill

  1. Navigate to Now Assist Admin from within the filter navigator.Eliza_19-1727225936696.png
  2. Click on Now Assist Features, then Other to find your published skill.
    Eliza_20-1727225950975.png

     

  3. Click on the tab named Available to find your published skill. Click Activate skill.
    Eliza_21-1727225967231.png

     

  4. Set the Display trigger to true, then click Save and continue.
    Eliza_22-1727225975160.png

     

  5. Review the next page, then click Activate.
    Eliza_23-1727225982394.png

     

  6. Dismiss the message stating confirmation of activation.

 

Phase 5: See the custom skill in action

  1. Type kb_knowledge.list into the filter navigator. Find the knowledge article you wish to run your custom skill on and open the record.
  2. Click the UI Action you created – you may have named it something else.
    Eliza_29-1728438356918.png

     

  3. Review the information that appears. Click the link in the message to open the new draft knowledge article.
    Eliza_30-1728438371813.png
  4. Review the output from your custom skill in the description field of the knowledge article.
    Eliza_31-1728438401640.png
  5. Congratulations! You have now created and deployed a custom skill.

 

 

Comments
Lener Pacania1
ServiceNow Employee
ServiceNow Employee

Eliza, great use case as it shows how we enforce governance of knowledge creation using the capabilities of the platform such as GRC.  Good Stuff!

anuragsnow
Tera Contributor

I am getting the below error message.

anuragsnow_0-1751361807548.png

Please provide some help on this.

Nilesh Pol
Tera Guru

Very useful blog...

Please provide more examples on ITSM scenario.

Version history
Last update:
‎10-09-2024 08:58 AM
Updated by:
Contributors