feat(adapters): add MiniMax regional (CN) endpoint selection - #1576
feat(adapters): add MiniMax regional (CN) endpoint selection#1576octo-patch wants to merge 2 commits into
Conversation
Signed-off-by: octo-patch <266937838+octo-patch@users.noreply.github.com>
|
Caution The consumer version of Gemini Code Assist on GitHub has been sunset. All code review activity has officially ceased. |
|
Thanks for adding MiniMax regional (CN) endpoint selection — appreciated. Good news: the CI failure here isn't your code. Your changes passed lint, formatting, and type-checks cleanly. The only failing step is That was a pre-existing TOML block-ordering bug in To get a green build, please just rebase / merge the latest git fetch upstream # or 'origin' if you branched from the main repo
git rebase upstream/main
git push --force-with-leaseThat should be all it takes — CI should go green afterward. Please don't be discouraged by the red ❌; your actual contribution is in good shape. Thanks for your patience, and looking forward to getting this merged! 🐝 |
|
Updated the branch with the latest |
Reason: The MiniMax adapters only defined the global endpoint, so CN users had to discover and type the regional base URL by hand; this adds a first-class global/CN region selection path.
What changed
MiniMax serves the same OpenAI-compatible API from two regional gateways:
https://api.minimax.io/v1(unchanged default)https://api.minimaxi.com/v1Both the Python and TypeScript adapters previously hard-coded only the global base URL. This PR adds an explicit region selection path in both languages while preserving the existing default behavior.
Python (
beeai_framework/adapters/minimax)MINIMAX_API_BASE_CNand aresolve_minimax_base_url()helper backed by aMINIMAX_REGION_BASE_URLSmap (global/global_enandcn/cn_zh).MiniMaxChatModelaccepts aregionargument, falling back to theMINIMAX_API_REGIONenvironment variable.base_urlargument ->MINIMAX_API_BASEenv -> region endpoint -> global default.TypeScript (
typescript/src/adapters/minimax)MINIMAX_API_BASE,MINIMAX_API_BASE_CN,MINIMAX_REGION_BASE_URLS, theMiniMaxRegiontype, andresolveMiniMaxBaseURL().MiniMaxClientSettingsgains an optionalregion; the client resolves the base URL with the same precedence and stripsregionbefore forwarding settings to the underlying OpenAI-compatible provider.Docs & examples
MINIMAX_API_REGIONand the region option in the backend module docs.Tests
Checks
ruff check(clean),ruff format --check(clean),pytest tests/adapters/minimax/test_minimax_chat.py-> 27 passed.tsc --noEmit(clean),vitest run tests/e2e/adapters/minimax.test.ts-> 16 passed,prettier --check(clean),eslint(clean).