Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

detector: add startswith matching for StringDetector base class #1075

Merged
merged 3 commits into from
Jan 17, 2025

Conversation

leondz
Copy link
Collaborator

@leondz leondz commented Jan 15, 2025

Adds a new match type for the StringDetector that fires when the output starts with any of the candidate match strings.

e.g. with "test" in the match strings:

    test_cases = [
        ("this is a test", False),
        ("tests always succeed", True),
    ]

Case sensitivity test also added. Thanks @Eric-Hacker for the implicit suggestion & test case in #1054 .

Verification

  • python -m pytest tests/detectors/test_detectors_base.py

@leondz leondz added the detectors work on code that inherits from or manages Detector label Jan 15, 2025
@leondz leondz requested a review from jmartin-tech January 15, 2025 07:56
tests/detectors/test_detectors_base.py Show resolved Hide resolved
tests/detectors/test_detectors_base.py Outdated Show resolved Hide resolved
@leondz leondz requested a review from jmartin-tech January 17, 2025 15:09
@jmartin-tech jmartin-tech merged commit 81bf441 into NVIDIA:main Jan 17, 2025
9 checks passed
@github-actions github-actions bot locked and limited conversation to collaborators Jan 17, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
detectors work on code that inherits from or manages Detector
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants