Here is what I'd do in this case. - give the LLM an "exception" option to pick when it's unable to perform the operation. - Validate the response and retry. - use the http://useinstructor.com library. It provides a nice abstraction to work with. https://bird.makeup/@liveoverflow/1790761325712531684
See Tweet