Repository navigation
feat: add MiniMax-M3 provider support for query expansion - #96
octo-patch wants to merge 2 commits into
Conversation
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
|
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. 🙏 |
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 aMINIMAX_API_KEYto use MiniMax-M3 via MiniMax's Anthropic-compatible API instead — no other changes to their workflow required.Why M3
MiniMax-M3is 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 — whenMINIMAX_API_KEYis set andANTHROPIC_API_KEYis not, uses MiniMax's Anthropic-compatible endpoint (https://api.minimax.io/anthropic) withMiniMax-M3.src/core/config.ts: Addedminimax_api_key?: stringtoGBrainConfigand readsMINIMAX_API_KEYfrom env vars.test/expansion.test.ts: Unit tests for provider selection logic (all pass withbun test).Provider precedence
ANTHROPIC_API_KEYonlyMINIMAX_API_KEYonlyTesting
Integration tested with real MiniMax API — query expansion works correctly.
API reference