Skip to content

Use classifier contract in identify flow - #23

Merged
henry3260 merged 1 commit into
mainfrom
refactor-identify-contract
May 31, 2026
Merged

Use classifier contract in identify flow#23
henry3260 merged 1 commit into
mainfrom
refactor-identify-contract

Conversation

@henry3260

Copy link
Copy Markdown
Owner

Summary

  • update LLMFingerprinter.identify() to consume classifier.classify_result() / MultiClassResult
  • preserve the existing legacy dict shape consumed by the CLI report layer
  • add focused tests for normal and OOD contract-to-report mapping

Tests

  • .venv/bin/python -m pytest tests

Result: 29 passed, 1 existing datetime.utcnow() deprecation warning.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Refactors LLMFingerprinter.identify() to consume the new MultiClassResult contract from classifier.classify_result() while preserving the legacy report dict shape consumed by the CLI. Adds focused tests for the contract-to-report mapping covering both normal and OOD paths.

Changes:

  • Replace predict_with_confidence() tuple consumption with classify_result() and map top_label, metadata['predicted_label'], metadata['is_ood'], metadata['probabilities'] (with ranking fallback), and metadata['ood_info'] to legacy keys.
  • Update OOD/non-OOD log messages to use the new contract fields.
  • Add tests/fingerprinter/test_identify_contract.py with a fake contract-only classifier asserting the legacy mapping and OOD best-guess preservation.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
llm_fingerprinter/fingerprinter.py Rewrite identify() to consume MultiClassResult and map to legacy report keys
tests/fingerprinter/test_identify_contract.py New tests verifying contract-to-legacy mapping for normal and OOD paths

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@henry3260
henry3260 merged commit 69f5e37 into main May 31, 2026
3 checks passed
@henry3260
henry3260 deleted the refactor-identify-contract branch May 31, 2026 19:09
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.

2 participants