fix(api): expose actual PII confidence scores instead of hardcoded 0.9 #718
+92
−11
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.

Summary
This PR fixes the PII API endpoint to return actual confidence scores from the LoRA model instead of hardcoded
0.9values.Fixes #717
Changes
ClassifyPIIWithDetails()method - New classifier method that returns full entity details including actual confidence scoresDetectPII()service - Modified to useClassifyPIIWithDetails()instead ofClassifyPII()to access real confidence valuesconfig.e2e.yaml- Configured to use LoRA PII model and added default catch-all decision for E2E testingBefore vs After
Before (Hardcoded)
{ "entities": [ {"type": "B-EMAIL_ADDRESS", "confidence": 0.9}, {"type": "B-PERSON", "confidence": 0.9} ] }After (Actual Scores)
{ "entities": [ {"type": "B-EMAIL_ADDRESS", "confidence": 0.9869}, {"type": "B-PERSON", "confidence": 0.9991} ] }Test Results
Local testing shows the API now correctly returns actual model confidence scores:
Technical Details
The underlying LoRA PII model was already producing accurate confidence scores (fixed in #709), but the API layer was discarding them. This change passes through the actual scores to API consumers.
The new
ClassifyPIIWithDetails()method returns[]PIIDetectionwith full entity information, while maintaining backward compatibility by keeping the existingClassifyPII()method for callers that only need entity types.Testing
make run-router-e2e