Skip to content

Add MiniMax LLM adapter#2166

Open
octo-patch wants to merge 2 commits into
Zipstack:mainfrom
octo-patch:octo/20260712-provider-add-recvozNE1fKYRA-clean
Open

Add MiniMax LLM adapter#2166
octo-patch wants to merge 2 commits into
Zipstack:mainfrom
octo-patch:octo/20260712-provider-add-recvozNE1fKYRA-clean

Conversation

@octo-patch

Copy link
Copy Markdown

What

  • Adds a branded MiniMax LLM adapter for the compatible chat API.
  • Supports MiniMax-M3 and MiniMax-M2.7 with native routing, regional endpoint configuration, thinking controls, an official icon, and focused tests.

Why

  • MiniMax users need a first-class adapter with correct request transformation and usage tracking.

How

  • Registers the adapter and prefixes model IDs with minimax/ for native routing.
  • Defaults to the global API endpoint while documenting the China endpoint as an override.
  • Maps the UI thinking toggle to the official thinking.type request field and prevents disabling thinking for MiniMax-M2.7.
  • Uses the official MiniMax icon asset.

Can this PR break any existing features. If yes, please list possible items. If no, please explain why. (PS: Admins do not merge the PR without this section filled)

  • No existing adapter behavior is changed. The implementation is isolated to the new MiniMax adapter, its registration, schema, icon, and tests.

Database Migrations

  • None.

Env Config

  • None. Users provide their API key in the adapter configuration and may override the regional API base.

Relevant Docs

Related Issues or PRs

  • None.

Dependencies Versions

  • No dependency changes. The implementation uses the repository's pinned litellm==1.85.1.

Notes on Testing

  • Focused adapter tests: 19 passed.
  • Ruff lint and format checks passed for all changed Python files.
  • JSON parsing, Python compilation, secret scanning, URL review, and git diff --check passed.

Screenshots

  • Not applicable.

Checklist

@coderabbitai

coderabbitai Bot commented Jul 12, 2026

Copy link
Copy Markdown
Contributor

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: d088a9c8-6ff8-4b7a-9e25-52e22b21a064

📥 Commits

Reviewing files that changed from the base of the PR and between 1e10ef8 and 7c04f32.

📒 Files selected for processing (2)
  • unstract/sdk1/src/unstract/sdk1/adapters/base1.py
  • unstract/sdk1/tests/test_branded_openai_adapters.py
💤 Files with no reviewable changes (2)
  • unstract/sdk1/tests/test_branded_openai_adapters.py
  • unstract/sdk1/src/unstract/sdk1/adapters/base1.py

Summary by CodeRabbit

  • New Features

    • Added MiniMax as a supported language model provider with a dedicated adapter.
    • Included MiniMax-specific configuration (API base, model naming, retries/timeouts, token limits, and thinking mode) and JSON schema defaults.
    • Enabled native routing and token-cost/usage tracking for MiniMax requests.
  • Bug Fixes

    • Now prevents disabling “thinking” for MiniMax M2 models where it’s not supported.
  • Tests

    • Added MiniMax coverage for adapter registration, parameter validation/idempotency, thinking mapping, native routing/costs, and schema behavior.

Walkthrough

Adds MiniMax as a branded LLM adapter, including parameter validation, native model routing, thinking configuration, adapter metadata, JSON schema configuration, exports, and integration tests.

Changes

MiniMax LLM adapter

Layer / File(s) Summary
MiniMax parameter validation
unstract/sdk1/src/unstract/sdk1/adapters/base1.py
Adds MiniMax defaults, minimax/ model normalization, thinking translation and validation, and restrictions for M2 models.
Adapter registration and schema
unstract/sdk1/src/unstract/sdk1/adapters/llm1/minimax.py, unstract/sdk1/src/unstract/sdk1/adapters/llm1/__init__.py, unstract/sdk1/src/unstract/sdk1/adapters/llm1/static/minimax.json
Defines MiniMax adapter metadata, exports the adapter, and adds its configuration schema.
MiniMax integration tests
unstract/sdk1/tests/test_branded_openai_adapters.py
Tests registration, defaults, schema properties, native routing, usage costs, thinking translation, and M2 validation.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Sequence Diagram(s)

