control-flow-do-while-self-loop.ts 266 B

123456789
  1. // do-while: loop-carried draft feeds the SAME ask's instructions next round.
  2. const planner = agent("planner");
  3. let draft = "";
  4. let rounds = 0;
  5. do {
  6. draft = await planner.ask<string>(`draft, previous: ${draft}`);
  7. rounds += 1;
  8. } while (rounds < 2);
  9. return draft;