Skip to content

Fix repeated LLM span localization#86

Open
Sanjays2402 wants to merge 1 commit into
KRLabsOrg:mainfrom
Sanjays2402:fix/repeated-llm-span-offsets
Open

Fix repeated LLM span localization#86
Sanjays2402 wants to merge 1 commit into
KRLabsOrg:mainfrom
Sanjays2402:fix/repeated-llm-span-offsets

Conversation

@Sanjays2402

Copy link
Copy Markdown

Summary

Map repeated LLM judge spans to the first unused, non-overlapping answer occurrence, reserving occurrences before confidence/verdict filtering. The judge prompt now requests left-to-right occurrence order.

Related issue

Closes #85.

Type of change

  • Bug fix
  • Feature
  • Documentation
  • Tests
  • Refactor or maintenance

Testing

  • ruff format --check lettucedetect/ lettucedetect_api/ tests/
  • ruff check lettucedetect/ lettucedetect_api/ tests/ --extend-exclude lettucedetect/integrations/
  • python -m pytest
  • Other: python -m pytest tests/test_llm_detector_pytest.py -q; targeted Ruff check and format check

Checklist

  • I kept the PR focused on one change.
  • I added or updated tests/docs when needed.
  • I checked that no secrets, API keys, or credentials are included.

Rights & sign-off (required)

  • I certify that I have the right to submit this code and that it may be
    distributed under the repository's MIT license
    (see CONTRIBUTING).

Reserve each verbatim answer occurrence before applying judge filters so repeated span strings keep distinct offsets and metadata. Add direct and token-level regressions for duplicate, filtered, overlapping, and excess items.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Map repeated LLM span strings to distinct answer occurrences

1 participant