Skip to content

Add MiniMax provider adapter for LLM Protocol V1 - #51

Open
octo-patch wants to merge 2 commits into
Corpus-OS:mainfrom
octo-patch:octo/20260729-provider-add-recvq8z1dV64Lj
Open

Add MiniMax provider adapter for LLM Protocol V1#51
octo-patch wants to merge 2 commits into
Corpus-OS:mainfrom
octo-patch:octo/20260729-provider-add-recvq8z1dV64Lj

Conversation

@octo-patch

Copy link
Copy Markdown

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 concrete MiniMaxAdapter that implements the contract against MiniMax's OpenAI-compatible chat completions surface.

Changes

  • corpus_sdk/llm/providers/__init__.py: new package exporting MiniMaxAdapter, MINIMAX_MODELS, and MINIMAX_REGIONS.
  • corpus_sdk/llm/providers/minimax.py: the adapter implementation.
    • Implements _do_capabilities, _do_complete, _do_stream, _do_count_tokens, and _do_health from BaseLLMAdapter.
    • Model registry (MINIMAX_MODELS) advertises MiniMax-M3 (1,000,000-token context; text/image/video input; adaptive/disabled thinking) and MiniMax-M2.7 (204,800-token context; text input; always-on thinking), with per-model pricing.
    • Regional endpoint configuration (MINIMAX_REGIONS) covers global_en (https://api.minimax.io/v1) and cn_zh (https://api.minimaxi.com/v1), including the Anthropic-compatible base URLs and docs roots.
    • Uses only the standard-library urllib stack (wrapped with asyncio.to_thread) so the package keeps zero runtime dependencies.
    • Pluggable transport callable lets callers and tests short-circuit network I/O.
    • Maps upstream HTTP statuses onto the normalized error taxonomy (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-normalization applied to the new files.

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