A Singapore Government Agency Website

Prompt Writing Tips

The quality of your results depends heavily on the quality of your prompts. This guide covers best practices for writing effective prompts, whether you’re using the web portal or the APIs.

The Basics

A prompt is a set of instructions that tells the AI what to look for in your document and how to return it. Think of it as briefing a new colleague on a task.

Good Prompt Checklist

  • ✅ Describes what the value looks like (not just what it’s called)
  • ✅ Gives examples of expected values
  • ✅ Specifies the format you want (e.g., DD/MM/YYYY, no $ sign, uppercase)
  • ✅ Explains what to do if the value isn’t found
  • ✅ Mentions alternative labels the value might have
  • ✅ Notes any common mistakes to watch for

Bad vs Good Prompts

Bad Good
“Get the name” “Return the full name of the employee as displayed on the payslip. For example: Tan Ah Kow, Muthu s/o Bala, Ali Mohd Hassan”
“Amount” “Extract the final net pay. This could be called Net Pay, Final Pay, Total Amount, or Total Salary. Format examples: $20,000 / $50,000 / 50,000 pounds”
“Date” “Extract the date of birth in DD/MM/YYYY format. If only a year is given, return 01/01/YYYY. If not found, return empty string.”

Technique 1: Give Examples

Examples are the single most effective way to improve accuracy. Show the AI what correct values look like.

Extract the NRIC number. This is a 9-character alphanumeric code starting with
S, T, F, G, or M, followed by 7 digits and ending with a letter.
Examples: S1234567A, T9876543Z, G1234567X

Technique 2: Handle Edge Cases

Tell the AI what to do when things aren’t straightforward.

Extract the company registration number (UEN).
- If the document shows multiple UENs, return only the one belonging to the applicant
- If no UEN is found, return "Not found"
- The UEN format is typically 9-10 characters, e.g., 201912345A or T08LL0001A

Technique 3: Specify Location in the Document

If a value appears in a specific section, tell the AI where to look.

Extract the "Total Amount Due" from the SUMMARY section at the bottom of the
invoice. Do not confuse this with subtotals or line item amounts elsewhere in
the document.

Technique 4: Use Alternative Names

Documents from different sources may use different labels for the same thing.

Extract the applicant's total monthly income. This could be labelled as:
- Gross Salary
- Total Earnings
- Monthly Pay
- Gross Income
- Basic + Allowances
Return the amount with the currency symbol, e.g., $5,500.00

Technique 5: Correct Known Errors

If you notice the AI consistently makes the same mistake, address it directly.

Extract the licence number. Note that due to the font used, the third character
is often misread as '1' (one) when it should be 'l' (lowercase L). The format
is always: two digits, then a letter, then 'A', then six digits.
Example: 25lA001887 (not 251A001887)

Technique 6: Set Context Once

When using multiple fields, you only need to set the overall context in the first field. The AI carries it across all fields.

Field 1:

You are an expert compliance officer reviewing import documents for a
Singapore Government agency. Bear this context in mind for all fields.

For this field, extract the importer's name as shown on the document.

Field 2:

Extract the date of import in DD/MM/YYYY format.

(No need to repeat the compliance officer context.)

Technique 7: Control the Output Format

Be explicit about how you want the response structured.

Evaluate whether this product meets our specifications. For each specification,
respond in this format:

Specification 1: [Met/Not met]
- Reason: [explanation]

Specification 2: [Met/Not met]
- Reason: [explanation]

FINAL VERDICT: [SATISFIED/UNSATISFIED]

Technique 8: Use “If Not Found” Instructions

Prevent the AI from hallucinating values when information is genuinely missing.

Extract the applicant's phone number. If no phone number is present in the
document, return "Not found". Do not guess or infer a phone number.

Common Mistakes to Avoid

Mistake Why It’s Bad Fix
Vague prompts (“get the info”) AI doesn’t know what to extract Be specific about what value you need
No examples AI guesses the format Provide 2-3 examples of correct values
No edge case handling AI returns garbage when field is missing Add “If not found, return X” instructions
Too many instructions in one field AI gets confused Split complex tasks into multiple fields
Assuming document layout Different formats break extraction Describe what the value looks like, not where it is

Prompt Generator Tool

If you’re not sure how to write a prompt, use the automated tool at https://tools.getaisay.com.

  1. Select your use case (Extraction, Verification, or Analysis)
  2. Describe the document type and what data you need
  3. The tool generates a full set of prompts and field structures
  4. Review and edit the suggestions to fit your specific documents
  5. Copy the prompts into the AISAY web portal

Important: The tool gives you a great starting point, but treat it as a first draft. Review and refine the prompts based on your actual documents.

See Also

Chat with me!
Bot Launcher