Open this lesson in your favourite AI. It'll walk you through the why, explain the demo, and quiz you on the try-it list.
There's a sharp test that separates real AI features from decoration: does the feature need to understand or generate fuzzy, open-ended content, or could a deterministic rule do it cheaper and more reliably? AI earns its cost only on tasks with high variability and tolerance for approximate answers — summarizing free text, classifying intent, drafting prose. The moment a task has a crisp right answer reachable by a query, a sort, or a lookup, AI is the wrong tool: slower, costlier, and less trustworthy. Internalizing this test is what keeps your roadmap from filling with expensive nondeterminism where a WHERE clause would do.
A decision function: route tasks with crisp deterministic answers to plain code, and only fuzzy understanding/generation tasks to a model. The point is how often the honest answer is 'don't use AI'.
Use these three in order. Each builds on the one before.
In one paragraph, explain the simple test for whether a task actually needs AI versus plain code.
Walk me through how I decide, task by task, whether to use an LLM, a rule, or a database query.
Given a feature that's mostly deterministic but has one fuzzy step, how would you split the work between code and AI, and why?
def should_use_ai(task):
if task["has_exact_answer"] and task["computable_by_rule"]:
return "use plain code (query/regex/sort) — cheaper, exact, testable"
if task["needs_understanding"] or task["needs_generation"]:
if task["tolerates_approximate"]:
return "use AI — fuzzy input, approximate output is acceptable"
return "use AI BUT add validation/guardrails — low error tolerance"
return "probably not AI"
print(should_use_ai({"has_exact_answer": True, "computable_by_rule": True,
"needs_understanding": False, "needs_generation": False,
"tolerates_approximate": False})) # plain code
print(should_use_ai({"has_exact_answer": False, "computable_by_rule": False,
"needs_understanding": True, "needs_generation": True,
"tolerates_approximate": True})) # use AIpython3 main.py