sequenceDiagram
  participant AdapterConfig
  participant MiniMaxLLMParameters
  participant LiteLLM
  AdapterConfig->>MiniMaxLLMParameters: submit model and thinking settings
  MiniMaxLLMParameters->>MiniMaxLLMParameters: normalize model and validate thinking
  MiniMaxLLMParameters->>LiteLLM: provide minimax-prefixed model and API parameters
Loading
🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly names the new MiniMax LLM adapter and matches the main change.
Description check ✅ Passed The description follows the template and fills all required sections with relevant details.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@octo-patch octo-patch mentioned this pull request Jul 12, 2026
1 task
@greptile-apps

greptile-apps Bot commented Jul 12, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

This PR adds a first-class MiniMax LLM adapter. The main changes are:

  • Native routing for MiniMax-M3 and MiniMax-M2.7.
  • Global and China endpoint configuration.
  • Model-aware thinking controls.
  • Adapter registration, schema, icon, and focused tests.

Confidence Score: 5/5

This looks safe to merge.

  • No blocking issues found in the changed code.
  • Adapter registration and schema resolution match existing adapter patterns.
  • Model prefixing and thinking settings remain stable when request parameters are validated again.

Important Files Changed

Filename Overview
unstract/sdk1/src/unstract/sdk1/adapters/base1.py Adds MiniMax request validation, model routing, endpoint defaults, and thinking controls.
unstract/sdk1/src/unstract/sdk1/adapters/llm1/init.py Exports the MiniMax adapter through the LLM adapter package.
unstract/sdk1/src/unstract/sdk1/adapters/llm1/minimax.py Defines MiniMax adapter metadata, identity, provider, schema, and icon bindings.
unstract/sdk1/src/unstract/sdk1/adapters/llm1/static/minimax.json Defines MiniMax model, endpoint, request limit, retry, timeout, and thinking settings.
unstract/sdk1/tests/test_branded_openai_adapters.py Covers registration, routing, usage cost, thinking behavior, endpoints, and schema exposure.

Reviews (2): Last reviewed commit: "[pre-commit.ci] auto fixes from pre-comm..." | Re-trigger Greptile

@sonarqubecloud

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@unstract/sdk1/src/unstract/sdk1/adapters/base1.py`:
- Line 539: Update the MiniMax subclass’s temperature declaration to retain the
base class’s Pydantic Field validation, including default 0.1 and ge=0/le=2
constraints, rather than redeclaring it as an unconstrained scalar. Preserve the
existing nullable float type.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 288ec4d5-fe33-44a6-b15c-b218f17ee909

📥 Commits

Reviewing files that changed from the base of the PR and between 09b6834 and 1e10ef8.

⛔ Files ignored due to path filters (1)
  • frontend/public/icons/adapter-icons/MiniMax.png is excluded by !**/*.png
📒 Files selected for processing (5)
  • unstract/sdk1/src/unstract/sdk1/adapters/base1.py
  • unstract/sdk1/src/unstract/sdk1/adapters/llm1/__init__.py
  • unstract/sdk1/src/unstract/sdk1/adapters/llm1/minimax.py
  • unstract/sdk1/src/unstract/sdk1/adapters/llm1/static/minimax.json
  • unstract/sdk1/tests/test_branded_openai_adapters.py


api_key: str
api_base: str = _MINIMAX_API_BASE
temperature: float | None = 1

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

Temperature field override drops validation constraints from the base class.

BaseChatCompletionParameters defines temperature: float | None = Field(default=0.1, ge=0, le=2), but the MiniMax subclass redeclares it as temperature: float | None = 1 without Field(...). In Pydantic v2, redeclaring a field fully replaces the parent definition, so the ge=0, le=2 bounds are lost. Invalid temperatures (e.g., -1, 5) would pass validation and be sent to the API.

💚 Proposed fix to preserve constraints
-    temperature: float | None = 1
+    temperature: float | None = Field(default=1, ge=0, le=2)
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
temperature: float | None = 1
temperature: float | None = Field(default=1, ge=0, le=2)
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@unstract/sdk1/src/unstract/sdk1/adapters/base1.py` at line 539, Update the
MiniMax subclass’s temperature declaration to retain the base class’s Pydantic
Field validation, including default 0.1 and ge=0/le=2 constraints, rather than
redeclaring it as an unconstrained scalar. Preserve the existing nullable float
type.

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