-
Notifications
You must be signed in to change notification settings - Fork 34
Add configurable MiniMax OpenAI-compatible provider #13
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
Open
octo-patch
wants to merge
1
commit into
CraftJarvis:main
Choose a base branch
from
octo-patch:octo/20260730-provider-add-recvqcvPSjEp1x
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,57 @@ | ||
| """Tests for the configurable MiniMax provider setup in ``jarvis.assembly.base``.""" | ||
|
|
||
| import importlib | ||
|
|
||
| import pytest | ||
|
|
||
|
|
||
| @pytest.fixture(autouse=True) | ||
| def _clean_env(monkeypatch): | ||
| # A placeholder key lets the OpenAI-compatible client be constructed at | ||
| # import time without contacting the network. | ||
| monkeypatch.setenv("MINIMAX_API_KEY", "test-key") | ||
| for var in ("MINIMAX_BASE_URL", "MINIMAX_REGION", "MINIMAX_MODEL", "OPENAI_API_KEY"): | ||
| monkeypatch.delenv(var, raising=False) | ||
|
|
||
|
|
||
| def _load_base(): | ||
| import jarvis.assembly.base as base | ||
|
|
||
| return importlib.reload(base) | ||
|
|
||
|
|
||
| def test_default_region_is_global(): | ||
| base = _load_base() | ||
| assert base.DEFAULT_REGION == "global_en" | ||
| assert base.get_base_url() == "https://api.minimax.io/v1" | ||
|
|
||
|
|
||
| def test_cn_region_uses_mainland_endpoint(monkeypatch): | ||
| monkeypatch.setenv("MINIMAX_REGION", "cn_zh") | ||
| base = _load_base() | ||
| assert base.get_base_url() == "https://api.minimaxi.com/v1" | ||
|
|
||
|
|
||
| def test_explicit_base_url_overrides_region(monkeypatch): | ||
| monkeypatch.setenv("MINIMAX_REGION", "cn_zh") | ||
| monkeypatch.setenv("MINIMAX_BASE_URL", "https://example.test/v1") | ||
| base = _load_base() | ||
| assert base.get_base_url() == "https://example.test/v1" | ||
|
|
||
|
|
||
| def test_default_model(): | ||
| base = _load_base() | ||
| assert base.MINIMAX_MODELS[:2] == ["MiniMax-M3", "MiniMax-M2.7"] | ||
| assert base.DEFAULT_MODEL == "MiniMax-M3" | ||
| assert base.get_model() == "MiniMax-M3" | ||
|
|
||
|
|
||
| def test_model_selection(monkeypatch): | ||
| monkeypatch.setenv("MINIMAX_MODEL", "MiniMax-M2.7") | ||
| base = _load_base() | ||
| assert base.get_model() == "MiniMax-M2.7" | ||
|
|
||
|
|
||
| def test_client_points_at_resolved_base_url(): | ||
| base = _load_base() | ||
| assert str(base.client.base_url).rstrip("/") == "https://api.minimax.io/v1" |
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.
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.
🔒 Security & Privacy | 🟠 Major | ⚡ Quick win
🧩 Analysis chain
🏁 Script executed:
Repository: CraftJarvis/JARVIS-1
Length of output: 3358
🏁 Script executed:
Repository: CraftJarvis/JARVIS-1
Length of output: 5332
Require
MINIMAX_API_KEYfor MiniMax requests.get_base_url()always resolves a MiniMaxbase_url, butbuild_client()falls back toOPENAI_API_KEYwhenMINIMAX_API_KEYis missing. IfOPENAI_API_KEYis set, the client can send that OpenAI credential to the MiniMax endpoint; requireMINIMAX_API_KEYor gate the fallback behind an explicit provider selection.Proposed fix
📝 Committable suggestion
🤖 Prompt for AI Agents