feat: add MiniMax as alternative LLM provider#26
Open
octo-patch wants to merge 1 commit intojamwithai:mainfrom
Open
feat: add MiniMax as alternative LLM provider#26octo-patch wants to merge 1 commit intojamwithai:mainfrom
octo-patch wants to merge 1 commit intojamwithai:mainfrom
Conversation
Add MiniMax cloud LLM as a drop-in alternative to Ollama, configurable via LLM_PROVIDER env var. MiniMax uses OpenAI-compatible API and supports both standard and agentic RAG pipelines. - Add MiniMaxClient with OpenAI-compatible API (MiniMax-M2.7, M2.7-highspeed) - Add LLM_PROVIDER config for switching between ollama/minimax - Add llm_factory.py for provider-agnostic client creation - Refactor agent nodes to use llm_client instead of ollama_client - Add temperature clamping and think-tag stripping for MiniMax - Add langchain-openai dependency for ChatOpenAI integration - Add get_langchain_model() to OllamaClient for agent node compatibility - Add 30 unit tests and 3 integration tests - Update .env.example, README, and health check with MiniMax support Co-Authored-By: Octopus <liyuan851277048@icloud.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Add MiniMax as an alternative cloud LLM provider alongside Ollama, configurable via the
LLM_PROVIDERenvironment variable.Changes
src/services/minimax/client.py): Full-featured client using MiniMax's OpenAI-compatible API with temperature clamping, think-tag stripping, streaming support, and RAG answer generationsrc/services/llm_factory.py): Provider-agnostic factory that returns OllamaClient or MiniMaxClient based onLLM_PROVIDERsettingllm_clientinstead ofollama_client, enabling seamless provider switching across guardrail, grading, rewriting, and answer generation nodesget_langchain_model()method to OllamaClient for consistency with MiniMaxClientLLM_PROVIDER,MINIMAX_API_KEY,MINIMAX_MODEL,MINIMAX_BASE_URLenv vars.env.examplewith MiniMax configurationSupported Models
MiniMax-M2.7MiniMax-M2.7-highspeedUsage
# Switch to MiniMax (in .env) LLM_PROVIDER=minimax MINIMAX_API_KEY=your_key_hereNo code changes needed - the existing RAG pipeline, agentic workflows, and Telegram bot all work with MiniMax out of the box.
Files Changed (25 files, +1010/-45)
New files:
src/services/minimax/client.py- MiniMax client implementationsrc/services/minimax/factory.py- MiniMax client factorysrc/services/llm_factory.py- Provider-agnostic LLM factorytests/unit/services/minimax/test_minimax_client.py- 25 unit teststests/unit/services/test_llm_factory.py- 5 unit teststests/integration/test_minimax_integration.py- 3 integration testsModified files:
API Reference
Test Plan
LLM_PROVIDER=ollama)docker compose upand test RAG endpoints