Site icon API Security Blog

Function Calling in Java and Spring AI using the latest Mistral AI API

Mistral AI, a leading developer of open-source large language models, unveiled the addition of Function Calling support to its cutting-edge models. Function Calling is a feature that facilitates the integration of LLM with external tools and APIs. It enables the language model to request the execution of client-side functions, allowing it to access necessary run-time information or perform tasks dynamically. Here, I'll discuss using Mistral AI's new Function Calling features with Java and particularly with Spring AI. If you're not keen on delving into the details of the low-level Java client and want to make the most of your investment, feel free to skip the next paragraph and jump straight into the Function Calling with Spring AI. 1. Function Calling in Java If you want to test out the latest Mistral AI features using Java and Spring AI, you will find that Mistral doesn't support Java clients and hasn't released the Function Calling API yet. Consequently, I had to resort exploring their JavaScript/Python clients to to figure it out. Below, is a class diagram illustrating the various components of the API and their interconnections. Those familiar with the OpenAI API will notice that Mistral AI's new API is almost the same, with just a few small differences. However, there's one important limitation: At the time of writing this blog, Mistral AI does not support parallel function calls, setting it apart from the latest LLM models offered by OpenAI, Azure OpenAI, and Vertex…Read More

Exit mobile version