Add MiniMax provider adapter for LLM Protocol V1 - #51
Open
octo-patch wants to merge 2 commits into
Open
Conversation
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.
Reason: Add a MiniMax provider adapter for the vendor-neutral LLM Protocol V1 so the SDK supports MiniMax-M3 / MiniMax-M2.7 against the global and China endpoints.
Summary
The SDK exposes a concrete adapter contract (
BaseLLMAdapter/LLMProtocolV1) for completions, streaming, supported models, context limits, and tool capabilities, but shipped no MiniMax adapter. This change adds a concreteMiniMaxAdapterthat implements the contract against MiniMax's OpenAI-compatible chat completions surface.Changes
corpus_sdk/llm/providers/__init__.py: new package exportingMiniMaxAdapter,MINIMAX_MODELS, andMINIMAX_REGIONS.corpus_sdk/llm/providers/minimax.py: the adapter implementation._do_capabilities,_do_complete,_do_stream,_do_count_tokens, and_do_healthfromBaseLLMAdapter.MINIMAX_MODELS) advertisesMiniMax-M3(1,000,000-token context; text/image/video input; adaptive/disabled thinking) andMiniMax-M2.7(204,800-token context; text input; always-on thinking), with per-model pricing.MINIMAX_REGIONS) coversglobal_en(https://api.minimax.io/v1) andcn_zh(https://api.minimaxi.com/v1), including the Anthropic-compatible base URLs and docs roots.urllibstack (wrapped withasyncio.to_thread) so the package keeps zero runtime dependencies.transportcallable lets callers and tests short-circuit network I/O.BadRequest,AuthError,ResourceExhausted,Unavailable,TransientNetwork).tests/llm/test_minimax_adapter.py: 22 unit tests using a fake transport (no network) covering capabilities, regional endpoint selection, completion parsing, tool-call parsing, streaming SSE parsing, token counting, health, error mapping, and protocol conformance.Checks
pytest tests/llm/test_minimax_adapter.py— 22 passed (Python 3.12, pytest 8.4.2, pytest-asyncio 0.23.8).pytest tests/llm/test_capabilities_shape.py tests/llm/test_complete_basic.py— 24 passed (existing conformance tests unaffected).black --line-length 100 --skip-string-normalizationapplied to the new files.