Repository navigation
feat(sambanova): add MiniMax-M3, update model limits, support extra chat params #44651
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
jhpiedrahitao
wants to merge
6
commits into
BerriAI:main
Choose a base branch
from
jhpiedrahitao:feat/sambanova-update-2026-10
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.
+244
−64
Open
Changes from 3 commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
6a57936
feat(sambanova): add MiniMax-M3, fix max output tokens, remove retire…
jhpiedrahitao 326e2bb
feat(sambanova): support more chat params and restore X-Integration-S…
jhpiedrahitao 4818139
Merge branch 'BerriAI:main' into feat/sambanova-update-2026-10
jhpiedrahitao 445a8ad
Update tests/unit/llms/sambanova/test_sambanova_chat_transformation.py
snova-jorgep f99197a
fix(sambanova): handle integration source header casing and body leak
jhpiedrahitao fa6090b
test(sambanova): add header regression tests, drop vendor-fact asser…
jhpiedrahitao 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
111 changes: 111 additions & 0 deletions
111
tests/unit/llms/sambanova/test_sambanova_chat_transformation.py
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,111 @@ | ||
| import pytest | ||
|
|
||
| from litellm.llms.sambanova.chat import SambanovaConfig | ||
| from litellm.utils import get_optional_params | ||
|
|
||
| # Params documented in SambaNova's chat completions API spec that map 1:1 from OpenAI. | ||
|
snova-jorgep marked this conversation as resolved.
Resolved
|
||
| _ALWAYS_SUPPORTED = ( | ||
| "max_tokens", | ||
| "max_completion_tokens", | ||
| "temperature", | ||
| "top_p", | ||
| "top_k", | ||
| "stop", | ||
| "stream", | ||
| "stream_options", | ||
| "response_format", | ||
| "presence_penalty", | ||
| "frequency_penalty", | ||
| "logprobs", | ||
| "top_logprobs", | ||
| "n", | ||
| "logit_bias", | ||
| "seed", | ||
| ) | ||
|
|
||
|
|
||
| @pytest.mark.parametrize("param", _ALWAYS_SUPPORTED) | ||
| def test_supported_params_include_spec_params(param): | ||
| assert param in SambanovaConfig().get_supported_openai_params("MiniMax-M3") | ||
|
|
||
|
|
||
| def test_reasoning_effort_only_for_reasoning_models(): | ||
| config = SambanovaConfig() | ||
| assert "reasoning_effort" in config.get_supported_openai_params("gpt-oss-120b") | ||
| assert "reasoning_effort" not in config.get_supported_openai_params("Meta-Llama-3.3-70B-Instruct") | ||
|
|
||
|
|
||
| def test_tools_only_for_function_calling_models(): | ||
| config = SambanovaConfig() | ||
| for param in ("tools", "tool_choice", "parallel_tool_calls"): | ||
| assert param in config.get_supported_openai_params("MiniMax-M3") | ||
| assert param not in config.get_supported_openai_params("gemma-4-31B-it") | ||
|
|
||
|
|
||
| def test_max_completion_tokens_mapped_to_max_tokens(): | ||
| optional_params = SambanovaConfig().map_openai_params( | ||
| non_default_params={"max_completion_tokens": 128}, | ||
| optional_params={}, | ||
| model="MiniMax-M3", | ||
| drop_params=False, | ||
| ) | ||
| assert optional_params == {"max_tokens": 128} | ||
|
|
||
|
|
||
| def test_new_params_forwarded_via_get_optional_params(): | ||
| optional_params = get_optional_params( | ||
| model="MiniMax-M3", | ||
| custom_llm_provider="sambanova", | ||
| seed=7, | ||
| presence_penalty=0.5, | ||
| frequency_penalty=0.25, | ||
| reasoning_effort="low", | ||
| ) | ||
| assert optional_params["seed"] == 7 | ||
| assert optional_params["presence_penalty"] == 0.5 | ||
| assert optional_params["frequency_penalty"] == 0.25 | ||
| assert optional_params["reasoning_effort"] == "low" | ||
|
|
||
|
|
||
| def _transform(optional_params): | ||
| return SambanovaConfig().transform_request( | ||
| model="MiniMax-M3", | ||
| messages=[{"role": "user", "content": "hi"}], | ||
| optional_params=optional_params, | ||
| litellm_params={}, | ||
| headers={}, | ||
| ) | ||
|
|
||
|
|
||
| def test_integration_source_defaults_to_litellm(monkeypatch): | ||
| monkeypatch.delenv("SAMBANOVA_INTEGRATION_SOURCE", raising=False) | ||
| request = _transform({}) | ||
| assert request["extra_headers"]["X-Integration-Source"] == "litellm" | ||
|
|
||
|
|
||
| def test_integration_source_env_overrides_default(monkeypatch): | ||
| monkeypatch.setenv("SAMBANOVA_INTEGRATION_SOURCE", "langflow") | ||
| request = _transform({}) | ||
| assert request["extra_headers"]["X-Integration-Source"] == "langflow" | ||
|
|
||
|
|
||
| def test_integration_source_param_overrides_env(monkeypatch): | ||
| monkeypatch.setenv("SAMBANOVA_INTEGRATION_SOURCE", "langflow") | ||
| optional_params = {"extra_body": {"integration_source": "my-framework"}} | ||
| request = _transform(optional_params) | ||
| assert request["extra_headers"]["X-Integration-Source"] == "my-framework" | ||
| assert "integration_source" not in request.get("extra_body", {}) | ||
| assert "integration_source" in optional_params["extra_body"], "caller's dict must not be mutated" | ||
|
|
||
|
|
||
| def test_integration_source_explicit_header_wins(monkeypatch): | ||
| monkeypatch.setenv("SAMBANOVA_INTEGRATION_SOURCE", "langflow") | ||
| request = _transform({"extra_headers": {"X-Integration-Source": "custom", "X-Other": "1"}}) | ||
| assert request["extra_headers"] == {"X-Integration-Source": "custom", "X-Other": "1"} | ||
|
|
||
|
|
||
| def test_content_list_converted_to_string(): | ||
| messages = [{"role": "user", "content": [{"type": "text", "text": "a"}, {"type": "text", "text": "b"}]}] | ||
| out = SambanovaConfig()._transform_messages(messages, model="MiniMax-M3") | ||
| assert isinstance(out[0]["content"], str) | ||
| assert "a" in out[0]["content"] and "b" in out[0]["content"] | ||
Oops, something went wrong.
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.