-
Notifications
You must be signed in to change notification settings - Fork 466
feat: add MiniMax provider support (Chat + TTS) #82
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -99,7 +99,7 @@ def test_asr_env_override(monkeypatch): | |||||||||||||||
| def test_llm_registry_includes_off(): | ||||||||||||||||
| rows = llm_backend.list_backends() | ||||||||||||||||
| ids = {r["id"] for r in rows} | ||||||||||||||||
| assert ids == {"openai-compat", "off"} | ||||||||||||||||
| assert {"openai-compat", "off", "minimax"}.issubset(ids) | ||||||||||||||||
|
|
||||||||||||||||
|
|
||||||||||||||||
| def test_llm_off_chat_raises_actionable(monkeypatch): | ||||||||||||||||
|
|
@@ -131,3 +131,83 @@ def test_llm_auto_selects_openai_compat_when_configured(monkeypatch): | |||||||||||||||
| except ImportError: | ||||||||||||||||
| pytest.skip("openai package not available in this environment") | ||||||||||||||||
| assert llm_backend.active_backend_id() == "openai-compat" | ||||||||||||||||
|
|
||||||||||||||||
|
|
||||||||||||||||
| # ── MiniMax (minimax) ────────────────────────────────────────────────────── | ||||||||||||||||
|
|
||||||||||||||||
|
|
||||||||||||||||
| def test_llm_registry_includes_minimax(): | ||||||||||||||||
| rows = llm_backend.list_backends() | ||||||||||||||||
| ids = {r["id"] for r in rows} | ||||||||||||||||
| assert "minimax" in ids | ||||||||||||||||
|
|
||||||||||||||||
|
|
||||||||||||||||
| def test_llm_minimax_unavailable_without_key(monkeypatch): | ||||||||||||||||
| monkeypatch.delenv("MINIMAX_API_KEY", raising=False) | ||||||||||||||||
| ok, msg = llm_backend.MiniMaxBackend.is_available() | ||||||||||||||||
| assert not ok | ||||||||||||||||
| assert "MINIMAX_API_KEY" in msg or "openai" in msg | ||||||||||||||||
|
|
||||||||||||||||
|
|
||||||||||||||||
| def test_llm_minimax_available_with_key(monkeypatch): | ||||||||||||||||
| monkeypatch.setenv("MINIMAX_API_KEY", "test-key") | ||||||||||||||||
| try: | ||||||||||||||||
| import openai # noqa: F401 | ||||||||||||||||
| except ImportError: | ||||||||||||||||
| pytest.skip("openai package not available in this environment") | ||||||||||||||||
| ok, _ = llm_backend.MiniMaxBackend.is_available() | ||||||||||||||||
| assert ok | ||||||||||||||||
|
|
||||||||||||||||
|
|
||||||||||||||||
| def test_llm_minimax_default_model(): | ||||||||||||||||
| be = llm_backend.MiniMaxBackend() | ||||||||||||||||
| assert be.model_name == "MiniMax-M2.7" | ||||||||||||||||
|
|
||||||||||||||||
|
Comment on lines
+162
to
+165
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Isolate This test depends on ambient environment state and can fail when Suggested fix-def test_llm_minimax_default_model():
+def test_llm_minimax_default_model(monkeypatch):
+ monkeypatch.delenv("MINIMAX_MODEL", raising=False)
be = llm_backend.MiniMaxBackend()
assert be.model_name == "MiniMax-M2.7"📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||||||||||||
|
|
||||||||||||||||
| def test_llm_minimax_custom_model(monkeypatch): | ||||||||||||||||
| monkeypatch.setenv("MINIMAX_MODEL", "MiniMax-M2.7-highspeed") | ||||||||||||||||
| be = llm_backend.MiniMaxBackend() | ||||||||||||||||
| assert be.model_name == "MiniMax-M2.7-highspeed" | ||||||||||||||||
|
|
||||||||||||||||
|
|
||||||||||||||||
| def test_llm_minimax_env_override_selects(monkeypatch): | ||||||||||||||||
| monkeypatch.setenv("OMNIVOICE_LLM_BACKEND", "minimax") | ||||||||||||||||
| assert llm_backend.active_backend_id() == "minimax" | ||||||||||||||||
|
|
||||||||||||||||
|
|
||||||||||||||||
| def test_tts_minimax_unavailable_without_key(monkeypatch): | ||||||||||||||||
| monkeypatch.delenv("MINIMAX_API_KEY", raising=False) | ||||||||||||||||
| ok, msg = tts_backend.MiniMaxTTSBackend.is_available() | ||||||||||||||||
| assert not ok | ||||||||||||||||
| assert "MINIMAX_API_KEY" in msg | ||||||||||||||||
|
|
||||||||||||||||
|
|
||||||||||||||||
| def test_tts_minimax_available_with_key(monkeypatch): | ||||||||||||||||
| monkeypatch.setenv("MINIMAX_API_KEY", "test-key") | ||||||||||||||||
| ok, _ = tts_backend.MiniMaxTTSBackend.is_available() | ||||||||||||||||
| assert ok | ||||||||||||||||
|
|
||||||||||||||||
|
|
||||||||||||||||
| def test_tts_minimax_sample_rate(): | ||||||||||||||||
| assert tts_backend.MiniMaxTTSBackend().sample_rate == 32000 | ||||||||||||||||
|
|
||||||||||||||||
|
|
||||||||||||||||
| def test_tts_minimax_voices(): | ||||||||||||||||
| assert len(tts_backend.MiniMaxTTSBackend.VOICES) == 6 | ||||||||||||||||
| assert "English_Graceful_Lady" in tts_backend.MiniMaxTTSBackend.VOICES | ||||||||||||||||
|
|
||||||||||||||||
|
|
||||||||||||||||
| def test_tts_minimax_languages(): | ||||||||||||||||
| langs = tts_backend.MiniMaxTTSBackend().supported_languages | ||||||||||||||||
| assert "multi" in langs | ||||||||||||||||
|
|
||||||||||||||||
|
|
||||||||||||||||
| def test_tts_minimax_env_override_selects(monkeypatch): | ||||||||||||||||
| monkeypatch.setenv("OMNIVOICE_TTS_BACKEND", "minimax") | ||||||||||||||||
| assert tts_backend.active_backend_id() == "minimax" | ||||||||||||||||
|
|
||||||||||||||||
|
|
||||||||||||||||
| def test_tts_minimax_in_registry(): | ||||||||||||||||
| rows = tts_backend.list_backends() | ||||||||||||||||
| ids = {r["id"] for r in rows} | ||||||||||||||||
| assert "minimax" in ids | ||||||||||||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Normalize
MINIMAX_BASE_URLbefore composing the TTS endpoint.This currently appends
/v1/t2a_v2unconditionally. IfMINIMAX_BASE_URLis set tohttps://api.minimax.io/v1(the same shape used by the MiniMax LLM backend), requests go to/v1/v1/t2a_v2and fail.Suggested fix
📝 Committable suggestion
🤖 Prompt for AI Agents