As far as the LLM call, you are just sending your users text to another function that calls the LLM and reading the response back from the LLM.
If it didn’t create JSON you expected, your traditionally coded API is going to fail.
I keep wondering how are developers using LLMs in production and not doing this simple design pattern