I though about fixing it. I created a test case with the Json returned by the Mistral API, in this branch:
https://github.com/ptitjes/koog/tree/p/KG-535-mistral-ai-references
But fixing it would require creating the class hierarchy described in the Mistlal API and that seems to completely differ from what in the OpenAI API (but I don't know it very well).
I was wondering if, given that Mistral publishes an OpenAPI spec, we should not rely on
https://github.com/nomisRev/OpenAPI-kt to generate code at build or any other generator. This would allow us to only have to maintain the glue and be sure to always be up-to-date with the API. Otherwise, we would have to maintain both the object model and the glue.