Skip to content

The platform for continuously improving AI agents.

1.9 KB
Raw Blame
import pytest

from overbae.core.errors import InputValidationError
from overbae.core.model_registry import decision_model
from overbae.models import Project
from overbae.services import decision_providers
from overbae.services.evaluation_contract import require_selectable

pytestmark = [pytest.mark.django_db, pytest.mark.covers("metrics-math")]


def listed(slug, *parameters):
    return {
        "id": slug,
        "name": slug,
        "context_length": 128_000,
        "supported_parameters": list(parameters),
        "pricing": {"prompt": "0.000001", "completion": "0.000002"},
        "architecture": {"modality": "text->text"},
    }


@pytest.fixture
def openrouter(fake_llm):
    fake_llm.catalog_payload = [
        listed("openai/gpt-4o", "logprobs", "top_logprobs"),
        listed("openai/gpt-5", "tools"),
    ]
    return fake_llm


def test_benchmark_catalogue_is_openrouter_models_that_report_probabilities(openrouter):
    project = Project.objects.create(name="Catalogue", slug="catalogue")

    offered = {option["id"]: option["kind"] for option in decision_providers.catalog(project)}

    assert offered["openai/gpt-4o"] == "external"
    assert "openai/gpt-5" not in offered
    assert "Qwen/Qwen3.5-0.8B" not in offered
    assert decision_model().slug not in offered
    with pytest.raises(InputValidationError, match="OpenRouter models"):
        require_selectable([{"kind": "external", "model": decision_model().slug}])
    with pytest.raises(InputValidationError, match="training catalogue"):
        require_selectable(
            [{"key": "base", "name": "Base", "kind": "foundation", "model": "Qwen/Qwen3.5-0.8B"}]
        )
    with pytest.raises(InputValidationError, match="benchmark catalogue"):
        decision_providers.qualify_participants(
            project,
            [{"key": "gpt", "name": "GPT", "kind": "external", "model": "openai/gpt-5"}],
        )