fix(anthropic): default to a Claude model Anthropic still serves

AnthropicProvider.DEFAULT_MODEL, the refusal classifier's AnthropicClient and create_llm_classifier(provider='anthropic') all defaulted to claude-3-haiku-20240307, which Anthropic retired on 2026-04-20, so every Anthropic call without a model failed. They now use claude-haiku-5-5, the current Haiku. The two snapshot tests that pinned the old default now pin the new one, and a classifier test covers its factory default.
This commit is contained in:
Ayham Joumran committed 2026-11-23 00:38:51 +01:00
1 parent dbbdf739e3
commit 8d2a55beb3
5 files changed
+11 -5

No files matched your search

@@ -32,7 +32,7 @@ class TestAnthropicProviderInit:
def test_default_model(self, monkeypatch):
monkeypatch.setenv("ANTHROPIC_API_KEY", "test-key")
provider = AnthropicProvider()
assert provider.model == snapshot("claude-3-haiku-20240307")
assert provider.model == snapshot("claude-haiku-5-5")
def test_custom_model(self, monkeypatch):
monkeypatch.setenv("ANTHROPIC_API_KEY", "test-key")
+1 -1
View File
@@ -91,7 +91,7 @@ class TestCreateProvider:
def test_create_anthropic_with_default_model(self, monkeypatch):
monkeypatch.setenv("ANTHROPIC_API_KEY", "test-key")
provider = create_provider("anthropic")
assert provider.model == snapshot("claude-3-haiku-20240307")
assert provider.model == snapshot("claude-haiku-5-5")
def test_create_anthropic_with_custom_model(self, monkeypatch):
monkeypatch.setenv("ANTHROPIC_API_KEY", "test-key")
@@ -154,6 +154,12 @@ class TestCreateLLMClassifier:
with pytest.raises(ValueError, match="Anthropic API key required"):
create_llm_classifier(provider="anthropic")
def test_create_anthropic_default_model(self, monkeypatch):
# claude-3-haiku-20240307 was retired by Anthropic on 2026-04-20.
monkeypatch.setenv("ANTHROPIC_API_KEY", "test-key")
classifier = create_llm_classifier(provider="anthropic")
assert classifier.client.model == snapshot("claude-haiku-5-5")
def test_create_unknown_provider(self):
with pytest.raises(ValueError, match="Unknown provider"):
create_llm_classifier(provider="unknown")