Tasks: the same questions over many documents
Task bundles a set of questions with the rule for when the answers are safe to act on without a person. Run it on one input or on thousands; each result says whether it can go straight through, and if not, why.
Python
from simoai import Client, Task, Choice, Extract, Fill, Noul
c = Client()
triage = Task(
questions={"policy_no": Extract("the policy number"),
"amount": Fill("the amount claimed, in dollars", kind="number"),
"covered": Noul("The loss is covered by the policy"),
"route": Choice("Where does this claim go?",
{"deny": "not covered", "adjuster": "needs an adjuster",
"fast_track": "small and clear"})},
act_at=0.9, # every decision at least this sure, or a person looks
read_at=0.8, # every read at least this confident
check=lambda v: ["fast-track over $5,000"] if v["route"] == "fast_track" and v["amount"] > 5000 else [])
res = triage.run(c, {"policy": POLICY, "claim": claim_text}) # also takes media=[...] and request options
if res.ok:
route(res["route"])
else:
send_to_person(res.review) # e.g. ["route='adjuster' p=0.71"]The rule
| Argument | Meaning |
|---|---|
questions |
The questions to ask of every input |
act_at |
Every decision must be at least this sure |
read_at |
Every read must be at least this confident |
check |
Your own business rules: a function of the values that returns a list of problems (empty means fine) |
derive |
{name: days_between(...) | difference(...) | sum_of(...)}: exact arithmetic over the reads. See Read first, then decide |
two_pass |
Defaults to on when the task has both reads and decisions, so decisions see the values read |
A result is ok when every decision clears act_at, every read clears read_at and check returns nothing. Otherwise res.review lists the reasons, ready to show a reviewer.
Many inputs
Python
results = triage.run_many(c, [claim1, claim2, claim3], workers=4) # results in input order
auto = [r for r in results if r.ok]
manual = [r for r in results if not r.ok]
print(f"{len(auto)} straight through, {len(manual)} for review")Because thresholds are calibrated, act_at=0.9 means about 1 in 10 of the borderline decisions that just clear it would be wrong. Raise it where mistakes are expensive; the share sent to people goes up accordingly.