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

Abierto
#167 0 comentarios 0 reacciones 0 asignados Ver en GitHub

Los mantenedores suelen responder en 1 día

Nadie ha tomado este issue todavía.

Evaluación

Dificultad
4/5
Tiempo estimado
3-5 días
Aptitud para principiantes
48/100
Tipo de issue
Nueva funcionalidad
Claridad
Bien especificado
Estado de actividad
Activo
Stack tecnológico
python

Línea de trabajo

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.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

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
Lenguaje dominante
Python
Estrellas
615
Forks
60
Merge medio
2 d 18 h
PR fusionados (30 d)
12

Preparar el entorno

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de KRLabsOrg/LettuceDetect

Todos los issues de KRLabsOrg/LettuceDetect

Issues similares

Más issues de Python

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.