Warn on deprecated LLMDetector use and stop writing a default cache file

Aperta
#167 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
4/5
Tempo stimato
3-5 giorni
Idoneità per principianti
48/100
Tipo di issue
Funzionalità
Chiarezza
Specificata chiaramente
Stato di attività
Attiva
Stack tecnologico
python

Direzione di ricerca

Start with lettucedetect/detectors/llm.py and run uv run --extra dev pytest tests/test_llm_detector_pytest.py tests/test_factory_pytest.py -q. Trace how LLMDetector is constructed directly and through HallucinationDetector(method="llm", ...), then review the related configuration tests. Done means deprecated direct uses warn as specified, invalid options raise the stated configuration error, and a run without cache_file writes no cache file.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

ready-for-agent

Parent: #166 · Epic: #126 · Blocked by: #161, #165, #135
Branch from stateless_core; open the PR against it.

Problem

LLMDetector builds a client from provider and environment variables, writes a cache file inside the installed package directory when no cache_file is passed, and reports bad arguments as ValueError. Users get no signal about what to change.

Current behavior

  • lettucedetect/detectors/llm.py:63-82 constructor arguments (provider, client, cache_file, native, …); client built from provider/**client_kwargs when none is passed.
  • llm.py:109 unknown language and :123 native conflicts raise ValueError; :164 missing few-shot file only warns (becomes ConfigurationError through LLMJudgeConfig).
  • llm.py:183-194 default cache file lettucedetect/cache/cache_<model>_<lang>.json.

Steps

  1. Mark LLMDetector deprecated naming LLMJudgeDetector and GenerativeDetector; in-package construction doesn't warn.
  2. Keep choosing the delegate by _looks_native(model) or native=.
  3. native (or a matching name) with zero_shot, fewshot_path or prompt_path → ConfigurationError (native_options_conflict, param).
  4. Without client, build one from provider and **client_kwargs as today and warn that the client should be passed; passing provider or client_kwargs warns as a deprecated argument (sentinel defaults).
  5. cache_file builds a FileCache and warns naming cache=; with no cache_file there is no cache and no file anywhere.
  6. Invalid language / batch_size map to ConfigurationError with code and param through the configs.

Acceptance criteria

  • Each deprecated use warns once with the standard message; HallucinationDetector(method="llm", ...) stays silent.
  • Name rule and native= override tested; conflict raises with native_options_conflict.
  • A run in an empty cwd with no cache_file writes nothing, including under the package directory.
  • Existing tests pass unchanged (modules marked in #136).

Start here

uv run --extra dev pytest tests/test_llm_detector_pytest.py tests/test_factory_pytest.py -q
Lingua principale
Python
Stelle
615
Fork
60
Merge medio
1g 8h
PR unite (30g)
10

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di KRLabsOrg/LettuceDetect

Tutte le issue di KRLabsOrg/LettuceDetect

Issue simili

Altre issue su Python

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.