Skip to content

feat: azure plugin support for pii and content safety#1048

Merged
VisargD merged 6 commits into
Portkey-AI:mainfrom
b4s36t4:feat/azure-guardrail-plugin
Apr 22, 2025
Merged

feat: azure plugin support for pii and content safety#1048
VisargD merged 6 commits into
Portkey-AI:mainfrom
b4s36t4:feat/azure-guardrail-plugin

Conversation

@b4s36t4

@b4s36t4 b4s36t4 commented Apr 18, 2025

Copy link
Copy Markdown
Contributor

Code Quality new feature

Author Description

(optional)

  • Detailed change 1
  • Detailed change 2

Title: feat: azure plugin support for pii and content safety

🔄 What Changed

  • Added Azure AI plugin support for PII detection and content safety moderation
  • Implemented multiple authentication methods (API Key, Entra ID, Managed Identity)
  • Created utility functions for Azure token management and caching
  • Added comprehensive test suite for both PII and Content Safety functionality

🔍 Impact of the Change

  • Users can now detect and redact PII information in text using Azure AI services
  • Content moderation capabilities allow screening for harmful content categories
  • Support for different authentication methods provides flexibility for various Azure setups
  • Extends the gateway's plugin ecosystem with Azure AI capabilities

📁 Total Files Changed

  • 7 files changed (6 new, 1 modified)
  • 747 lines added, 0 lines deleted

🧪 Test Added

  • Tests for PII detection with API Key and Entra ID authentication
  • Tests for Content Safety analysis with different severity thresholds
  • Error handling tests for invalid credentials
  • Tests for redaction functionality

🔒 Security Vulnerabilities

N/A - No security vulnerabilities identified. Implementation includes proper credential validation, token caching, and secure authentication methods.

Quality Recommendations

  1. Add input validation for severity thresholds in the contentSafety.ts file

  2. Implement more robust error handling in the utils.ts file for network failures

  3. Add JSDoc comments to exported functions for better documentation

  4. Consider adding a timeout parameter to getAccessToken function for more control

@b4s36t4

b4s36t4 commented Apr 18, 2025

Copy link
Copy Markdown
Contributor Author

/matter review

@matterai-app matterai-app 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.

Thank you for implementing the Azure AI plugins for PII detection and content safety. The code is well-structured and provides valuable functionality. I have a few suggestions to improve error handling, input validation, and code robustness.

Comment thread plugins/azure/contentSafety.ts
Comment thread plugins/azure/contentSafety.ts
Comment thread plugins/azure/contentSafety.ts
Comment thread plugins/azure/contentSafety.ts
Comment thread plugins/azure/pii.ts
Comment thread plugins/azure/pii.ts
Comment thread plugins/azure/utils.ts
@VisargD VisargD merged commit 36a5e5e into Portkey-AI:main Apr 22, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants