Add native structured output support to MiniMax#6227
Open
justinhsu1477 wants to merge 1 commit into
Open
Conversation
Implement StructuredOutputChatOptions in MiniMaxChatOptions and extend the MiniMax ResponseFormat with the `json_schema` type so the MiniMax chat model can take part in Spring AI's native structured output path (AdvisorParams.ENABLE_NATIVE_STRUCTURED_OUTPUT and ChatClient#entity) instead of relying solely on prompt-based BeanOutputConverter. - Extend MiniMaxApi.ChatCompletionRequest.ResponseFormat with a nested JsonSchema (name + schema) and keep a backward-compatible single-arg constructor for the existing `text`/`json_object` usage. - Implement getOutputSchema() and the builder outputSchema(String) on MiniMaxChatOptions. - List MiniMax (MiniMax-Text-01) under "Supported Models for Native Structured Output" in the reference docs. - Add unit tests covering the options round-trip and the request wiring. Native `json_schema` output is currently only supported by the MiniMax-Text-01 model. Signed-off-by: Justin Hsu <justin80605@gmail.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes gh-6226
Implements native structured output for MiniMax, bringing it in line with the other chat model integrations (OpenAI, Anthropic, Google GenAI, Mistral, Ollama, Bedrock Converse).
What
MiniMaxChatOptionsnow implementsStructuredOutputChatOptions(getOutputSchema()+ builderoutputSchema(String)), so MiniMax can take part in Spring AI's native structured output path (AdvisorParams.ENABLE_NATIVE_STRUCTURED_OUTPUT/ChatClient#entity) instead of relying solely on prompt-basedBeanOutputConverter.MiniMaxApi.ChatCompletionRequest.ResponseFormatgains a nestedJsonSchema(name, schema)and a backward-compatible single-arg constructor, so existingtext/json_objectusage is unchanged.MiniMax-Text-01) under "Supported Models for Native Structured Output".Notes
json_schemaoutput is currently only supported by theMiniMax-Text-01model, per the MiniMax API docs.responseFormat(...)builder option keeps working.Testing
MiniMaxChatOptionsTests) and the request wiring (ChatCompletionRequestTests)../mvnw -pl models/spring-ai-minimax test→ 27 tests pass (3 IT skipped without API keys).spring-javaformat:validateand checkstyle (-Pcheckstyle-check) both clean.