strict mode won't work with nested classes I think (or at least it was broken for me last time I tried it)
Setting it up like that is just another way of doing the same thing, its using llm.structured_predict, which is quite literally converting the pydantic class to an openai tool, and sending that over the api
There are a few ways you can improve this
- write some custom validators for your pydantic class to handle common errors the llm might make
- simplify the structure of your pydantic models
- catch the error, and retry with some error info