from __future__ import annotations

from pathlib import Path
from typing import TYPE_CHECKING, override

from bench_af import Detector
from bench_af.util import assess_model_bias

if TYPE_CHECKING:
    from inspect_ai.log import EvalLog
    from bench_af._abstract.objects import Environment, ModelOrganism
    import torch


class MyDetector(Detector):
    def __init__(self) -> None:
        super().__init__(
            name=Path(__file__).parent.name,
            supported_model_organisms=set(),
            supported_environments=set(),
        )
        self.activation_cache: dict[str, torch.Tensor] = {}

    @override
    def modify_environment(self, environment: Environment) -> None:
        pass

    @override
    def modify_model_organism(self, model_organism: ModelOrganism) -> None:
        pass

    @override
    def get_prediction(self, eval_logs: list[EvalLog]) -> tuple[float, str]:
        return assess_model_bias("*Example bias*", eval_logs[0])


def get() -> Detector:
    return MyDetector()
