You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Pin make_detector, HallucinationDetector and CacheManager behavior #131
The factory, the HallucinationDetector facade and CacheManager all change in later tickets. The cache key strings in particular must stay byte-identical when model_version is None, so they have to be recorded.
Current behavior
lettucedetect/detectors/factory.py:10make_detector builds "transformer", "llm" or "rag_fact_checker" and raises ValueError for anything else (:28-32).
lettucedetect/detectors/cache.py:12CacheManager: constructor creates the directory (:17), set and delete rewrite the file with write_text (:39, :46), _hash is SHA-256 of parts joined by || (:28).
The three keys LLMDetector builds: judge llm.py:408, native :468 (extra part "native"), verify :506 (extra part "verify").
HallucinationDetector lives in lettucedetect/models/.
Steps
Add tests/test_golden_factory_cache_pytest.py.
Record that make_detector returns the right class for each method (fakes in place of loading) and the error message for an unknown method.
Record HallucinationDetector.predict, predict_prompt and predict_prompt_batch equal to the underlying detector's output.
Record the CacheManager JSON file after a few set and delete calls.
Record the three key strings from _hash for fixed prompts (judge, native, verify).
Acceptance criteria
Checked-in JSON for each item above.
Network-free; no production code and no existing test changes.
Start here
uv run --extra dev pytest tests/test_factory_pytest.py -q
Activity
test: pin make_detector, HallucinationDetector and CacheManager behav…