Command Palette

Search for a command to run...

Hectal
Phase 3: Stop, Retry and Failure
AI Frontend · Exercise 2 of 5 PreviousNext
Intermediate

Say How the Answer Ended

Two buttons ask Mitra a question: #short and #long. The route answers in the usual JSON chat shape. Show the reply text in #answer.

If choices[0].finish_reason is "length", the reply was cut off: show Cut off: Mitra ran out of room. in #note. For a normal finish leave #note empty (and clear it when a new question is asked).

What Check tests

  1. A normal answer shows its text and leaves #note empty
  2. A cut-off answer shows its text and Cut off: Mitra ran out of room. in #note
  3. Asking a normal question afterwards clears the note

Stuck? One hint at a time

The solution unlocks after your first Check. Try first: that is where the learning happens.

Runs in your browser. Your code is saved here.

Your page

Press Run to see the page.

Console

Nothing logged yet.