Skip to content
AI & Machine Learning

Prompt Chaining

Definition

Prompt chaining is a technique used in AI to generate more complex and accurate responses by breaking down a task into smaller, more manageable sub-tasks. It involves creating a series of related prompts that build upon each other to achieve a specific goal.

Diagram

  1. Prompt 1

    Extract

    pull the complaints out of 200 reviews

    → list of complaints

  2. Prompt 2

    Group

    cluster them into themes

    → themes with counts

  3. Plain code

    Check

    code: do the counts add up?

    → verified themes

  4. Prompt 3

    Write

    draft a one-page summary

    → summary for the team

One prompt asked to do all four jobs at once tends to skip or blur some. Splitting them lets you test each step, use a cheaper model for easy ones, and put ordinary code between steps to check the output before the next step builds on a mistake.

Worked example