Fix error handling
Closes https://github.com/holoviz/lumen/issues/585
Rather than having the LLM try to recover from unrecoverable errors, prevent it from trying to.
consolidates retries to prevent redundant code and only keeps the targeted retry while removing the catch-all-exceptions-and-retry since it usually fails to do the right thing and wastes tokens
tested and works for me when missing API key
Planning to merge first and serialize() only the last message, once https://github.com/holoviz/panel/pull/6967 goes in.
This pull request has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.