SPB Git forge

spb/ai-atlas

Public
41commits 1branches 0releases
4.6 MBsize
maindefault branch
12 days agolast push
HTML 77.2% TypeScript 10.5% Python 9.6% JavaScript 2.5%
3.6 KB · 64 lines python
Raw Blame History
1import pytest23from aiatlas.connectors.labs.anthropic import AnthropicConnector, _display_name, _name_variants4from aiatlas.sdk.facts import Target5from tests.conftest import claims_of, entity_names, extract_from_fixture, fixture_path678@pytest.fixture9def connector() -> AnthropicConnector:10    return AnthropicConnector()111213async def test_models_overview(connector):14    target = Target(url="https://docs.claude.com/en/docs/about-claude/models/overview.md", doc_type="model_docs", key="models")15    facts = await extract_from_fixture(connector, target, fixture_path("anthropic", "models-overview.md"), content_type="text/markdown")16    models = entity_names(facts, "model")17    assert {"Claude Opus 5", "Claude Sonnet 5", "Claude Haiku 4.5"} <= models18    opus = claims_of(facts, "Claude Opus 5")19    assert opus["context_length"] == 1_000_000 and opus["max_output_tokens"] == 128_00020    assert opus["api_model_id"] == "claude-opus-5" and opus["openness"] == "proprietary"21    assert opus["knowledge_cutoff"] == "2026-05" and opus["retirement_date"] == "2027-07-24" and opus["retirement_tentative"] is True22    haiku = claims_of(facts, "Claude Haiku 4.5")23    assert haiku["context_length"] == 200_000 and haiku["api_model_id"] == "claude-haiku-4-5-20251001"24    assert any(t.doc_type == "model_page" for t in facts.targets)25    assert any(r.predicate == "develops" for r in facts.relations)262728async def test_pricing(connector):29    target = Target(url="https://docs.claude.com/en/docs/about-claude/pricing.md", doc_type="pricing", key="pricing")30    facts = await extract_from_fixture(connector, target, fixture_path("anthropic", "pricing.md"), content_type="text/markdown")31    by_model = {p.model.name: p for p in facts.prices}32    assert by_model["Claude Opus 5"].input_per_mtok == 5 and by_model["Claude Opus 5"].output_per_mtok == 2533    assert by_model["Claude Opus 5"].cached_input_per_mtok == 0.5 and by_model["Claude Opus 5"].cache_write_per_mtok == 6.2534    assert by_model["Claude Haiku 3.5"].input_per_mtok == 0.835    assert claims_of(facts, "Claude Opus 4.1")["status"] == "retired"36    assert claims_of(facts, "Claude Mythos 5.1")["status"] == "limited-availability"37    assert len(facts.prices) >= 15383940async def test_deprecations(connector):41    target = Target(url="https://docs.claude.com/en/docs/about-claude/model-deprecations.md", doc_type="model_docs", key="deprecations")42    facts = await extract_from_fixture(connector, target, fixture_path("anthropic", "model-deprecations.md"), content_type="text/markdown")43    sonnet37 = claims_of(facts, "Claude 3.7 Sonnet")44    assert sonnet37["status"] == "retired" and sonnet37["deprecation_date"] == "2025-10-28" and sonnet37["retirement_date"] == "2026-02-19"45    opus5 = claims_of(facts, "Claude Opus 5")46    assert opus5["status"] == "active" and opus5["retirement_tentative"] is True474849async def test_news(connector):50    target = Target(url="https://www.anthropic.com/news", doc_type="listing", key="news")51    facts = await extract_from_fixture(connector, target, fixture_path("anthropic", "news.html"))52    events = [e for e in facts.events if e.event_type == "ANNOUNCEMENT"]53    assert len(events) >= 854    opus = next(e for e in events if "Opus 5" in e.summary)55    assert opus.effective_at is not None and opus.effective_at.year == 2026 and opus.category == "release"56    assert any(t.needs_llm for t in facts.targets)575859def test_display_name():60    assert _display_name("claude-opus-4-5-20251101") == "Claude Opus 4.5"61    assert _display_name("claude-3-7-sonnet-20250219") == "Claude 3.7 Sonnet"62    assert _display_name("claude-fable-5-1") == "Claude Fable 5.1"63    assert _name_variants("Claude 3.5 Haiku") == ["Claude Haiku 3.5"]64