+AI Directive

From SmartWiki
Jump to: navigation, search

Overview

The multi-faceted +AI Directive feature may be used in conjunction with natural language, scripts and the variable processor to perform many time saving tasks including:

  • analyzing text and automatically populating custom fields with relevant information
  • converting text into different formats like JSON
  • summarizing and translating text
  • comparing application requests with program objectives and providing suggestions or scores on their alignment
  • populating custom fields with data extracted from the internet

Note: You will need an OpenAI license to use AI features on SmartSimple. You must be a Global Administrator to enable this feature. Contact your account manager or sales@smartsimple.com for further information on billing and implementation.

+AI Directive is implemented through SmartSimple as a new custom field setting. Below, we outline the two main modalities under which +AI Directive may be used.

Modality 1: Named-Entity Recognition (NER) Parser

The first method of using the +AI Directive is through named-entity recognition (NER), which enables the AI to identify and designate named entities referenced in a block of unstructured text into pre-defined classifications such as an organization, user, or amount.

This can be accomplished by adding a hashtag (#) into the +AI Directive field.

Additionally, you can use this input to specify in plain text how you want the data to be returned by the AI. For example, the following prompts could be used:

  • “Create a summary in one hundred words or less”
  • “Create a summary in one hundred words or less and translate into Spanish”
  • “Is funding amount requested greater than $1000 answer 1 for Yes or 2 for No”
  • “organization as JSON Object”

Modality 2: On Demand

The second modality is referred to as “On Demand”. You may call this using the +AI Directive field and trigger this with a P3 Script. In this scenario you would enter something like the following into the +AI Directive input:

## Compare the following granting program requirements to the grant application and determine its suitability for funding and suggest improvements

Program eligibility: "@txtProgramEligibility@"
Grant Application: "@txtApplicationBody@"

Alternatively, you could do something similar using the Variable Processor. In this scenario you would enter something like:

<!--@ai(openai,chatgpt,9)-->
Compare the following granting program requirements to the grant application and determine its suitability for funding and suggest improvements
Program eligibility: "@txtProgramEligibility@"
Grant Application: "@txtApplicationBody@"
<!--@aiend-->

This article will explore use cases using both the named-entity recognition (NER) and the “On Demand” modality utilizing the +AI Directive input.

Syntax

In summary, the following syntax can be used:

  • (NER Parser Modality) To parse the document using the caption, enter a single hashtag ( # ). This will use the record’s Caption for NER matching.
  • (NER Parser Modality) To parse the document with specific instructions, enter a hashtag ( # ) followed by a set of instructions in natural language
  • (On Demand Modality) To bypass the NER and trigger the directive with a P3 script, enter double hashtags ( ## ) followed by a set of instructions in natural language. This is used for complex requests that are not suitable for NER parsing.

Things to Consider

  • The +AI Directive input is not available on all standard fields, Template, Role or Category custom fields.
  • Supported custom field types include: Select One - Dropdown List, Select Many - Checkboxes, Special - JSON, and the Text Box type of fields.
  • Supported Standard fields include:
    • Level 1 Standard Fields: Name, Description, Start and End Date, Close Date
    • Level 2 and 3 Standard Fields: Subject, Description, Location, Start And End Date
    • User Standard Fields: First Name, Middle Name, Last Name, Title, Prefix, Suffix, Phone, Phone Extension, Email, Address, Address 2, City, State/Province, Zip/Postal Code
    • Company Standard Fields: Name, Address, Address 2, City, State/Province, Zip/Postal Code, Phone, Website
  • The text to be parsed must be less than 6000 words. In a future upgrade, this limit will be increased to 32,000 words.

Configuration

In the following section, we will provide a detailed guide on how to configure your system to accomplish various common use cases.

As an example, let’s solve a common problem with application submissions using +AI Directive. Applicants submit long documents containing undifferentiated information about the applicant, their organization, their requested funding, and more. We can save time by using the NER Parser modality of +AI Directive to parse and retrieve the relevant information.

In this case, let’s use +AI Directive to read through the application and do the following: pull out the applicant’s contact information, create a short summary of the application, store the organization’s details as a JSON, and answer a few basic criteria questions about the submission.

This article will walk through the following process:

  1. Create a field to store the sample input text that needs to be parsed
  2. Create a P3 script to run any +AI Directives specified
  3. Create a browser button that can be clicked to run +AI Directives ad-hoc
  4. Create a field for the AI to store the parsed text to
  5. Test the final configuration


Creating a Custom Field to Store Parsed AI Content

Before we can use the AI, we must create a custom field to store the content the AI will parse.

  1. Navigate to the desired UTA > Configuration Settings > Level 1 tab > Custom Fields > Click the New Field button
  2. Set the Field Type to be “Text Box - Text Multiple Lines”. This will be used to hold the text that the AI will parse.
  3. For Field Name enter “text_block”. For Caption enter “A Block of Sample Text”
  4. Click Save
  5. Make a note of the Custom Field ID that was generated after we saved the field. We will reference this ID when we create a P3 script in the next step.


Creating a P3 Script to Run the AI NER Parser

A P3 script will be used to trigger the NER Parser.

  1. Navigate to the desired UTA > Configuration Settings > Level 1 tab > P3 Script Editor > Click the New P3 Script button
  2. For Name, enter “aiparseApp”
  3. For Source, enter:
session.AIParse(5378575);
session.runAIdirective();

In the first line of the Source, we are telling the system to parse the contents of the “Text Box - Text Multiple Lines” custom field we created in the previous step by passing the Custom Field ID as a parameter: the syntax is session.AIParse(CustomFieldID);. In the next line, we are instructing the AI to run any +AI Directives specified on the record to run concurrently. We will specify the +AI Directives in a later step.

Creating a Button to Trigger the AI NER Parser via P3 Script

  1. Create a custom field with the Field Type set to “Special - Browser Script” and set the Trigger Type to “On Demand”. This field will create a button on the record that will run the P3 script we created earlier. This allows us to run the P3 script ad-hoc.
  2. For Field Name enter “ai_browser_script”. For Caption enter “Run AI Parser”.
  3. Under the Custom Script input, enter the following:
runP3Script('aiparseApp()')
alert('Parse Complete')

The text “aiparseApp” is the name of the P3 script we will create in the next step. If you name your P3 script differently you will need to update that here. The text “Parse Complete” is the message that will display in a yellow alert on screen when the parsing is complete. You may modify this messaging as desired.

Storing Applicant Information in a Custom Field

In this step we will create a custom field and specify that the AI should fill this field with relevant parsed information using the caption as the label for NER.

  1. Create a custom field with the Field Type set to “Text Box - Text Single Line”
  2. For Field Name enter “applicant_information”
  3. For Caption enter “Applicant Information”
  4. For +AI Directive enter a hashtag (#). The hashtag symbol lets the AI know that any text related to the Caption (“Applicant Information”) should be parsed from the original text block and stored in this field.

Storing Organization Information in a JSON Custom Field

In this step, we will create a JSON custom field and populate this field with information related to the organization. In addition, we will ask the AI to format the parsed information as a JSON object.

  1. Create a custom field with the Field Type set to “Special - JSON”
  2. For Field Name enter “Organization_Information”
  3. For Caption enter “Organization Information”
  4. For +AI Directive enter “organization as JSON Object”. This lets the AI know that any information about the applicant’s organization in the original text block should be parsed and stored as a JSON.
  5. (Optional) Toggle on Display As Table
  6. Click Save

Parsing and Storing a Application Summary

In this step we will create a summary from the original source text and we will condense it to be less than 100 words.

  1. Create a custom field with the Field Type set to “Text Box - Text Multiple Lines”
  2. For both Field Name and Caption enter “Summary”
  3. For +AI Directive enter “Create a summary in one hundred words or less”
  4. Click Save

Translating the Application Summary

In this step we will create a summary from the original source text and we will condense it to be less than 100 words.

  1. Create a custom field with the Field Type set to “Text Box - Text Multiple Lines”
  2. For both Field Name and Caption enter “Summary”
  3. For +AI Directive enter “Create a Spanish summary in one hundred words or less”
  4. Click Save

Populating a Radio Button Based on Parsed Information

In this step the AI will parse the information and select the correct radio button option.

  1. Create a custom field with the Field Type set to “Select One - Radio Buttons”
  2. For Field Name enter “Funding_over_1000”
  3. For Caption enter “Is Funding Requested Over $1000”
  4. For +AI Directive enter “Is funding amount requested greater than $1000 answer 1 for Yes or 2 for No”. This tells the AI to answer the question based on the parsed information.
  5. For Predefined Options enter “1=Yes;2=No”
  6. Click Save.


Testing your Configuration

To test your configuration, do the following:

  1. Create a new record in the UTA
  2. Under the new custom field we created (“A Block of Sample Text”), enter the sample application text. For reference, you may use this sample text block.
    Note: The text must be less than 6000 words. In a future upgrade, this limit will be increased to 32,000 words.
  3. Save the record
  4. Click the browser button we created to run the AI parser
  5. When the script finishes running, it will display the customizable “Parse Complete” alert. This may take a few minutes.
  6. Reload the record to see the results

The information will be parsed and populated into the desired fields.