Library › Operations AI › Operations and supply chain

Sort five building complaints into priority groups as JSON

  • For Operations and supply chain
  • You practice Setting limits and rules
  • Time about 5 minutes
  • Level Intermediate

About this exercise

Facilities received five complaints. Write a prompt for exactly one code block holding a JSON object with the keys emergency, high, medium and low, each an array of the complaint numbers that belong there. Rules: emergency is any gas smell, burning smell or smoke; high is no heat below 55 F or active water on a floor; medium is a comfort complaint affecting a work area; low is cosmetic. Every number appears once. After the block add one line: "Facilities decides dispatch."

Common mistakes when you ask AI for this

  • Believing 'probably fine'. The AI downgrades the burning smell because the reporter did. Try: Say: "Judge by the rule, not by how the reporter words it."
  • Mis-sorting by feel. The AI puts the cold office in medium. Try: Quote the rule for each group.
  • Wrong structure. The AI returns a table or adds keys. Try: Say: "Exactly one code block, keys emergency, high, medium, low."
  • Extra text around the code. The AI adds explanations, extra blocks or comments around the output. Try: Say "exactly one code block, nothing else" and cap the rows.

What a strong prompt includes

  • Names the four keys
  • Gives the rules
  • Says judge by the rule
  • Asks for one JSON block

Practice this now ↑

Related exercises