Fix false positives in agent guardrails
Skip empty fingerprints in SystemPromptLeakGuardrail to prevent blank
values from flagging every message. Replace overly broad "sk-" pattern
in SensitiveDataGuardrail with specific LLM provider prefixes
("sk-proj-" for OpenAI, "sk-ant-" for Anthropic) to avoid false
positives on common words like "risk-based" or "task-management".
Signed-off-by: Bryan Frimin <bryan@getprobo.com>
This commit is contained in:
committed by
Sacha Al Himdani
parent
2f8674471b
commit
4725a1b080
@@ -27,9 +27,12 @@ type SystemPromptLeakGuardrail struct {
|
||||
}
|
||||
|
||||
func NewSystemPromptLeakGuardrail(fingerprints []string) *SystemPromptLeakGuardrail {
|
||||
lowered := make([]string, len(fingerprints))
|
||||
for i, f := range fingerprints {
|
||||
lowered[i] = strings.ToLower(f)
|
||||
lowered := make([]string, 0, len(fingerprints))
|
||||
for _, f := range fingerprints {
|
||||
if f == "" {
|
||||
continue
|
||||
}
|
||||
lowered = append(lowered, strings.ToLower(f))
|
||||
}
|
||||
|
||||
return &SystemPromptLeakGuardrail{fingerprints: lowered}
|
||||
|
||||
Reference in New Issue
Block a user