mirror of
https://github.com/open-jarvis/OpenJarvis.git
synced 2026-07-28 14:07:55 +00:00
* feat: add MiniMax as cloud inference provider Add MiniMax M2.5 and M2.5-highspeed as a 5th cloud provider alongside OpenAI, Anthropic, Google, and OpenRouter. Uses the OpenAI-compatible API at api.minimax.io/v1 via the existing openai SDK dependency. Changes: - Add MiniMax client init, generate, and streaming in CloudEngine - Add MiniMax models to model catalog with correct pricing - Add MINIMAX_API_KEY environment variable support - Add temperature clamping (0.01-1.0) per MiniMax API constraints - Add 19 unit tests and 3 integration tests - Update docs and README with MiniMax provider info * feat: upgrade MiniMax default model to M2.7 - Add MiniMax-M2.7 and MiniMax-M2.7-highspeed to model list - Set MiniMax-M2.7 as default model (first in list) - Keep all previous models (M2.5, M2.5-highspeed) as alternatives - Update pricing table with M2.7 entries - Update model catalog with M2.7 specs - Update docs to list all available MiniMax models - Update unit tests (23 passing) and integration tests (3 passing) --------- Co-authored-by: Octopus <octo-patch@users.noreply.github.com>
64 lines
2.3 KiB
Python
64 lines
2.3 KiB
Python
"""Integration test for MiniMax cloud provider.
|
|
|
|
Requires MINIMAX_API_KEY environment variable to be set.
|
|
Run with: pytest tests/integration/test_minimax_cloud.py -v
|
|
"""
|
|
|
|
from __future__ import annotations
|
|
|
|
import os
|
|
|
|
import pytest
|
|
|
|
from openjarvis.core.registry import EngineRegistry
|
|
from openjarvis.core.types import Message, Role
|
|
from openjarvis.engine.cloud import CloudEngine
|
|
|
|
_MINIMAX_KEY = os.environ.get("MINIMAX_API_KEY", "")
|
|
_skip_no_key = pytest.mark.skipif(
|
|
not _MINIMAX_KEY,
|
|
reason="MINIMAX_API_KEY not set",
|
|
)
|
|
|
|
|
|
@_skip_no_key
|
|
class TestMiniMaxCloudIntegration:
|
|
"""Live integration tests against MiniMax Cloud API."""
|
|
|
|
@pytest.fixture()
|
|
def engine(self, monkeypatch: pytest.MonkeyPatch) -> CloudEngine:
|
|
monkeypatch.setenv("MINIMAX_API_KEY", _MINIMAX_KEY)
|
|
monkeypatch.delenv("OPENAI_API_KEY", raising=False)
|
|
monkeypatch.delenv("ANTHROPIC_API_KEY", raising=False)
|
|
monkeypatch.delenv("GEMINI_API_KEY", raising=False)
|
|
monkeypatch.delenv("GOOGLE_API_KEY", raising=False)
|
|
monkeypatch.delenv("OPENROUTER_API_KEY", raising=False)
|
|
if not EngineRegistry.contains("cloud"):
|
|
EngineRegistry.register_value("cloud", CloudEngine)
|
|
return CloudEngine()
|
|
|
|
def test_m27_highspeed_basic_chat(self, engine: CloudEngine) -> None:
|
|
"""Send a simple message via M2.7-highspeed and verify non-empty response."""
|
|
result = engine.generate(
|
|
[Message(role=Role.USER, content="Reply with exactly: hello world")],
|
|
model="MiniMax-M2.7-highspeed",
|
|
temperature=0.01,
|
|
max_tokens=32,
|
|
)
|
|
assert result["content"], "Expected non-empty content"
|
|
assert result["usage"]["prompt_tokens"] > 0
|
|
assert result["usage"]["completion_tokens"] > 0
|
|
assert result["finish_reason"] in ("stop", "length")
|
|
|
|
def test_m27_highspeed_health(self, engine: CloudEngine) -> None:
|
|
"""Engine health should be True when MINIMAX_API_KEY is set."""
|
|
assert engine.health() is True
|
|
|
|
def test_m27_highspeed_list_models(self, engine: CloudEngine) -> None:
|
|
"""MiniMax models should appear in list_models."""
|
|
models = engine.list_models()
|
|
assert "MiniMax-M2.7" in models
|
|
assert "MiniMax-M2.7-highspeed" in models
|
|
assert "MiniMax-M2.5" in models
|
|
assert "MiniMax-M2.5-highspeed" in models
|