aiComplianceCheck Documentation
Purpose
The aiComplianceCheck logic is designed to perform an AI-powered compliance check on a set of data rows. It evaluates each row against user-defined compliance policies, returning a verdict of either "PASS" or "FAIL" along with associated notes for each row. This functionality is particularly important for businesses that need to adhere to regulatory standards and ensure data privacy.
Settings
The aiComplianceCheck logic is configurable through several settings, each having a specific role and impact on its behavior. The following settings are available:
1. Policies
- Input Type: Array of Objects
- Description: This setting accepts a list of compliance policies, where each policy is defined by a label and an optional description. The policies guide the AI on what criteria to assess for compliance.
- Impact: The more policies defined, the stricter the compliance checks become. If no policies are defined, all rows will automatically pass the check.
- Default Value:
[](an empty array)
2. Prompt Template
- Input Type: String
- Description: This field allows users to define a custom prompt template for the AI. It determines how the AI interprets the compliance checks and expectations. The template can include placeholders for data.
- Impact: Modifying the prompt can significantly alter the AI's focus and output. A well-structured prompt template will yield more relevant results.
- Default Value:
""(an empty string)
3. Batch Size
- Input Type: Numeric
- Description: This setting specifies the number of rows to process in each batch sent to the AI for compliance checking. Adjusting the batch size helps manage resource utilization and response time.
- Impact: A smaller batch size may result in quicker failure detection but could increase the total processing time for larger datasets due to more API calls. Conversely, a larger batch size consolidates processing but can lead to timeouts or resource constraints if set too high.
- Default Value:
10
4. Focus Column
- Input Type: String
- Description: This setting specifies a particular column within the data rows that the AI should focus on for compliance checking. If defined, the AI will prioritize this column when issuing compliance judgments.
- Impact: Setting the focus column can help in scenarios where one particular aspect of the data is more critical than others, such as personally identifiable information (PII). If left blank, the AI evaluates all columns.
- Default Value:
""(an empty string)
How It Works
The aiComplianceCheck logic processes data in the following manner:
- Data Input: It first unwraps the incoming data and checks for its validity (ensuring it's an array).
- Policy Validation: If no policies are defined, all rows automatically pass.
- AI Integration: It retrieves a preferred AI integration configuration using the context provided, which is critical for processing compliance checks.
- Batch Processing: The logic splits the data into batches, ensuring that no batch exceeds 50 rows, and processes each batch through the AI to determine compliance based on the defined policies.
- Result Collection: After processing each batch, results are aggregated into
passandfailcategories based on AI responses. - Error Handling: If AI integration fails or there are errors during processing, rows are reported as failing with descriptive notes.
Data Expectations
The aiComplianceCheck logic expects the following data format:
- An array of objects, where each object represents a data row, containing key-value pairs for each relevant data field.
- The rows may contain various fields, which should be accordingly structured, with one of the fields defined as the
focusColumnif applicable.
Use Cases & Examples
Use Case 1: Data Privacy Compliance
A healthcare provider needs to ensure that no records contain personally identifiable information (PII) before sharing data sets with research institutions.
Use Case 2: Family-Safe Content
An online content platform wants to ensure that all uploaded content is appropriate for users of all ages, implementing compliance checks before content goes live.
Example Configuration for Use Case 1
To implement the first use case, where the provider must check for PII, the aiComplianceCheck could be configured as follows:
{
"policies": [
{
"label": "No PII",
"description": "Data must not contain exposed PII"
}
],
"promptTemplate": "Please review the following data rows for PII compliance.",
"batchSize": 5,
"focusColumn": "sensitive_info"
}In this example:
- The policy "No PII" is defined to explicitly guide the AI.
- A custom prompt template has been set to encourage relevant feedback.
- The batch size is set to process 5 rows at a time to balance responsiveness and performance.
- The
focusColumnis set to "sensitive_info" to ensure the AI thoroughly checks this specific aspect for compliance.