Skip to content

Commit 8df29e7

Browse files
yossiovadiaclaude
andcommitted
fix(e2e): enable LoRA PII auto-detection for ai-gateway and aibrix E2E tests
Fixes the PII detection test failures for both ai-gateway and aibrix profiles by switching from ModernBERT to LoRA-based PII detection. ## Root Cause Both profiles were using the old ModernBERT PII model instead of the new LoRA-based auto-detection model, causing 0% PII detection accuracy in tests. ## Applied Fixes ### 1. AI Gateway E2E Profile (e2e/profiles/ai-gateway/values.yaml) **Fix 1: LoRA PII Model Configuration** (lines 469-476) Updated classifier.pii_model to use LoRA auto-detection: - model_id: "models/lora_pii_detector_bert-base-uncased_model" - model_type: "auto" (enables LoRA auto-detection) - pii_mapping_path: points to LoRA model's pii_type_mapping.json **Fix 2: Default Decision Fallback** (lines 413-432) Added default_decision to enable PII detection when no route matches: - priority: 0 (lowest, fallback only) - pii_types_allowed: [] (block ALL PII) - Works with policy.go fallback mechanism ### 2. Aibrix Deployment Config (deploy/kubernetes/aibrix/semantic-router-values/values.yaml) **Fix: LoRA PII Model Configuration** (lines 176-183) Same LoRA model update as ai-gateway. Note: Aibrix uses old category-based routing, so no default_decision needed. ## Test Results **AI Gateway**: Verified locally with Kind cluster - 100% PII detection accuracy (100/100 tests) **Aibrix**: Uses same LoRA model configuration, should achieve same 100% accuracy ## Why Both Fixes Were Necessary 1. **LoRA Model**: Switches to the new auto-detection infrastructure 2. **Default Decision** (ai-gateway only): Ensures PII policy applies even when no specific decision matches the request content Fixes #647 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com> Signed-off-by: Yossi Ovadia <yovadia@redhat.com>
1 parent f0d58dd commit 8df29e7

File tree

2 files changed

+31
-6
lines changed

2 files changed

+31
-6
lines changed

deploy/kubernetes/aibrix/semantic-router-values/values.yaml

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -437,11 +437,13 @@ config:
437437
use_cpu: true
438438
category_mapping_path: "models/category_classifier_modernbert-base_model/category_mapping.json"
439439
pii_model:
440-
model_id: "models/pii_classifier_modernbert-base_presidio_token_model"
441-
use_modernbert: true
440+
# Support both traditional (modernbert) and LoRA-based PII detection
441+
# When model_type is "auto", the system will auto-detect LoRA configuration
442+
model_id: "models/lora_pii_detector_bert-base-uncased_model"
443+
model_type: "auto" # Enables LoRA auto-detection
442444
threshold: 0.7
443445
use_cpu: true
444-
pii_mapping_path: "models/pii_classifier_modernbert-base_presidio_token_model/pii_type_mapping.json"
446+
pii_mapping_path: "models/lora_pii_detector_bert-base-uncased_model/pii_type_mapping.json"
445447

446448
keyword_rules:
447449
- name: "thinking"

e2e/profiles/ai-gateway/values.yaml

Lines changed: 26 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -410,6 +410,27 @@ config:
410410
system_prompt: "You are a helpful and knowledgeable assistant. Provide accurate, helpful responses across a wide range of topics."
411411
mode: "replace"
412412

413+
# Default catch-all decision for unmatched requests (E2E PII test fix)
414+
# This ensures PII detection is always enabled via policy.go fallback mechanism
415+
# When no decision matches, CheckPolicy and IsPIIEnabled fall back to this decision
416+
- name: default_decision
417+
description: "Default catch-all decision - blocks all PII for safety"
418+
priority: 0 # Lowest priority
419+
rules:
420+
operator: "OR"
421+
conditions:
422+
- type: "domain"
423+
name: "catch_all_fallback"
424+
modelRefs:
425+
- model: base-model
426+
lora_name: general-expert
427+
use_reasoning: false
428+
plugins:
429+
- type: "pii"
430+
configuration:
431+
enabled: true
432+
pii_types_allowed: [] # Block ALL PII - empty list means nothing allowed
433+
413434
# Strategy for selecting between multiple matching decisions
414435
# Options: "priority" (use decision with highest priority) or "confidence" (use decision with highest confidence)
415436
strategy: "priority"
@@ -467,11 +488,13 @@ config:
467488
use_cpu: true
468489
category_mapping_path: "models/category_classifier_modernbert-base_model/category_mapping.json"
469490
pii_model:
470-
model_id: "models/pii_classifier_modernbert-base_presidio_token_model"
471-
use_modernbert: true
491+
# Support both traditional (modernbert) and LoRA-based PII detection
492+
# When model_type is "auto", the system will auto-detect LoRA configuration
493+
model_id: "models/lora_pii_detector_bert-base-uncased_model"
494+
model_type: "auto" # Enables LoRA auto-detection
472495
threshold: 0.7
473496
use_cpu: true
474-
pii_mapping_path: "models/pii_classifier_modernbert-base_presidio_token_model/pii_type_mapping.json"
497+
pii_mapping_path: "models/lora_pii_detector_bert-base-uncased_model/pii_type_mapping.json"
475498

476499
keyword_rules:
477500
- name: "thinking"

0 commit comments

Comments
 (0)