n8n / Make / Zapier automation · Lesson 2
LLM nodes and their patterns
How to correctly insert an LLM into a pipeline: classification, extraction, generation.
Three typical patterns
- Classification. Input → label ("urgent / normal / spam"). Often open-weight models or GPT-4o-mini are used — cheap and accurate enough.
- Extraction. Input (an email / document) → JSON with fields. The key is to set a strict schema via function calling / structured output.
- Generation. Input → text (e.g., a reply to a customer). Here the brand voice and a check matter most.
Principles
- Every LLM node does one thing. Don't try to cram everything into one prompt.
- Return structured JSON for the downstream nodes.
- Log every call with the prompt and the response — for debugging.
- Compute the cost per 1000 operations.
Protection against bad responses
- JSON validation via zod / JSON schema.
- Retry with exponential backoff.
- Fallback to another model on a refusal.
- On critical fields — a separate LLM check ("is this definitely an account number?").
Practical exercise
What to do after this lesson
Build a "classification + extraction + generation" pipeline in n8n / Make. Run it on 50 examples. Record accuracy and cost.
Ready-to-use prompt
Template for this lesson
Copy and adapt to your context. Text in angle brackets should be replaced.
(Field extraction)
From the text below, extract JSON with the schema:
{
"customer_name": string,
"request_type": "billing" | "tech_support" | "sales" | "other",
"urgency": "low" | "medium" | "high",
"next_step": string
}
If a field is ambiguous — put null, don't make it up.
Text:
<…>Common mistakes
What people get wrong
- One LLM node doing 5 tasks.
- Returning "text" instead of JSON.
- Not computing the cost per volume.
Pro tips
What works but no one documents
- One node — one task.
- Structured output / function calling.
- A cache for repeated requests.
When to use
Any pipeline with an LLM.
When not to use
When the task can be done with regex / rules — an LLM is overkill.
Official sources
Квиз — 2 вопроса
1.How many tasks should there be in one LLM node?
2.What to return to downstream nodes?
Отвечено: 0 из 2