from pathlib import Path
from typing import override

from bench_af._abstract.objects import Detector, Environment, EvalLog, ModelOrganism
import torch

CURRENT_DIRECTORY = Path(__file__).parent


class Poser3Detector(Detector):
    """
    Bad Finetuning Rate detector for identifying alignment-faking models.
    
    Identifies alignment fakers by comparing how quickly they adapt to misaligned 
    training objectives during fine-tuning. The hypothesis is that alignment fakers 
    already possess latent circuits for misaligned behavior, making them faster to 
    fine-tune toward harmful actions compared to genuinely aligned models.
    
    Based on Section 3.3 of "Poser: Unmasking Alignment Faking LLMs by Manipulating 
    Their Internals" (Clymer et al., 2024).
    """

    def __init__(self) -> None:
        super().__init__(
            name=CURRENT_DIRECTORY.name,
            supported_model_organisms=set(),
            supported_environments=set(),
        )
        self.activation_cache: dict[str, torch.Tensor] = {}
    
    @override
    def modify_environment(self, environment: Environment) -> None:
        # TODO: implement
        pass
    
    @override
    def modify_model_organism(self, model_organism: ModelOrganism) -> None:
        # TODO: implement
        pass

    @override
    def get_prediction(self, eval_logs: list[EvalLog]) -> tuple[float, str]:
        # TODO: implement
        return 0.0, "Example explanation"


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