Map-reduce
Splitting a big job into pieces, handling each piece separately (map), then combining the results (reduce).
Chains often run one step over a whole list, then combine the results. Say you need descriptions for 40 products. You call
draft_emailonce per product, in a loop. Then a final step checks the whole set for repetition, such as ten descriptions that all open the same way. This shape is sometimes called map-reduce. You map one step over many inputs. Then you reduce the results into one.
Try it now
A fake model stands in for the real one, so you can see the shape of a chain. Each step's return value becomes the next step's argument. The final check runs in plain Python. The last line prints: email(facts(rain shell)) True
Learn it properly
Prompt chaining · Break big tasks into a pipeline of smaller model calls. About 30 minutes.
Other terms from the same lesson
- prompt chaining: Splitting a job into steps, where each model call's answer feeds the next call.
Never trained an AI?
Teach a small one to write, right in your browser. It takes about 20 seconds and needs no account.