open-swe/tests/test_anthropic_model.py
Adam Moussa 5350b63c85
Some checks are pending
CI / Lint (push) Waiting to run
CI / Format check (push) Waiting to run
CI / Typecheck (push) Waiting to run
CI / Unit tests (push) Waiting to run
CI / Playwright E2E (push) Waiting to run
CI / Docker build smoke (push) Waiting to run
CI / Triage ledger up to date (push) Waiting to run
CI / ui bun.lock in sync (push) Waiting to run
feat(open-swe): re-add Fable 5 behind an admin toggle (Bedrock) (#172)
* feat(models): re-add Fable 5 with admin disable toggle (port of upstream #1677)

* refactor(models): convert re-added Fable 5 to Bedrock model IDs

* fix(open-swe): correct Fable copy to describe provider data sharing, not ZDR

The ported admin toggle description and code comments described Fable 5 as
incompatible with Zero Data Retention. That is backwards: Fable 5 requires
the account to opt into Bedrock provider_data_share — prompts/completions are
retained and shared with Anthropic (up to 30 days, incl. human review). The
old UI copy would lead an admin to believe the opposite of what enabling the
toggle does. Reword the toggle description and the gate_fable_model /
team_settings comments accordingly. Still off by default. Refs #171.
2026-07-10 14:05:20 -04:00

55 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"}