Skip to content

Add MiniMax as LLM provider backend#501

Open
octo-patch wants to merge 1 commit intoexplosion:mainfrom
octo-patch:feature/add-minimax-provider
Open

Add MiniMax as LLM provider backend#501
octo-patch wants to merge 1 commit intoexplosion:mainfrom
octo-patch:feature/add-minimax-provider

Conversation

@octo-patch
Copy link
Copy Markdown

Summary

Adds MiniMax as a first-class REST LLM provider backend for spacy-llm, alongside OpenAI, Anthropic, Cohere, and PaLM.

MiniMax offers an OpenAI-compatible chat completions API with models like MiniMax-M2.5 (204K context) and MiniMax-M2.7 (1M context), making it a compelling alternative for structured NLP pipelines.

Changes

  • New provider module spacy_llm/models/rest/minimax/ with model, registry, and init files
  • Registry entry spacy.MiniMax.v1 for seamless spaCy config integration
  • Think-tag stripping for reasoning model output
  • Context length definitions for M2.5, M2.5-highspeed, M2.7, M2.7-highspeed
  • Test suite with unit tests (context lengths, endpoints) and integration tests (API response validation, error handling)
  • Usage example config for text classification with MiniMax
  • README updated to list MiniMax as a supported provider

Usage

Python

import spacy

nlp = spacy.blank("en")
nlp.add_pipe(
    "llm",
    config={
        "model": {
            "@llm_models": "spacy.MiniMax.v1",
            "name": "MiniMax-M2.5",
            "config": {"temperature": 0.0},
        },
        "task": {
            "@llm_tasks": "spacy.TextCat.v2",
            "labels": ["POSITIVE", "NEGATIVE"],
        },
    },
)
doc = nlp("This is a great product!")
print(doc.cats)

Config file

[components.llm.model]
@llm_models = "spacy.MiniMax.v1"
name = "MiniMax-M2.5"
config = {"temperature": 0.0}

Supported Models

Model Context Length
MiniMax-M2.7 1,048,576
MiniMax-M2.7-highspeed 1,048,576
MiniMax-M2.5 204,800
MiniMax-M2.5-highspeed 204,800

Test Plan

  • Unit tests pass: context length definitions, endpoint constants
  • Integration tests pass: API response validation with M2.5 and M2.5-highspeed
  • Error handling tests pass: unsupported model, invalid config
  • Registry integration verified: spacy.MiniMax.v1 resolves correctly
  • Existing tests unaffected

Add MiniMax as a first-class REST LLM provider alongside OpenAI, Anthropic,
Cohere, and PaLM. MiniMax uses an OpenAI-compatible chat completions API
with support for M2.5, M2.5-highspeed, M2.7, and M2.7-highspeed models.

- New `spacy_llm/models/rest/minimax/` provider module (model, registry, init)
- Registry entry `spacy.MiniMax.v1` for spaCy config integration
- Think-tag stripping for reasoning model output
- Temperature clamping and context length definitions
- Test suite with unit and integration tests
- Usage example config for text classification with MiniMax
- README updated to list MiniMax as supported provider
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