Skip to content

feat: add MiniMax as embedding provider (embo-01, 1536 dims)#287

Open
octo-patch wants to merge 1 commit intozilliztech:masterfrom
octo-patch:feature/add-minimax-embedding-provider
Open

feat: add MiniMax as embedding provider (embo-01, 1536 dims)#287
octo-patch wants to merge 1 commit intozilliztech:masterfrom
octo-patch:feature/add-minimax-embedding-provider

Conversation

@octo-patch
Copy link
Copy Markdown

Summary

Add MiniMax as a new embedding provider, supporting the embo-01 model (1536 dimensions).

MiniMax's embedding API uses a non-OpenAI-compatible format (uses texts array + type field for db/query distinction), so this implements a custom provider using native fetch rather than wrapping the OpenAI SDK.

Changes

  • packages/core/src/embedding/minimax-embedding.tsMiniMaxEmbedding class extending the base Embedding abstract class with full embed(), embedBatch(), detectDimension(), setModel(), setType(), and getSupportedModels() support
  • packages/core/src/embedding/index.ts — Export the new provider
  • packages/mcp/src/embedding.ts — Add MiniMax to the factory pattern and logging
  • packages/mcp/src/config.ts — Add MiniMax to provider union type, config interface, env var reading, help text, and examples
  • packages/mcp/README.md — Add MiniMax configuration section with setup instructions
  • README.md — Add MiniMax to supported embedding providers list
  • docs/getting-started/environment-variables.md — Add MINIMAX_API_KEY and MINIMAX_BASE_URL env vars
  • .env.example — Add MiniMax configuration section

Configuration

EMBEDDING_PROVIDER=MiniMax
MINIMAX_API_KEY=your-minimax-api-key
# Optional: MINIMAX_BASE_URL=https://api.minimax.io/v1
# Optional: EMBEDDING_MODEL=embo-01

Key Design Decisions

  • Custom fetch implementation instead of OpenAI SDK wrapper, because MiniMax's embedding API differs:
    • Request uses texts array (not input)
    • Request includes type field (db for indexing, query for search)
    • Response uses vectors array (not data[].embedding)
  • type parameter supportsetType('db' | 'query') allows switching between storage and query embedding modes, matching MiniMax's API semantics
  • No new dependencies — Uses native fetch (available in Node.js 18+)

Test Plan

  • 19 unit tests covering constructor, embed, embedBatch, detectDimension, setModel, setType, error handling, auth headers, baseURL routing, and text preprocessing
  • 3 integration tests (require MINIMAX_API_KEY env var, auto-skipped without it)
  • TypeScript builds cleanly for both packages/core and packages/mcp
  • All existing provider interfaces and patterns preserved

Add MiniMax embo-01 embedding model (1536 dimensions) as a new embedding
provider alongside OpenAI, VoyageAI, Gemini, and Ollama.

MiniMax uses a non-OpenAI-compatible embedding API with distinct request
format (texts array + type field for db/query distinction), so this
implements a custom provider using native fetch.

Changes:
- packages/core: MiniMaxEmbedding class extending base Embedding
- packages/mcp: Factory pattern, config, and logging integration
- Documentation: README, MCP README, env vars guide, .env.example
- Tests: 19 unit tests + 3 integration tests
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