Skip to content

fix(library): use bot refuse to respond in gliner PII detection flows - #1671

Merged
Pouyanpi merged 1 commit into
developfrom
fix/gliner-pii-refuse-to-respond
Mar 3, 2026
Merged

fix(library): use bot refuse to respond in gliner PII detection flows#1671
Pouyanpi merged 1 commit into
developfrom
fix/gliner-pii-refuse-to-respond

Conversation

@Pouyanpi

Copy link
Copy Markdown
Collaborator

Description

GLiNER PII detection was using "bot inform answer unknown" which returned a misleading "I don't know" message. Replaced with "bot refuse to respond" to correctly indicate an intentional block, consistent with all other rails.

@Pouyanpi Pouyanpi self-assigned this Feb 26, 2026
@Pouyanpi Pouyanpi added the bug Something isn't working label Feb 26, 2026
@Pouyanpi Pouyanpi added this to the v0.21 milestone Feb 26, 2026
@Pouyanpi
Pouyanpi requested a review from tgasser-nv February 26, 2026 07:50
@greptile-apps

greptile-apps Bot commented Feb 26, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

This PR correctly replaces bot inform answer unknown ("I don't know") with bot refuse to respond ("I'm sorry, I can't respond to that.") in GLiNER PII detection flows. This semantic improvement clarifies that PII detection is an intentional block rather than expressing uncertainty.

Key changes:

  • Updated three detection flows in both flows.co and flows.v1.co (input, output, retrieval)
  • Removed custom test definitions and updated expected messages to match the standard refusal message
  • Aligns with regex detection library pattern

Note: Other PII detection libraries (privateai, pangea, patronusai) still use bot inform answer unknown. Consider standardizing these in a follow-up PR for consistency across all PII detection implementations.

Confidence Score: 5/5

  • This PR is safe to merge with no issues detected
  • The changes are straightforward, semantically correct, and properly tested. The refactoring improves message clarity by replacing "I don't know" with "I can't respond to that" for PII blocking scenarios. All test assertions are correctly updated to match the new standard message.
  • No files require special attention

Important Files Changed

Filename Overview
nemoguardrails/library/gliner/flows.co Replaced bot inform answer unknown with bot refuse to respond in three PII detection flows (input, output, retrieval) - semantically correct change
nemoguardrails/library/gliner/flows.v1.co Same changes as flows.co but for v1 syntax - replaced bot inform answer unknown with bot refuse to respond in three subflows
tests/test_gliner.py Removed custom bot inform answer unknown definitions and updated test assertions to expect "I'm sorry, I can't respond to that." message

Last reviewed commit: 024aa8d

@greptile-apps greptile-apps Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

3 files reviewed, no comments

Edit Code Review Agent Settings | Greptile

@codecov

codecov Bot commented Feb 26, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@tgasser-nv tgasser-nv left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Looks good, do you need to add define bot refuse to respond at the top of the Colang flows.co file like the content-safety, topic-safety, etc?

library $ find . -name 'flows.v1.co' -exec grep -Hn 'define bot refuse to respond' {} \;
./jailbreak_detection/flows.v1.co:1:define bot refuse to respond
./llama_guard/flows.v1.co:1:define bot refuse to respond
./content_safety/flows.v1.co:1:define bot refuse to respond
./regex/flows.v1.co:1:define bot refuse to respond
./topic_safety/flows.v1.co:3:define bot refuse to respond
./fiddler/flows.v1.co:1:define bot refuse to respond
./autoalign/flows.v1.co:37:define bot refuse to respond
./self_check/input_check/flows.v1.co:1:define bot refuse to respond
./self_check/output_check/flows.v1.co:1:define bot refuse to respond
./self_check/facts/flows.v1.co:1:define bot refuse to respond

Also could you do a local integration test (instructions are here) to make sure there are no errors and the response is correct?

@Pouyanpi
Pouyanpi merged commit e5c8c91 into develop Mar 3, 2026
16 checks passed
@Pouyanpi
Pouyanpi deleted the fix/gliner-pii-refuse-to-respond branch March 3, 2026 12:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants