diff --git a/README.md b/README.md index f3fa6b7..7613ed5 100644 --- a/README.md +++ b/README.md @@ -247,6 +247,22 @@ The model can output predictions in two formats: }] ``` +Use `min_confidence` with span output to drop predictions below a threshold: + +```python +detector.predict( + context=contexts, + question=question, + answer=answer, + output_format="spans", + min_confidence=0.8, +) +``` + +For transformer detectors, emitted hallucination spans already have +confidence values of at least `0.5`, so thresholds below `0.5` are no-ops; +higher thresholds raise that floor. + ### Token Format ```python [{ diff --git a/lettucedetect/detectors/rag_fact_checker.py b/lettucedetect/detectors/rag_fact_checker.py index 18d9e0c..c5b87d0 100644 --- a/lettucedetect/detectors/rag_fact_checker.py +++ b/lettucedetect/detectors/rag_fact_checker.py @@ -54,6 +54,8 @@ def predict( :param question: Question (optional) :param output_format: "tokens", "spans", or "detailed" :param min_confidence: Drop ``"spans"`` below this confidence threshold (``[0, 1]``). + Does not filter ``output_format="detailed"``; detailed output returns + the unfiltered spans, triplets, and fact-check results. :param kwargs: Additional arguments :return: List of predictions in lettuceDetect format, or dict for detailed format