Skip to content

Add MiniMax as LLM provider with thinking model middleware#63

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

Add MiniMax as LLM provider with thinking model middleware#63
octo-patch wants to merge 1 commit intomishushakov:mainfrom
octo-patch:feature/add-minimax-provider

Conversation

@octo-patch
Copy link

Summary

  • Add MiniMax M2.7 as a supported LLM provider using @ai-sdk/openai OpenAI-compatible adapter
  • Include AI SDK wrapLanguageModel middleware that handles two MiniMax M2.7 quirks:
    • Downgrades json_schema response format to json_object (MiniMax doesn't support json_schema), embedding the schema in the system prompt
    • Strips <think>...</think> tags from both generate and stream responses (M2.7 is a thinking model)
  • Add MiniMax to README provider list with setup instructions
  • Add examples/minimax.ts with complete working example

Test plan

  • 6 unit tests for provider configuration and LLMScraper initialization (tests/minimax.test.ts)
  • 3 integration tests for scraping, streaming, and markdown format (tests/minimax-integration.test.ts) — requires MINIMAX_API_KEY env var, auto-skipped otherwise
  • All 9 tests passing

Files changed

File Description
README.md Add MiniMax to features list and provider setup section
examples/minimax.ts Full example with middleware for thinking model support
tests/minimax.test.ts 6 unit tests for provider config and scraper init
tests/minimax-integration.test.ts 3 integration tests (scraping, streaming, markdown)

MiniMax M2.7 is a thinking model that wraps responses with <think> tags and
doesn't support json_schema response format. This adds AI SDK middleware to
handle both issues: downgrading json_schema to json_object with schema
instructions embedded in the system prompt, and stripping think tags from
both generate and stream responses.

- Add MiniMax to README provider list with setup instructions
- Add examples/minimax.ts with full middleware example
- Add 6 unit tests for provider configuration and LLMScraper initialization
- Add 3 integration tests for scraping, streaming, and markdown format

Co-Authored-By: Octopus <liyuan851277048@icloud.com>
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