An AI instruction in a wiki document tells the AI how to change part of the document after the form's answers have been filled in. Clear instructions give the same good result every time. Vague ones give documents that differ from one run to the next.
The AI runs when someone submits a form that uses the wiki, if the form has Use Artificial Intelligence turned on. In the wiki's preview the instructions show as they are, not carried out.
1. First ask: does this need AI?
If a rule has a definite answer, use wiki logic instead. Logic gives the same document for the same answers, costs nothing to run, and you can check it in the preview.
| You want | Use |
|---|---|
| Remove a section when the answer is "no" | {IF:has_children="Yes"}…{/IF} |
| "He" or "she" from a gender field | {IF:…} with {ELSE} |
| A sentence once per beneficiary | {EACH:beneficiaries}…{/EACH} |
| Add up expenses | A calculated field |
| Rewrite a rambling free-text answer in formal language | {AI: …} |
| Summarise a long list in a readable paragraph | {AI: …} |
See Wiki logic: making a document change itself.
The wiki editor helps you here. In the Validate tab, click Run Validation. An AI instruction that is really a simple IF or EACH is listed with a Convert button that swaps it for the logic, keeping the text inside. If there are several, Convert all does them together.
2. Close every instruction with {/AI}
Put {/AI} after the text the AI should work on. Everything between the instruction and {/AI} is what it changes:
{AI: Rewrite this paragraph in plain, formal English. Do not change any names or dates.}
The testator wishes that his house goes to whichever of the kids looks after the dog.
{/AI}
For an instruction that writes new text rather than changing existing text, close it straight away: {AI: Write one sentence summarising the assets listed above.}{/AI}.
An instruction without {/AI} is flagged when you run validation. A {/AI} with no instruction before it is flagged too.
3. Say exactly what you want
Vague:
{AI: Fix this section.}
Better:
{AI: Rewrite this paragraph in clear, simple English suitable for a South African legal document. Do not remove any names or dates.}
4. Say what to keep and what to remove
Wrap exactly the part the instruction is about, so the AI can't touch anything else. In a long section, you can also mark the start and end of the part you mean:
{AI: If 'has_assets' is 'no', delete everything between <!-- START ASSETS --> and <!-- END ASSETS -->. Otherwise leave it unchanged.}
<!-- START ASSETS -->
…the assets clause…
<!-- END ASSETS -->
{/AI}
A yes/no rule like this one is better as {IF:…} (see section 1); use AI only when the change needs judgement.
5. Name the form fields
The AI only knows the form's answers. Refer to them by name:
Good: {AI: Use 'marital_status' to rewrite the introduction.}
Not good: {AI: Check the user's marital status.}. The AI doesn't know who "the user" is.
Give fields clear, distinct names, such as primary_beneficiary_name and primary_beneficiary_share, not beneficiary, beneficiary2 and beneficiaryname.
6. Give the steps in order
{AI:
1. If 'beneficiary_count' is 1, rewrite the clause so that 100% goes to that beneficiary.
2. If 'beneficiary_count' is more than 1, split the estate equally unless percentages are given.
3. Keep the wording in line with South African legal standards.
}…the distribution clause…{/AI}
7. Say what not to do
{AI: Rewrite this paragraph in simpler English, but DO NOT change any legal terms.}
{AI: Summarise this section in 2 sentences. DO NOT remove the child's full name.}
8. State the format
{AI: Rewrite this section as a numbered list.}
{AI: Keep all headings, bold text and tables exactly as they are.}
9. Show an example
{AI:
Rewrite this in a formal tone.
Example:
Input: "he is my executor"
Output: "He shall be appointed as my executor."
}…{/AI}
10. Don't give rules that clash
Two instructions that each cover half the case can contradict each other:
{AI: Remove this if the person is married.}{/AI}
{AI: Use this if the person is not married.}{/AI}
Better, one instruction that covers both:
{AI:
If 'is_married' is 'yes', keep the Married version and delete the Single version.
If 'is_married' is 'no', keep the Single version and delete the Married version.
}…both versions…{/AI}
Better still, since this is a fixed rule: {IF:is_married="yes"}…{ELSE}…{/IF}.
11. Keep each instruction next to its text
Don't gather all instructions at the top or bottom. Put each one around the text it changes.
12. Test with different answers
Submit the form several times before you rely on it, especially for wills, contracts and reports. Try:
- The fewest answers possible
- Every answer filled in
- Missing values
- Unusual and contradictory values
The AI can word things differently each time, so read every result.