feat: add OpenAI-compatible prompt expander (MiniMax, OpenAI, etc.)#50
Open
octo-patch wants to merge 1 commit intoPhantom-video:mainfrom
Open
Conversation
Add a third prompt extension backend that works with any OpenAI-compatible API. By default it uses MiniMax (MiniMax-M2.7 model at https://api.minimax.io/v1), but the base URL and model can be overridden for other providers like OpenAI. - New OpenAICompatPromptExpander class in prompt_extend.py (text-only and image+text via base64, think-tag stripping, retries) - New --prompt_extend_method openai_compatible CLI option in generate.py - README section documenting MiniMax / OpenAI-compatible usage - 29 unit tests + 3 live integration tests Co-Authored-By: Octopus <liyuan851277048@icloud.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.
Summary
Adds a third prompt extension backend (
OpenAICompatPromptExpander) that works with any OpenAI-compatible LLM API, complementing the existing DashScope and local Qwen backends.MiniMax-M2.7athttps://api.minimax.io/v1), but the base URL and model can be overridden for OpenAI, DeepSeek, or any other OpenAI-compatible providerextend) and image+text (extend_with_img) prompt extension via base64 encoding--prompt_extend_method openai_compatibleCLI option ingenerate.pyChanges
phantom_wan/utils/prompt_extend.pyOpenAICompatPromptExpanderclassgenerate.pyopenai_compatiblemethod + importREADME.mdtests/test_openai_compat_prompt_expander.pytests/test_openai_compat_integration.pyUsage
Test plan