Intermediate
When the Tool Fails
This time lookupOrder throws. The model still writes an answer, but the tool part ends in output-error.
When the tool part is in output-error, show in #error exactly I could not look up your order. Nothing was changed. and show a button #retry with the text Try again that calls regenerate(). Disable #retry while a request is running (status is submitted or streaming). Show neither before the question is asked, and never show the raw error text.
What Check tests
- Before the question, there is no
#errorand no#retry - After the tool fails,
#errorshows the friendly sentence - The raw error text is not shown anywhere
#retrysaysTry againand is enabled when the answer is complete- The code calls
regenerate
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.