I am testing some things with the AI SDK using GPT-4o. But a part of the docs kind of confuse me a bit. This is it (https://sdk.vercel.ai/docs/ai-sdk-core/generating-structured-data#generating-structured-data):
"The generateObject function uses Zod schemas to specify the shape of the data that you want, and the AI model will generate data that conforms to that structure. The schema is also used to validate the generated data, ensuring type safety and correctness."
Is there any real chance that the generateObject function just fails, because the returned structure from the model response does not match? I am mostly thinking of the responding model just hallucinating another structure than the one given, and therefore the Zod validation fails? Or am I guaranteed that the structure always matches what I expect?