Python: feat: add MiniMax provider with M3 as default model#5121
Python: feat: add MiniMax provider with M3 as default model#5121octo-patch wants to merge 3 commits into
Conversation
- Add agent-framework-minimax package with Anthropic-compatible API integration - Support MiniMax-M2.7 and MiniMax-M2.7-highspeed models - Add MINIMAX_API_KEY environment variable support - Add unit and integration tests
- Add MiniMax-M3 to model list and set as default - Keep MiniMax-M2.7 and MiniMax-M2.7-highspeed - Update related tests and documentation
There was a problem hiding this comment.
Pull request overview
Note
Copilot was unable to run its full agentic suite in this review.
Adds a new agent-framework-minimax Python package implementing a MiniMax (Anthropic-compatible) chat client, along with packaging metadata, documentation, and tests.
Changes:
- Introduces
RawMiniMaxClient/MiniMaxClientwith MiniMax-specific defaults and unsupported-parameter filtering. - Adds unit + integration tests and pytest fixtures for the MiniMax package.
- Adds package metadata (
pyproject.toml), README, and licensing/docs files.
Reviewed changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| python/packages/minimax/agent_framework_minimax/_chat_client.py | Implements MiniMax chat clients and settings, including unsupported param filtering and base URL/model defaults. |
| python/packages/minimax/agent_framework_minimax/init.py | Exposes public package API and __version__. |
| python/packages/minimax/tests/test_minimax_client.py | Adds unit/integration coverage for settings, client behavior, and API-call shaping. |
| python/packages/minimax/tests/conftest.py | Adds pytest fixtures for env setup and an Anthropic-client mock. |
| python/packages/minimax/pyproject.toml | Defines package metadata, dependencies, and test/lint tooling configuration. |
| python/packages/minimax/README.md | Documents installation and usage (basic + streaming) and supported models. |
| python/packages/minimax/LICENSE | Adds MIT license for the new package. |
| python/packages/minimax/AGENTS.md | Adds package-level agent/developer notes and usage reference. |
| import os | ||
| from unittest.mock import AsyncMock, MagicMock, patch | ||
|
|
||
| import pytest | ||
| from agent_framework import ( | ||
| ChatMiddlewareLayer, | ||
| FunctionInvocationLayer, | ||
| Message, | ||
| ) | ||
| from agent_framework._tools import normalize_function_invocation_configuration | ||
|
|
||
| USER_MESSAGE = [Message(role="user", contents=["Hello"])] | ||
| from agent_framework.observability import ChatTelemetryLayer |
There was a problem hiding this comment.
Thanks! Fixed in fd69caa — moved ChatTelemetryLayer above the USER_MESSAGE assignment and removed the unused patch import.
| def minimax_unit_test_env(monkeypatch, exclude_list, override_env_param_dict): # type: ignore | ||
| """Fixture to set environment variables for MiniMaxSettings.""" | ||
| if exclude_list is None: | ||
| exclude_list = [] | ||
|
|
||
| if override_env_param_dict is None: | ||
| override_env_param_dict = {} | ||
|
|
There was a problem hiding this comment.
Good catch — removed the dead None branches in fd69caa. The fixtures always return a list/dict so the checks were unreachable.
| MINIMAX_MODELS: Final[list[str]] = [ | ||
| "MiniMax-M3", | ||
| "MiniMax-M2.7", | ||
| "MiniMax-M2.7-highspeed", | ||
| ] |
There was a problem hiding this comment.
Agreed — switched MINIMAX_MODELS to Final[tuple[str, ...]] backed by a tuple literal in fd69caa. Verified in and MINIMAX_MODELS[0] usages in the tests still pass.
|
|
||
| def test_raw_minimax_client_custom_base_url(minimax_unit_test_env: dict[str, str]) -> None: | ||
| """Test that RawMiniMaxClient respects a custom base_url.""" | ||
| custom_url = "https://api.minimaxi.com/anthropic" |
There was a problem hiding this comment.
Replaced with https://example.com/anthropic in fd69caa — clearer placeholder that won’t be confused for a real MiniMax host.
- Move ChatTelemetryLayer import above USER_MESSAGE assignment and drop unused `patch` import (test_minimax_client.py): fixes Ruff E402 and removes dead import. - Drop dead `if exclude_list is None` / `if override_env_param_dict is None` branches in conftest.py — the fixtures always return a list/dict. - Use `Final[tuple[str, ...]]` for MINIMAX_MODELS so the constant is truly immutable (no `.append` foot-gun). - Replace `api.minimaxi.com` placeholder URL in custom base-url test with `example.com/anthropic` to make intent clearer.
Summary
This PR adds a new
agent-framework-minimaxpackage that integrates MiniMax's Anthropic-compatible API into the Microsoft Agent Framework, with MiniMax-M3 as the default model.What's added
python/packages/minimax/agent_framework_minimax/with:MiniMaxClient— fully-featured client (with middleware, telemetry, and function invocation)RawMiniMaxClient— lightweight client without layersMiniMax-M3(default, 512K context, up to 128K output, supports image input),MiniMax-M2.7, andMiniMax-M2.7-highspeedhttps://api.minimax.io/anthropic)betas,top_k,service_tier, etc.)Usage
Environment Variables
MINIMAX_API_KEYMINIMAX_CHAT_MODELMiniMax-M3)MINIMAX_BASE_URLAPI Documentation