Skip to content

feat: add MiniMax as alternative LLM provider#13

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

feat: add MiniMax as alternative LLM provider#13
octo-patch wants to merge 1 commit into
taco-group:mainfrom
octo-patch:feature/add-minimax-provider

Conversation

@octo-patch
Copy link
Copy Markdown

Summary

Add MiniMax (MiniMax-M2.7, MiniMax-M2.7-highspeed with 204K context) as a first-class LLM provider for 4KAgent reasoning agent, alongside the existing GPT-4 and Azure OpenAI backends.

Changes

  • New llm/minimax.py: MiniMaxLLM class extending BaseLLM, using MiniMax OpenAI-compatible API at api.minimax.io/v1, with:
    • Temperature clamping to (0.0, 1.0] (MiniMax API constraint)
    • Think-tag stripping for M2.7 models
    • Exponential backoff retry with rate-limit detection
  • config.yml: Added MINIMAX section with API_KEY, MODEL, MAX_TOKENS, TEMPERATURE
  • llm/__init__.py: Export MiniMaxLLM
  • pipeline/the4kagent_pipeline.py: Added llm_provider parameter - supports gpt4 (default), azure, and minimax
  • infer_4kagent.py: Added --llm_provider CLI argument with choices [gpt4, azure, minimax]
  • README.md: Documented MiniMax provider setup and usage with example command
  • tests/: 38 unit tests + 6 integration tests (44 total, all passing)

Usage

# Set MINIMAX API key in config.yml, then:
python infer_4kagent.py \
  --input_dir ./dataset/LQ \
  --output_dir ./outputs/results \
  --profile_name ExpSR_s4_F \
  --llm_provider minimax

Why MiniMax?

  • 204K context window - handles complex multi-step restoration plans
  • OpenAI-compatible API - drop-in replacement, no SDK changes needed
  • Cost-effective - competitive pricing for research workloads

Test plan

  • 38 unit tests covering init, config, request payload, response validation, think-tag stripping, retry logic, format checking
  • 6 integration tests against live MiniMax API (simple query, JSON format check, system message, model variants, pipeline signature)
  • All 44 tests passing
  • Backward compatible - existing GPT-4 and Azure workflows unchanged (default --llm_provider gpt4)

Add MiniMax (MiniMax-M2.7, MiniMax-M2.7-highspeed) as a first-class LLM
provider for the reasoning agent, alongside the existing GPT-4 and Azure
OpenAI backends.

Changes:
- New llm/minimax.py: MiniMaxLLM class extending BaseLLM, using MiniMax's
  OpenAI-compatible API at api.minimax.io, with temperature clamping (0,1]
  and think-tag stripping for M2.7 models
- config.yml: added MINIMAX section with API_KEY, MODEL, MAX_TOKENS, TEMPERATURE
- llm/__init__.py: export MiniMaxLLM
- pipeline/the4kagent_pipeline.py: --llm_provider flag (gpt4/azure/minimax)
  selects the LLM backend at runtime
- infer_4kagent.py: --llm_provider CLI argument
- README.md: documented MiniMax provider usage with example
- tests/: 38 unit tests + 6 integration tests (44 total, all passing)
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