DataCareerHub
Explore learning
← Shared foundationsFree companion · 25 minute suggested activity

Validate structured extraction without assuming AI

Applied AI contracts · Shared foundation workshop · Use a deterministic baseline and reject ambiguous outputs.

Learn → Try → ExplainReviewed 2026-10-15
01

Objective & prerequisites

Use a deterministic baseline and reject ambiguous outputs. Prerequisites: basic Python expressions and files; use a disposable local practice folder and fictional data. This shared workshop complements the existing data/AI tracks and does not create a second progress system.

02

Understand the concept

Structured output is useful only when types, allowed fields and meaning are checked. A JSON object can be well formed and still invent a currency or total. Start with a small deterministic baseline so its scope is inspectable. AI model integration is a separate experiment requiring provider/data/cost decisions and evaluation.

03

Worked example

extract_invoice accepts exactly one explicit “Total EUR:700.00” style field and returns EUR/70000 cents. It refuses a missing or repeated total. This is a rule-based fictional baseline, not an LLM call or trained extractor.

python3 foundation_labs.py FoundationTests.test_extraction
04

Try it yourself

Run the extraction test, then add a second total to a disposable string. Decide what should happen rather than selecting the first match silently. Record your prediction before running the supplied reference, then compare the observed result and explain any difference.

Worked solution

Ambiguous or missing totals are rejected. The decimal components convert directly to integer cents. Real invoices have formats, taxes and layouts beyond this tiny contract, so the example is not a commercial invoice-processing claim.

06

Knowledge check

Is a regex baseline an active generative AI integration? Try answering without rereading the example.

Check and explain

No. Label it accurately and compare any later model against declared evidence and errors.

08

Mini-project, mistakes & handover

Produce a short README with the question, exact local command, input meaning, checks and actual results. Include one failure case and its explanation. Never silently turn an exception into a passing result. Mark simulated behavior explicitly, credit the supplied teaching code and identify your own contribution. These activities are unsaved self-practice, not certification.

09

Authoritative reference

Read the official reference ↗

01-prompt-injection/ — consulted for the underlying interface/concept. The lesson and fictional examples are original teaching material. Python reference tested with 3.12; designed for 3.10+. Git lab requires Git 2.28+.

Make the reasoning yours.

Try the activity before reading its reference. Keep your sources, commands and assumptions with your work. Companion activities are unsaved self-practice and do not award a certificate or change lesson progress.

Resume guidance and examples are for learning and preparation only. They do not guarantee interviews, a job offer or employment.

Public registration, payments and new paid enrolment remain disabled. These free resources do not grant access to protected course modules.

Learner dashboard ↗ · Ask a question ↗