Private AI allows you to detect and mask Personally Identifiable Information (PII) in your data. This integration enables NeMo Guardrails to use Private AI for PII detection in input, output and retrieval flows.
-
Ensure that you have access to Private AI API server running locally or in the cloud. To get started with the cloud version, you can use the Private AI Portal. For containerized deployments, check out this Quickstart Guide.
-
Update your
config.yml
file to include the Private AI settings:
rails:
config:
privateai:
server_endpoint: http://your-privateai-api-endpoint/process/text # Replace this with your Private AI process text endpoint
input:
entities: # If no entity is specified here, all supported entities will be detected by default.
- NAME_FAMILY
- LOCATION_ADDRESS_STREET
- EMAIL_ADDRESS
output:
entities:
- NAME_FAMILY
- LOCATION_ADDRESS_STREET
- EMAIL_ADDRESS
input:
flows:
- detect pii on input
output:
flows:
- detect pii on output
Replace http://your-privateai-api-endpoint/process/text
with your actual Private AI process text endpoint and set the PAI_API_KEY
environment variable if you're using the Private AI cloud API.
- You can customize the
entities
list under bothinput
andoutput
to include the PII types you want to detect. A full list of supported entities can be found here.
Once configured, the Private AI integration will automatically:
- Detect PII in user inputs before they are processed by the LLM.
- Detect PII in LLM outputs before they are sent back to the user.
- Detect PII in retrieved chunks before they are sent to the LLM.
The detect_pii
action in nemoguardrails/library/privateai/actions.py
handles the PII detection process.
You can customize the PII detection behavior by modifying the entities
lists in the config.yml
file. Refer to the Private AI documentation for a complete list of supported entity types.
If the Private AI detection API request fails, the system will assume PII is present as a precautionary measure.
- Ensure that your Private AI process text endpoint is properly set up and accessible from your NeMo Guardrails environment.
- The integration currently supports PII detection only.
For more information on Private AI and its capabilities, please refer to the Private AI documentation.