Semantic Guardrails
Implement AI-driven policies to protect sensitive data while allowing for flexible access controls.
Semantic Guardrails evaluates and mitigates risks in AI-generated content by scanning conversations for policy violations, sensitive data exposure, and off-topic responses. It enables organizations to enforce data protection policies, monitor data usage, and ensure compliance with regulatory requirements.
For the steps to set up and configure Semantic Guardrails for AI Developer Edition, refer to the Installation and Setup Guide.
1 - Semantic Guardrails Architecture
Architecture of the Semantic Guardrails feature.
GenAI Security Semantic Guardrails solution is a security guardrail engine for AI systems. It evaluates risks in GenAI chatbots, workflows, and agents through advanced semantic analytics and intent classification to detect potentially malicious messages. PII detection can also be leveraged for comprehensive security coverage.
The documentation here for Semantic Guardrails covers its specific requirements and relationship with AI Developer Edition. For more information, refer to the complete body of the Semantic Guardrails documentation.
Overview
Semantic Guardrails is trained on synthetic customer-service AI chatbot datasets. The system performs best when analyzing conversations expected to match the training domain, that is, English-language-based customer service interactions involving orders, tickets, and purchases.
For domain-specific and user-specific applications requiring high detection accuracy, fine-tuning is necessary to completely leverage the model’s ability. This helps the model to learn from expected conversation patterns and message structures in both the inputs and outputs of protected GenAI systems.
The system operates by analyzing conversations between participants. These participants are users and AI systems, such as LLMs, agents, or contextual information sources. Furthermore, the system utilizes Protegrity’s Data Discovery, if present in the same network environment, to leverage PII detection in its internal decision algorithm.
The solution provides individual message risk scores and classifications, and cumulative conversation risk scores and classifications. This dual-scoring approach ensures that while individual messages may appear benign, potentially risky cumulative conversation patterns are identified. This significantly enhances detection of sophisticated attack vectors, including LLM jailbreaks and prompt injection attempts.
Architecture
For more information about the general architecture and working of Semantic Guardrails, refer to General architecture of Semantic Guardrails.
2 - Running the Semantic Guardrails samples
Instructions for running the Semantic Guardrails samples.
The example scripts under the semantic-guardrail/ folder demonstrate the usage of Semantic Guardrails APIs. For more information about the Semantic Guardrails APIs, refer to Semantic Guardrails APIs.
Note: A dedicated semantic-guardrail/docker-compose.yml is provided to start the Data Discovery and the Semantic Guardrails services.
Open a command prompt.
Navigate to the directory where AI Developer Edition is cloned.
Run the following command to test Semantic Guardrails using Python scripts. The following command submits a multi-turn conversation for analysis. One for semantic and a second one for PII processing.
python semantic-guardrail/samples/python/sample-guardrail-python.py
Run the following command to start Jupyter Lab for running Semantic Guardrails.
Copy the URL displayed and navigate to the site from a web browser. Ensure that localhost is replaced with the IP address of the system where the AI Developer Edition is set up.
In the left pane of the Jupyter Lab, navigate to semantic-guardrail/samples/python/sample-app-semantic-guardrails.
Open the Sample Application.ipynb file.
Click the Play icon and follow the prompts in the Jupyter Lab.
3 - Using the Semantic Guardrails APIs
Listing the APIs for the Semantic Guardrails feature.
Semantic Guardrails has the following types of API Endpoints:
For more information about Semantic Guardrails APIs, refer to the complete body of the Semantic Guardrails documentation.
4 - Uninstalling Semantic Guardrails
Instructions for uninstalling the Semantic Guardrails feature.
Open a command prompt.
Navigate to the cloned repository location.
Navigate to the semantic-guardrails directory.
Run the following command to remove the containers and images.
docker compose down --rmi all