-
Notifications
You must be signed in to change notification settings - Fork 8.4k
feat: create guardrails component (#11451) #11671
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
Conversation
* Create guardrails.py * [autofix.ci] apply automated fixes * [autofix.ci] apply automated fixes (attempt 2/3) * Update guardrails.py * [autofix.ci] apply automated fixes * [autofix.ci] apply automated fixes (attempt 2/3) * tests: add unit tests for GuardrailsComponent functionality * [autofix.ci] apply automated fixes * fix: resolve linting errors in GuardrailsComponent and tests - Fix line length issues (E501) by breaking long strings - Fix docstring formatting (D205, D415) in _check_guardrail - Use ternary operator for response content extraction (SIM108) - Replace magic value with named constant (PLR2004) - Move return to else block per try/except best practices (TRY300) - Catch specific exceptions instead of blind Exception (BLE001) - Use list comprehension for checks_to_run (PERF401) - Mark unused variables with underscore prefix (RUF059, F841) - Add noqa comment for intentionally unused mock argument (ARG002) * [autofix.ci] apply automated fixes * refactor: address pr comments * [autofix.ci] apply automated fixes (attempt 2/3) * [autofix.ci] apply automated fixes * feat: enhance heuristic detection with configurable threshold and scoring system * refactor: simplify heuristic test assertions by removing unused variable * [autofix.ci] apply automated fixes * [autofix.ci] apply automated fixes (attempt 2/3) * feat: enhance guardrail validation logic and input handling * refactor: streamline import statements and clean up whitespace in guardrails component * [autofix.ci] apply automated fixes * [autofix.ci] apply automated fixes (attempt 2/3) * Fix: update empty input handling tests to raise ValueError and refactor related assertions * [autofix.ci] apply automated fixes * [autofix.ci] apply automated fixes * feat: add Guardrails component with unit tests Add LLM-based guardrails component for detecting PII, tokens/passwords, jailbreak attempts, and custom guardrail rules, along with comprehensive unit tests. * [autofix.ci] apply automated fixes * fix: try removing logs * [autofix.ci] apply automated fixes --------- Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com> Co-authored-by: Viktor Avelino <viktor.avelino@gmail.com> Co-authored-by: Viktor Avelino <64113566+viktoravelino@users.noreply.github.com>
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## release-v1.8.0 #11671 +/- ##
=================================================
Coverage ? 35.22%
=================================================
Files ? 1521
Lines ? 72936
Branches ? 10937
=================================================
Hits ? 25690
Misses ? 45852
Partials ? 1394
Flags with carried forward coverage won't be shown. Click here to find out more. 🚀 New features to boost your workflow:
|
Create guardrails.py
[autofix.ci] apply automated fixes
[autofix.ci] apply automated fixes (attempt 2/3)
Update guardrails.py
[autofix.ci] apply automated fixes
[autofix.ci] apply automated fixes (attempt 2/3)
tests: add unit tests for GuardrailsComponent functionality
[autofix.ci] apply automated fixes
fix: resolve linting errors in GuardrailsComponent and tests
[autofix.ci] apply automated fixes
refactor: address pr comments
[autofix.ci] apply automated fixes (attempt 2/3)
[autofix.ci] apply automated fixes
feat: enhance heuristic detection with configurable threshold and scoring system
refactor: simplify heuristic test assertions by removing unused variable
[autofix.ci] apply automated fixes
[autofix.ci] apply automated fixes (attempt 2/3)
feat: enhance guardrail validation logic and input handling
refactor: streamline import statements and clean up whitespace in guardrails component
[autofix.ci] apply automated fixes
[autofix.ci] apply automated fixes (attempt 2/3)
Fix: update empty input handling tests to raise ValueError and refactor related assertions
[autofix.ci] apply automated fixes
[autofix.ci] apply automated fixes
feat: add Guardrails component with unit tests
Add LLM-based guardrails component for detecting PII, tokens/passwords, jailbreak attempts, and custom guardrail rules, along with comprehensive unit tests.
[autofix.ci] apply automated fixes
fix: try removing logs
[autofix.ci] apply automated fixes