Automate your work with AI, from the first rule to the complete workflow
Your progress
0 lesson completed out of 50

A lesson is completed when you tick it, when you watch its video to the end or when you score 80% on its quiz. The certificate is issued online after the final assessment, from a score of 32 out of 40.

Your progress is saved in this browser. Log in to your client area to pick it up on your other devices.

Video transcript

Lesson 20, module 5: Plugging an AI into a workflow Classifying and extracting with structured JSON output How does a workflow read an AI's answer without picking the wrong box?

You can't route a sentence. You can route a field. [Diagram: Free text or enforced JSON] "Tell me what this is about" JSON enforced by a schema The same quote request, two ways to get the AI to answer. JSON mode promises valid JSON, not that your fields are respected. Structured output: the schema is enforced With OpenAI, Claude, Gemini and Mistral No code in n8n, Make, Zapier Write the schema before the prompt. Category as a closed list, with "other" Amount as a number, date as YYYY-MM-DD null when the information is missing "uncertain" as true or false The AI only returns what the schema allows. Prompt: Extract according to the schema: "Hello, we'd like a quarter-turn oak staircase for our house in Gradignan, budget around €6,000, before the summer. The Roux family" Answer: { "categorie": "escalier", "nom": "Famille Roux", "commune": "Gradignan", "budget_eur": 6000, "date_souhaitee": null, "incertain": true } Four checks before the JSON acts on its own. [Diagram: Can this JSON carry on alone] 1. Did the JSON arrive complete, with no error from the AI step? 2. Is the category anything other than "other"? 3. Is the "uncertain" field false? 4. Are dates and amounts plausible (future date, positive amount)? Yes to all: The workflow carries on alone at the control level set in the spec sheet. Twenty real cases, including three traps, before going live. A message with two subjects An off-topic message A missing piece of information In the exercise, you write the schema for the joinery's quote requests.

Your turn: Write and test the extraction of the joinery's quote requests The written lesson, the corrected exercise and the quiz are below the video.

Lesson 20 of 50 · module 5, connect ai to a workflow

Classify and extract with structured JSON output

An AI plugged into a workflow must return data the following steps can read: JSON enforced by a schema, with a category taken from a closed list, amounts as numbers, dates in YYYY-MM-DD format, null when information is missing, and an “uncertain” field that sends doubtful cases to a person.

  • 27 min of reading
  • 1 min 50 of video
  • 7 diagrams
  • 0 demande to copy
  • 3 exemples pratiques
  • 4 exercices answerss
  • 5 questions
  • 1 ressource

By the end of this lesson, you will know how to

  • Write the JSON schema for an extraction, with a closed list, numbers, dates and null values
  • Set up structured output in n8n, Make or Zapier, or via the OpenAI, Claude, Gemini and Mistral APIs
  • Test a classification on twenty real cases and send doubtful cases to a person

What’s covered

  1. JSON mode is not enough
  2. Write the schema before the instructions
  3. No code, in n8n, Make and Zapier
  4. Test on twenty cases before you trust it
  5. 3 worked examples, followed from start to finish
  6. Exercise with answers · Write and test the extraction of the joinery firm's quote requests
  7. 3 practice exercises, from guided to demanding cases
  8. The quiz

Key points

  • In a flow, the AI returns JSON enforced by a schema, never a sentence.
  • JSON mode guarantees valid JSON; only structured output guarantees your fields and their types.
  • Closed list with “autre”, amounts as numbers, dates as YYYY-MM-DD, null when information is missing.
  • The “incertain” field sends the doubtful case to a person: a flagged error costs nothing.
  • Twenty real messages, including three traps, before going live and at every model change.