Quick Start
studio.create_rai_policy()
Parameters
| Parameter | Type | Default | Description |
|---|---|---|---|
name | str | Required | Policy name |
description | str | Required | Policy description |
toxicity_threshold | float | 0.4 | Toxicity detection threshold (0.0-1.0) |
prompt_injection | bool | False | Enable prompt injection detection |
secrets_detection | SecretsAction | DISABLED | How to handle secrets |
pii_detection | dict | None | PII type → action mapping |
banned_topics | list | None | Topics to ban |
nsfw_check | bool | False | Enable NSFW detection |
nsfw_threshold | float | 0.8 | NSFW detection threshold |
allowed_topics | dict | None | Allowed topics config |
keywords | dict | None | Keyword filtering config |
fairness_and_bias | dict | None | Fairness detection config |
Enums
PIIType
PIIAction
SecretsAction
Creating Policies
Basic Policy
Full-Featured Policy
With Advanced Configuration
Getting Policies
Get by ID
List All Policies
Updating Policies
policy.update()
Update via Module
Update Parameters
| Parameter | Type | Description |
|---|---|---|
name | str | New policy name |
description | str | New description |
toxicity_check | dict | Toxicity config |
prompt_injection | dict | Injection detection config |
secrets_detection | dict | Secrets handling config |
pii_detection | dict | PII handling config |
nsfw_check | dict | NSFW detection config |
allowed_topics | dict | Allowed topics config |
banned_topics | dict | Banned topics config |
keywords | dict | Keyword filter config |
fairness_and_bias | dict | Fairness detection config |
Deleting Policies
policy.delete()
Delete via Module
Applying to Agents
At Creation
After Creation
RAIPolicy Properties
| Property | Type | Description |
|---|---|---|
id | str | Policy ID |
name | str | Policy name |
description | str | Policy description |
toxicity_check | dict | Toxicity detection config |
prompt_injection | dict | Injection detection config |
secrets_detection | dict | Secrets handling config |
pii_detection | dict | PII handling config |
nsfw_check | dict | NSFW detection config |
allowed_topics | dict | Allowed topics config |
banned_topics | dict | Banned topics config |
keywords | dict | Keyword filter config |
fairness_and_bias | dict | Fairness detection config |
user_id | str | Owner user ID |
created_at | str | Creation timestamp |
updated_at | str | Last update timestamp |