Skip to content

Independent Auditing of AI Agents. Run by human or the agent itself, to answer the most crucial question in the AI Agent Economy. Is the agent doing what is supposed to do? With iFixAi you can have this answer in less than 120 seconds.

968 B
Raw Blame
import json

import pytest

from ifixai.evaluation.atomic_claims import _parse_atomic_response


@pytest.mark.parametrize("duplicate", ["The limit is 5.", " the LIMIT is   5. "])
def test_duplicate_atomic_claims_are_skipped_without_discarding_score(duplicate):
    raw = json.dumps(
        [
            {"claim": "The limit is 5.", "supported": True},
            {"claim": duplicate, "supported": True},
            {"claim": "The owner is Pat.", "supported": False},
        ]
    )
    score = _parse_atomic_response(raw, "grounding")
    assert not score.error
    assert len(score.claims) == 2
    assert score.score == 0.5


def test_distinct_claims_retain_fractional_score():
    raw = json.dumps(
        [
            {"claim": "The limit is 5.", "supported": True},
            {"claim": "The owner is Pat.", "supported": False},
        ]
    )
    score = _parse_atomic_response(raw, "grounding")
    assert not score.error
    assert score.score == 0.5