Skip to content

Add native structured output support to MiniMax#6227

Open
justinhsu1477 wants to merge 1 commit into
spring-projects:mainfrom
justinhsu1477:minimax-structured-output
Open

Add native structured output support to MiniMax#6227
justinhsu1477 wants to merge 1 commit into
spring-projects:mainfrom
justinhsu1477:minimax-structured-output

Conversation

@justinhsu1477
Copy link
Copy Markdown

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

  • MiniMaxChatOptions now implements StructuredOutputChatOptions (getOutputSchema() + builder outputSchema(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-based BeanOutputConverter.
  • MiniMaxApi.ChatCompletionRequest.ResponseFormat gains a nested JsonSchema(name, schema) and a backward-compatible single-arg constructor, so existing text / json_object usage is unchanged.
  • Reference docs list MiniMax (MiniMax-Text-01) under "Supported Models for Native Structured Output".

Notes

  • Native json_schema output is currently only supported by the MiniMax-Text-01 model, per the MiniMax API docs.
  • The change is additive; the existing responseFormat(...) builder option keeps working.

Testing

  • New unit tests for the options round-trip (MiniMaxChatOptionsTests) and the request wiring (ChatCompletionRequestTests).
  • ./mvnw -pl models/spring-ai-minimax test → 27 tests pass (3 IT skipped without API keys).
  • spring-javaformat:validate and checkstyle (-Pcheckstyle-check) both clean.

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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add native structured output support for MiniMax

1 participant