Difference between revisions of "+AI Directive"
Ann Vincent (talk | contribs) m (→Creating a P3 Script to Run the AI NER Parser) |
Ann Vincent (talk | contribs) m (→Creating a Button to Trigger the AI NER Parser via P3 Script) |
||
Line 108: | Line 108: | ||
===Creating a Button to Trigger the AI NER Parser via P3 Script=== | ===Creating a Button to Trigger the AI NER Parser via P3 Script=== | ||
# Create a custom field with the Field Type set to “Special - Browser Script” and set the Trigger Type set 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. | # Create a custom field with the Field Type set to “Special - Browser Script” and set the Trigger Type set 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. | ||
− | # For Field Name enter “ai_browser_script”. For Caption enter “Run AI Parser”. | + | # For '''Field Name''' enter “ai_browser_script”. For '''Caption''' enter “Run AI Parser”. |
− | # Under the Custom Script input, enter the following: | + | # Under the '''Custom Script''' input, enter the following: |
<pre>runP3Script('aiparseApp()') | <pre>runP3Script('aiparseApp()') | ||
Line 116: | Line 116: | ||
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. | 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=== | ===Storing Applicant Information in a Custom Field=== |
Revision as of 16:45, 12 January 2024
Contents
- 1 Overview
- 2 Configuration
- 2.1 Creating a Custom Field to Store Parsed AI Content
- 2.2 Creating a P3 Script to Run the AI NER Parser
- 2.3 Creating a Button to Trigger the AI NER Parser via P3 Script
- 2.4 Storing Applicant Information in a Custom Field
- 2.5 Storing Organization Information in a JSON Custom Field
- 2.6 Parsing and Storing a Application Summary
- 2.7 Translating the Application Summary
- 2.8 Populating a Radio Button Based on Parsed Information
- 2.9 Testing your Configuration
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
- performing calculations
- 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 SmartSimple Support 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, Title, 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 often 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.
To accomplish this, this article will walk through the following process:
- Create a field to store the sample input text that needs to be parsed
- Create a P3 script to run any +AI Directives specified
- Create a browser button that can be click to run +AI Directives ad-hoc
- Create a field for the AI to store the parsed text to
- Later, we test our configuration by doing the following:
- Create a record and populate one of the fields with the sample text that needs to be parsed
- Click the browser button to run the P3 script set up earlier
- Reload the record to see the results
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.
- Navigate to the desired UTA > Configuration Settings > Level 1 tab > Custom Fields > Click the New Field button
- Set the Field Type to be “Text Box - Text Multiple Lines”. This will be used to hold the text that the AI will parse.
- For Field Name enter “text_block”. For Caption enter “A Block of Sample Text”
- Click Save
- 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.
- Navigate to the desired UTA > Configuration Settings > Level 1 tab > P3 Script Editor > Click the New P3 Script button
- For Name, enter “aiparseApp”
- 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
- Create a custom field with the Field Type set to “Special - Browser Script” and set the Trigger Type set 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.
- For Field Name enter “ai_browser_script”. For Caption enter “Run AI Parser”.
- 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.
- Create a custom field with the Field Type set to “Text Box - Text Single Line”
- For Field Name enter “applicant_information”
- For Caption enter “Applicant Information”
- For +AI Directive enter a hashtag (#). The hashtag symbol lets the AI know that any text about “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.
- Create a custom field with the Field Type set to “Special - JSON”
- For Field Name enter “Organization_Information”
- For Caption enter “Organization Information”
- 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.
- (Optional) Toggle on Display As Table
- 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.
- Create a custom field with the Field Type set to “Text Box - Text Multiple Lines”
- For both Field Name and Caption enter “Summary”
- For +AI Directive enter “Create a summary in one hundred words or less”
- 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.
- Create a custom field with the Field Type set to “Text Box - Text Multiple Lines”
- For both Field Name and Caption enter “Summary”
- For +AI Directive enter “Create a Spanish summary in one hundred words or less”
- 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.
- Create a custom field with the Field Type set to “Select One - Radio Buttons”
- For Field Name enter “Funding_over_1000”
- For Caption enter “Is Funding Requested Over $1000”
- 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.
- For Predefined Options enter “1=Yes;2=No”
- Click Save.
Testing your Configuration
To test your configuration, let’s do the following:
- Create a new record in the UTA
- Under the new custom field we created (“A Block of Sample Text”), enter the sample application text. For reference, you may use the sample in the appendix at the end of the article. Note: The text must be less than 6000 words. In a future upgrade, this limit will be increased to 32,000 words.
- Save the record
- Click the browser button we created to run the AI parser
- If the script has run successfully, you will see an alert that states “Parse Complete”. This may take a few minutes.
- Reload the record to see the results
The information will be parsed and populated into the desired fields.