Skip to content

Analyzers

Analysis modules for understanding AI reasoning and behavior.

Available Analyzers

Analyzer Description
CounterfactualCoTAnalyzer Analyze reasoning chains for strategic behavior

Base Classes

Base analyzer class for metacognition analysis.

BaseAnalyzer

Bases: ABC

Abstract base class for all analyzers.

All analyzer implementations should inherit from this class and implement the analyze method.

Source code in src/rotalabs_probe/analyzers/base.py
class BaseAnalyzer(ABC):
    """Abstract base class for all analyzers.

    All analyzer implementations should inherit from this class and implement
    the analyze method.
    """

    def __init__(self) -> None:
        """Initialize the analyzer."""
        self.name: str = self.__class__.__name__

    @abstractmethod
    def analyze(self, data: List[str]) -> Dict[str, Any]:
        """Analyze the given data for metacognitive patterns.

        Args:
            data: List of text samples to analyze

        Returns:
            A dictionary containing analysis results with metrics and statistics

        Raises:
            NotImplementedError: If the method is not implemented
        """
        raise NotImplementedError("Subclasses must implement the analyze method")

    def __repr__(self) -> str:
        """Return string representation of the analyzer.

        Returns:
            String representation
        """
        return f"{self.__class__.__name__}()"

__init__() -> None

Initialize the analyzer.

Source code in src/rotalabs_probe/analyzers/base.py
def __init__(self) -> None:
    """Initialize the analyzer."""
    self.name: str = self.__class__.__name__

analyze(data: List[str]) -> Dict[str, Any] abstractmethod

Analyze the given data for metacognitive patterns.

Parameters:

Name Type Description Default
data List[str]

List of text samples to analyze

required

Returns:

Type Description
Dict[str, Any]

A dictionary containing analysis results with metrics and statistics

Raises:

Type Description
NotImplementedError

If the method is not implemented

Source code in src/rotalabs_probe/analyzers/base.py
@abstractmethod
def analyze(self, data: List[str]) -> Dict[str, Any]:
    """Analyze the given data for metacognitive patterns.

    Args:
        data: List of text samples to analyze

    Returns:
        A dictionary containing analysis results with metrics and statistics

    Raises:
        NotImplementedError: If the method is not implemented
    """
    raise NotImplementedError("Subclasses must implement the analyze method")

__repr__() -> str

Return string representation of the analyzer.

Returns:

Type Description
str

String representation

Source code in src/rotalabs_probe/analyzers/base.py
def __repr__(self) -> str:
    """Return string representation of the analyzer.

    Returns:
        String representation
    """
    return f"{self.__class__.__name__}()"