Free cookie consent management tool by TermsFeed

Improve Data Accuracy

On This Page

The following methods can help you improve data accuracy in the prompt builder AI skill:

Hard-code values in the prompt

Define a small, static list of valid values directly in the AI prompt. This ensures only known values are returned.

Use this method when:

  • The reference list is small and rarely changes.
  • You need high accuracy for a fixed set of options.

Keep in mind, this approach doesn't scale well for large, frequently changing datasets.

Prompt example

1
2
3
4
Extract a customer name from the document. Only select a name from:  
- ACME Inc  
- Globex Corp  
- Stark Industries

Extract and match using two prompts

This method breaks the process into two prompts—one for extraction and one for matching—which helps keep data processing cleaner and easier to manage.

When you use this method:

  1. The first prompt extracts raw values from the document.
  2. The second prompt matches the extracted values against a reference list.

Prompt examples

Extraction

1
2
3
{
  "extractedCustomer": "ACME"
}

Matching

1
2
3
4
Given the extracted value "ACME", find the closest match from this list:
- ACME Inc
- Globex Corp
- Stark Industries

Handle naming variations

Instead of extracting a single value, return multiple variations of a value to improve your chances of finding a match.

Use this method when:

  • There are minor variations in naming (e.g., Corp vs. Incorporated).
  • You want broader matching with a small risk of getting less accurate results.

Prompt example

1
2
3
4
5
6
Extract possible customer names from the text: 'We received an order from ACME Corp.'

Ouput JSON:
{
  "possibleMatches": ["ACME", "ACME Corp", "ACME Incorporated"]
}

a!queryRecordType example

1
2
3
4
5
6
7
8
9
10
11
12
a!queryRecordType(
  recordType: recordType!CUSTOMERS,
  filters: a!queryFilter(
field: "name", 
operator: "IN", 
value: {"ACME", "ACME Corp", "ACME Incorporated", "ACME Corporation"}
   ),
     pagingInfo: a!paging(
     startIndex: 1,
     batchSize: 100
   )
).data

This approach helps you find the best match when you have lots of similar options in your data. Instead of looking through everything, it uses smart search to narrow things down first.

You might choose this method when you have a lot of similar options or your data is unstructured and you want to make the final matching step quicker and more accurate.

This method uses three steps, with your process model handling the flow of data between them.

  1. The first AI skill uses generative AI to pull out the specific piece of information you're interested in (e.g., a form name). The AI skill will extract and return the requested information in a structured format like JSON. This extracted data is passed as input to the smart search (step 2).
  2. Instead of immediately trying to match the extracted data against all your reference data, this step uses smart search to find the most relevant records. This occurs directly within Appian by using the search operator in the a!queryFilter function combined with the a!queryRecordType function.
  3. Now, with a much smaller list of potential matches provided by smart search, the second AI skill is used. This AI skill takes the original extracted text and asks AI to pick the single best match from the filtered list that came from the smart search step. For example, given "Claim Submission Form" and the filtered list: Create Claim Form, Update Claim Details Form, Cancel Claim Form, this AI skill picks the closest or most appropriate result.

Prompt examples

Step 1: Prompt to extract and return data

1
2
3
4
5
6
7
Extract the form name from the document:
{document}

Output JSON:
{
  "extractedFormName": "Claim Submission Form"
}

Step 2: Smart search to find relevant records

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
a!queryRecordType(
 recordType: recordType!Claim,
 fields: {
   recordType!Claim.fields.id,
   recordType!Claim.fields.title,
   recordType!Claim.fields.description,
   recordType!Claim.searchResults.allSearchFields.similarityScore,
 },
 filters: {
   /*General Liability, Property Loss, or Liability etc */
   a!queryFilter(
    field: recordType!Case.fields.description,
+    operator: "search",
+    value: "property loss"
   ),
   /*Cases logged in the past 3 days*/
   a!queryFilter(
    field: recordType!Claim.createdOn,
    operator: "between",
    value: {today() - 2, today()}
   ),
   /*Only return cases with a description that has a
     Similarity score of 0.0036 or more.
   */
   a!queryFilter(
    field: recordType!Claim.searchResults.allSearchFields.similarityScore,
    operator: ">=",
    value: 0.0036
   ),
 },
 /*Sort on similarity score*/
 pagingInfo: a!pagingInfo(
  startIndex: 1,
  batchSize: 10,
  sort: a!sortInfo(
   field: recordType!Claim.searchResults.description.similarityScore,
   ascending: false,
  )
 )
)

Step 3: Prompt to pick the best match

1
2
3
4
5
6
7
8
9
Given the {extractedValue}, find the closest match from {listOfOptions}
{extractedValue} and {listOfOptions} will be provided in the input
Example Input:
extractedValue: "Claim Submission Form"
listOfOptions ("comes from whatever smart search returns"):

Create Claim Form
Update Claim Details Form
Cancel Claim Form

Hybrid approach

Hybrid approaches can be implemented within process models by combining different techniques together.

Hybrid flow example:

  1. Try hard-coded prompt values (if applicable).
  2. If no match, use broad extraction method.
  3. If no match, use smart search to narrow reference data.
  4. If confidence is still low, escalate to a human-in-the-loop review.

Use regex to match reference values

Instead of using generative AI, this method applies regular expressions (regex) to match extracted text against known patterns.

Use this method when:

  • The data is highly structured.
  • You want to avoid using generative AI.

Prompt example

1
regexmatch("(?i)ACME(?: Inc)?", ri!extractedText)

Feedback