Skip to content

Commit e507895

Browse files
yossiovadiaclaude
andcommitted
fix: pass PII mapping config to auto-detecting Candle BERT classifier
Critical bug fix for PR vllm-project#648 CI failures. **Root Cause:** The new auto-detecting PII classifier API was not receiving the PII configuration mapping (pii_type_mapping.json), causing: - 0% PII detection accuracy (classifier didn't know which entities to detect) - 0/100 requests blocked (blocking policy received incomplete results) **The Bug:** Changed from ClassifyModernBertPIITokens(text, configPath) to ClassifyCandleBertTokens(text) - dropping the configPath parameter. **The Fix:** Use ClassifyCandleBertTokensWithLabels(text, id2labelJSON) to pass the PII entity mapping configuration to the classifier. **Testing:** - Local testing worked because it was using old code (ModernBERT path) - CI failed because it builds from PR branch (new auto-detect path) - This fix ensures both LoRA and Traditional paths receive PII config **Related:** - Fixes CI test failures in integration-test jobs - LoRA loading still shows 'hidden_act' error but falls back to ModernBERT - ModernBERT fallback now works correctly with this fix 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]> Signed-off-by: Yossi Ovadia <[email protected]>
1 parent 1d30270 commit e507895

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

src/semantic-router/pkg/classification/classifier.go

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ package classification
22

33
import (
44
"fmt"
5+
"os"
56
"slices"
67
"strings"
78
"time"
@@ -182,7 +183,12 @@ type PIIInferenceImpl struct{}
182183

183184
func (c *PIIInferenceImpl) ClassifyTokens(text string, configPath string) (candle_binding.TokenClassificationResult, error) {
184185
// Auto-detecting inference - uses whichever classifier was initialized (LoRA or Traditional)
185-
return candle_binding.ClassifyCandleBertTokens(text)
186+
// Load the PII mapping configuration to pass to the classifier
187+
id2labelJSON, err := os.ReadFile(configPath)
188+
if err != nil {
189+
return candle_binding.TokenClassificationResult{}, fmt.Errorf("failed to read PII mapping config %s: %w", configPath, err)
190+
}
191+
return candle_binding.ClassifyCandleBertTokensWithLabels(text, string(id2labelJSON))
186192
}
187193

188194
// createPIIInference creates the PII inference (auto-detecting)

0 commit comments

Comments
 (0)