Hey! I am coming back to <this> and trying to fix ...
# koog-agentic-framework
d
Hey! I am coming back to this and trying to fix https://github.com/ptitjes/koog/tree/p/KG-535-mistral-ai-references. However, currently,
MistralAILLMClient
extends
AbstractOpenAILLMClientMistralAIChatCompletionResponse, MistralAIChatCompletionStreamResponse
which forces the messages to be of type
OpenAIMessage
(a sealed interface). This cannot work for MistralAI because in order to handle the Mistral-specific content parts (reference, document, thinking) we need to replace the whole type hierarchy to specific types (
MistralAIChoice
,
MistralAIMessage
,
MistralAIContent
and
MistralAIContentPart
). So this will require to completely remove the base
AbstractOpenAILLMClient
base class and implement all the converters specifically to Mistral. So I reiterate my initial question: given that Mistral publishes an OpenAPI spec, should we not rely on an OpenAPI data classes generation hierarchy (like e.g. https://github.com/nomisRev/OpenAPI-kt) to generate the Json message data classes at build. This would allow us to only have to maintain the glue (the converters to and from Koog's message model) 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. [Current WIP branch: https://github.com/ptitjes/koog/tree/p/KG-535-mistral-ai-references] @Vadim Briliantov WDYT? PS: for at least 5 months, the MistralAI LLM client is unusable because the API will regularly return "references" which causes deserialization errors in the client. Also note that it is not only "Mistral Medium", as stated in KG-535, but all the models of Mistral (Mistral Large/Medium/Small, and also Ministral 3B, 8B and 14B...).
Any help on this please?
👀 1
a
Hi Didier! Thanks for the your work kodee loving Right now a part of our team is at the Spring IO conference, so I believe they might be a bit less available than usual. However, I noted your request and will specifically ask the team to take a look at it when they can. Thank you for understanding!
p
Hi Didier Mistral currently extends AbstractOpenAI precisely because Mistral declares compatibility with the openai api. You are absolutely right that Mistral may introduce its own fields, just like other openai-compatible clients such as deepseek or openrouter. That is why the current design allows message models to be extended. It may be worth investigating the current limitations or weak points in AbstractOpenAIClient and improving them there As for generating models from OpenAPI, I agree that it is a good idea in principle, but unfortunately it is not very practical at the moment. The main issue is that there is no sufficiently mature and stable solution for Kotlin. For example, openapi-generator is still lagging behind Kotlin support and produces its own custom types such as Base64ByteArray. On top of that, even small changes in the specification followed by regeneration can easily introduce breaking changes The project you shared also looks more experimental than production-ready at this stage. A 0.0.8 version and no commits in the last six months don't give enough confidence to adopt it
thank you color 1
👍 1