Add MiniMax LLM adapter#2166
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (2)
💤 Files with no reviewable changes (2)
Summary by CodeRabbit
WalkthroughAdds MiniMax as a branded LLM adapter, including parameter validation, native model routing, thinking configuration, adapter metadata, JSON schema configuration, exports, and integration tests. ChangesMiniMax LLM adapter
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
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
|
| 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
for more information, see https://pre-commit.ci
|
There was a problem hiding this comment.
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
⛔ Files ignored due to path filters (1)
frontend/public/icons/adapter-icons/MiniMax.pngis excluded by!**/*.png
📒 Files selected for processing (5)
unstract/sdk1/src/unstract/sdk1/adapters/base1.pyunstract/sdk1/src/unstract/sdk1/adapters/llm1/__init__.pyunstract/sdk1/src/unstract/sdk1/adapters/llm1/minimax.pyunstract/sdk1/src/unstract/sdk1/adapters/llm1/static/minimax.jsonunstract/sdk1/tests/test_branded_openai_adapters.py
|
|
||
| api_key: str | ||
| api_base: str = _MINIMAX_API_BASE | ||
| temperature: float | None = 1 |
There was a problem hiding this comment.
🎯 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.
| 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.



What
Why
How
minimax/for native routing.thinking.typerequest field and prevents disabling thinking for MiniMax-M2.7.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)
Database Migrations
Env Config
Relevant Docs
Related Issues or PRs
Dependencies Versions
litellm==1.85.1.Notes on Testing
git diff --checkpassed.Screenshots
Checklist