mirror of
https://github.com/Sea-Haven-Industries/open-swe.git
synced 2026-09-30 19:43:15 +00:00
56 lines
2.3 KiB
Python
56 lines
2.3 KiB
Python
|
|
import pytest
|
||
|
|
|
||
|
|
from agent.dashboard.options import SUPPORTED_MODELS, provider_fallback_pair
|
||
|
|
from agent.utils.model import provider_model_kwargs
|
||
|
|
|
||
|
|
SONNET_5_ID = "bedrock_converse:us.anthropic.claude-sonnet-5"
|
||
|
|
FABLE_5_ID = "bedrock_converse:us.anthropic.claude-fable-5"
|
||
|
|
|
||
|
|
|
||
|
|
def test_sonnet_5_is_supported_with_documented_efforts() -> None:
|
||
|
|
sonnet = next(m for m in SUPPORTED_MODELS if m["id"] == SONNET_5_ID)
|
||
|
|
assert sonnet["label"] == "Sonnet 5 (Bedrock)"
|
||
|
|
assert sonnet["efforts"] == ["low", "medium", "high", "xhigh", "max"]
|
||
|
|
assert sonnet["default_effort"] == "high"
|
||
|
|
assert sonnet["supports_images"] is True
|
||
|
|
|
||
|
|
|
||
|
|
@pytest.mark.parametrize("effort", ["low", "medium", "high", "xhigh", "max"])
|
||
|
|
def test_sonnet_5_efforts_map_to_bedrock_kwargs(effort: str) -> None:
|
||
|
|
kwargs = provider_model_kwargs(SONNET_5_ID, effort, max_tokens=16_000)
|
||
|
|
assert kwargs["max_tokens"] == 16_000
|
||
|
|
fields = kwargs["additional_model_request_fields"]
|
||
|
|
assert fields["output_config"] == {"effort": effort}
|
||
|
|
assert fields["thinking"] == {"type": "adaptive", "display": "summarized"}
|
||
|
|
|
||
|
|
|
||
|
|
def test_sonnet_46_fallback_uses_sonnet_5() -> None:
|
||
|
|
assert provider_fallback_pair("bedrock_converse:us.anthropic.claude-sonnet-4-6", "xhigh") == (
|
||
|
|
SONNET_5_ID,
|
||
|
|
"xhigh",
|
||
|
|
)
|
||
|
|
|
||
|
|
|
||
|
|
def test_opus_fallback_stays_on_opus_family() -> None:
|
||
|
|
assert provider_fallback_pair("bedrock_converse:us.anthropic.claude-opus-4-7", "xhigh") == (
|
||
|
|
"bedrock_converse:us.anthropic.claude-opus-4-8",
|
||
|
|
"xhigh",
|
||
|
|
)
|
||
|
|
|
||
|
|
|
||
|
|
def test_fable_5_is_supported_with_documented_efforts() -> None:
|
||
|
|
fable = next(m for m in SUPPORTED_MODELS if m["id"] == FABLE_5_ID)
|
||
|
|
assert fable["label"] == "Fable 5"
|
||
|
|
assert fable["efforts"] == ["low", "medium", "high", "xhigh", "max"]
|
||
|
|
assert fable["default_effort"] == "high"
|
||
|
|
assert fable["supports_images"] is True
|
||
|
|
|
||
|
|
|
||
|
|
@pytest.mark.parametrize("effort", ["low", "medium", "high", "xhigh", "max"])
|
||
|
|
def test_fable_5_efforts_map_to_bedrock_kwargs(effort: str) -> None:
|
||
|
|
kwargs = provider_model_kwargs(FABLE_5_ID, effort, max_tokens=16_000)
|
||
|
|
assert kwargs["max_tokens"] == 16_000
|
||
|
|
fields = kwargs["additional_model_request_fields"]
|
||
|
|
assert fields["output_config"] == {"effort": effort}
|
||
|
|
assert fields["thinking"] == {"type": "adaptive", "display": "summarized"}
|