feat: add MiniMax provider support for prompt refinement#916
Open
octo-patch wants to merge 1 commit intohpcaitech:mainfrom
Open
feat: add MiniMax provider support for prompt refinement#916octo-patch wants to merge 1 commit intohpcaitech:mainfrom
octo-patch wants to merge 1 commit intohpcaitech:mainfrom
Conversation
- Add MiniMax-M2.7 and MiniMax-M2.7-highspeed model support in prompt_refine.py using the OpenAI-compatible API - Add _get_client() to route between OpenAI and MiniMax based on model name - Add has_minimax_key() utility to check MINIMAX_API_KEY availability - Add refine_prompts_by_minimax() convenience wrapper - Support PROMPT_MODEL env var to set default refinement model - Support MINIMAX_BASE_URL env var (defaults to https://api.minimax.io/v1) - Strip <think> chain-of-thought blocks from MiniMax responses - Allocate extra token budget for MiniMax thinking blocks - Add 18 unit tests covering all new functionality
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.
Summary
This PR adds MiniMax as an alternative LLM provider for Open-Sora's prompt refinement step, alongside the existing OpenAI/GPT-4o integration.
Changes
opensora/utils/prompt_refine.py_get_client(model)— routes to MiniMax API (OpenAI-compatible) whenmodelstarts with"MiniMax", otherwise uses OpenAIhas_minimax_key()— checks whetherMINIMAX_API_KEYis set_strip_think_tags(text)— strips<think>…</think>chain-of-thought blocks emitted by MiniMax reasoning models_extra_tokens(model)— allocates 500 extra output tokens for MiniMax models to accommodate thinking tokensrefine_prompts_by_minimax()— convenience wrapper that defaults toMiniMax-M2.7refine_prompt()andrefine_prompts()now accept an optionalmodelparameter (defaults toPROMPT_MODELenv var, falls back to"gpt-4o")tests/test_minimax_prompt_refine.py— 18 unit tests covering routing, API key validation, model selection, temperature constraints, think-tag stripping, and therefine_prompts_by_minimax()wrapperSupported models
MiniMax-M2.7MiniMax-M2.7-highspeedUsage
Or programmatically:
API references