-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Open
Description
Expected Behavior
Users should be able to use Spring AI's native structured output integration with Mistral AI:
ChatClient.create(mistralChatModel)
.prompt("Generate a movie review")
.advisors(AdvisorParams.ENABLE_NATIVE_STRUCTURED_OUTPUT)
.call()
.entity(MovieReview.class);This requires MistralAiChatOptions to implement StructuredOutputChatOptions, similar to OpenAiChatOptions.
Current Behavior
MistralAiChatOptions only implements ToolCallingChatOptions:
public class MistralAiChatOptions implements ToolCallingChatOptions { }This prevents native structured output integration. When using .entity(Class), the check in ChatModelCallAdvisor fails:
chatClientRequest.prompt().getOptions() instanceof StructuredOutputChatOptions
// → false for MistralAI, falls back to prompt-based instructionsUsers must manually generate and inject the JSON schema as a workaround.
Context
- Mistral AI's API supports structured outputs with JSON schema