Skip to content

feat: add MiniMax-M3 provider support for query expansion - #96

Closed
octo-patch wants to merge 2 commits into
garrytan:masterfrom
octo-patch:feature/add-minimax-provider
Closed

octo-patch wants to merge 2 commits into
garrytan:masterfrom
octo-patch:feature/add-minimax-provider

Conversation

@octo-patch

@octo-patch octo-patch commented Apr 13, 2026 •

Copy link
Copy Markdown

Summary

This PR adds MiniMax as an alternative LLM provider for the hybrid search query expansion feature.

Currently, query expansion (src/core/search/expansion.ts) is hardcoded to use Claude Haiku via the Anthropic API. This PR allows users who have a MINIMAX_API_KEY to use MiniMax-M3 via MiniMax's Anthropic-compatible API instead — no other changes to their workflow required.

Why M3

MiniMax-M3 is the latest model — 512K context window, up to 128K max output, and image input support. M3 replaces M2.7 as the default for new MiniMax query expansion calls.

Changes

  • src/core/search/expansion.ts: Provider selection logic — when MINIMAX_API_KEY is set and ANTHROPIC_API_KEY is not, uses MiniMax's Anthropic-compatible endpoint (https://api.minimax.io/anthropic) with MiniMax-M3.
  • src/core/config.ts: Added minimax_api_key?: string to GBrainConfig and reads MINIMAX_API_KEY from env vars.
  • test/expansion.test.ts: Unit tests for provider selection logic (all pass with bun test).

Provider precedence

Env vars set Provider used
ANTHROPIC_API_KEY only Claude Haiku (unchanged)
MINIMAX_API_KEY only MiniMax-M3
Both keys set Anthropic (backward compatible)
Neither key set Anthropic SDK default

Testing

bun test test/expansion.test.ts  # 7 tests pass
bun test                          # full suite: no new failures

Integration tested with real MiniMax API — query expansion works correctly.

API reference

octo-patch and others added 2 commits April 13, 2026 18:51
Allow users to use MiniMax as an alternative to Anthropic for the
hybrid search query expansion feature. When MINIMAX_API_KEY is set
and ANTHROPIC_API_KEY is not, the expansion module uses MiniMax-M2.7
via MiniMax's Anthropic-compatible API.

- Add MINIMAX_API_KEY / MINIMAX_BASE_URL env var support in expansion.ts
- Add minimax_api_key field to GBrainConfig
- Add unit tests for provider selection logic
- Add integration test (passes with real MiniMax API)

Provider preference: Anthropic takes priority when both keys are set,
so existing users are not affected.
- Switch MINIMAX_MODEL from MiniMax-M2.7 to MiniMax-M3
- M3 has 512K context, 128K max output, image input support
- Update related unit tests
@octo-patch octo-patch changed the title feat: add MiniMax provider support for query expansion feat: add MiniMax-M3 provider support for query expansion Jun 5, 2026
@garrytan

garrytan commented Jun 8, 2026

Copy link
Copy Markdown
Owner

Thanks for this contribution — and apologies for the slow triage. We did a full pass over the entire PR backlog. gbrain has moved fast, and the maintainer's larger "cathedral" rewrites have superseded a big share of community PRs: the AI gateway + recipes + user_provided_models system replaced almost all individual provider PRs; #1805 fixed the whole Postgres module-singleton class; #1542 unified the type taxonomy; #1657 the retrieval path; #1802 the doctor; and so on.

We're closing this one in that cleanup — either the fix already landed on master, it duplicates another PR or merged change, or it's outside the current merge bar. Where a closed PR carried a genuinely valuable idea, we've recorded it in docs/designs/COMMUNITY_IDEAS.md so nothing good is lost (a few may graduate into TODOs).

Please don't read the close as a judgment of the work — thank you for contributing. If you believe the underlying issue is still live on the latest master, reopen with a quick note and we'll take another look. 🙏

@garrytan garrytan closed this Jun 8, 2026
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.

2 participants