Skip to content

feat(minimax): add service region selection for the chat base URL - #234

Open
Octopus (octo-patch) wants to merge 1 commit into
microsoft:mainfrom
octo-patch:octo/20260817-parameter-refresh-recvsf37JxeviE
Open

feat(minimax): add service region selection for the chat base URL#234
Octopus (octo-patch) wants to merge 1 commit into
microsoft:mainfrom
octo-patch:octo/20260817-parameter-refresh-recvsf37JxeviE

Conversation

@octo-patch

Copy link
Copy Markdown

Reason: The first-class MiniMax chat backend only shipped and documented the global OpenAI-compatible base URL, so a run against the China-region service had no supported way to select the correct endpoint.

Changes

  • skillopt/model/minimax_backend.py: add a region-to-base-URL table (global_en -> https://api.minimax.io/v1, cn_zh -> https://api.minimaxi.com/v1) with normalize_region() and base_url_for_region() helpers. The region is read from MINIMAX_REGION at import time and can be switched at runtime through configure_minimax_chat(region=...). Unsupported region names raise a ValueError that lists the supported values, and an explicit MINIMAX_BASE_URL / minimax_base_url still overrides the region default. Added get_region() and get_base_url() accessors alongside the existing get_max_tokens().
  • Thread the new model.minimax_region setting through the existing configuration path: configs/_base_/default.yaml, skillopt/config.py, skillopt/model/__init__.py, skillopt/engine/trainer.py, and scripts/eval_only.py, plus a --minimax_region flag in scripts/train.py and scripts/eval_only.py.
  • Document the region setting and both regional base URLs in .env.example, docs/guide/configuration.md (prose and the environment-variable table), and docs/reference/config.md.
  • tests/test_minimax_region.py: new tests covering the region table, blank/alias normalization, rejection of unknown regions, region selection from the environment at import time, the explicit base-URL override, and the runtime configure_minimax_chat(region=...) path including the resulting chat URL.

Behavior is unchanged when no region is configured: the default stays the global endpoint, and an explicitly configured base URL keeps priority.

Checks

  • python3 -m ruff check skillopt/model/minimax_backend.py skillopt/model/__init__.py skillopt/config.py skillopt/engine/trainer.py scripts/train.py scripts/eval_only.py tests/test_minimax_region.py — no new findings; the remaining warnings are identical to the base branch for these files.
  • python3 -m pytest tests/ -q — 1108 passed, 8 skipped.

The minimax_chat backend hardcoded a single global OpenAI-compatible base
URL, so there was no supported way to target the China-region service.

Add a region-to-base-URL table with global_en and cn_zh entries, select the
region from MINIMAX_REGION or the new model.minimax_region setting, and keep
an explicitly configured base URL as the override. Document both regional
base URLs and cover the resolution order with tests.
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.

1 participant