Classifier Descriptions
Classifier descriptions tell AI Guard which classifiers to use when analyzing text. The SDK provides four options, ranging from zero-configuration defaults to fully custom inline definitions.
Available Types
| Type | Use Case | Configuration Required |
|---|---|---|
ClassifierDescriptionDefault | Use the built-in default profile | None |
ClassifierDescriptionProfile | Select a specific profile by UUID and version | Profile UUID + version |
ClassifierDescriptionCodes | Specify individual classifiers by code | List of classifier codes |
ClassifierDescriptionJson | Provide inline classifier definitions | JSON classifier objects |
Default Profile
Use the built-in classifier profile with no configuration:
from ai_guard.api import ClassifierDescriptionDefault
classifier = ClassifierDescriptionDefault()This is the simplest option and is recommended for getting started. The default profile includes a broad set of classifiers covering common PII patterns.
Changing the Default ProfileThe default classification profile is defined within the OneTrust admin console. It can be changed for a specific customer tenant by a OneTrust administrator, but it is recommended to use specific named profiles instead. See Classification Profiles for details.
Profile-Based Selection
Select a specific classification profile by its UUID and version:
from ai_guard.api import ClassifierDescriptionProfile
classifier = ClassifierDescriptionProfile(
uuid="7dbf380f-0af8-4276-acb0-85413db2dbff",
version=1,
)| Parameter | Type | Description |
|---|---|---|
uuid | str | The UUID of the classification profile |
version | int | The version number of the profile |
Use this when you need a specific set of classifiers tailored to your use case. Profile UUIDs and versions are managed in the OneTrust admin console.
Custom ProfilesCustom classification profiles (self-created profiles) are not currently supported for AI Guard operations. Only system-defined profiles can be referenced.
Code-Based Selection
Specify individual classifiers by their codes:
from ai_guard.api import ClassifierDescriptionCodes, ClassifierDescriptionCode
classifier = ClassifierDescriptionCodes(
codes=[
ClassifierDescriptionCode(code="C1", version=1),
ClassifierDescriptionCode(code="C2", version=2),
]
)| Parameter | Type | Description |
|---|---|---|
codes | list[ClassifierDescriptionCode] | List of classifier codes and versions |
Each ClassifierDescriptionCode requires:
| Parameter | Type | Description |
|---|---|---|
code | str | The classifier code |
version | int | The classifier version |
Use this when you need fine-grained control over exactly which classifiers to apply, rather than using a pre-defined profile.
JSON-Based Definitions
Provide inline classifier definitions as JSON objects:
from ai_guard.api import ClassifierDescriptionJson
classifier = ClassifierDescriptionJson(
classifiers=[{"name": "A"}, {"name": "B"}]
)| Parameter | Type | Description |
|---|---|---|
classifiers | list[dict] | List of classifier definition objects |
This is the most flexible option and allows you to define classifiers inline without referencing pre-existing profiles or codes.
Choosing the Right Option
| Scenario | Recommended Type |
|---|---|
| Getting started / general-purpose classification | ClassifierDescriptionDefault |
| Using an organization-approved classification profile | ClassifierDescriptionProfile |
| Targeting specific classifiers only | ClassifierDescriptionCodes |
| Custom or dynamic classifier configuration | ClassifierDescriptionJson |
Usage in Classification Requests
All classifier description types are used the same way in classification requests:
from ai_guard.api import ClassificationRequest
request = ClassificationRequest(
context={"actor": "user"},
classifier_description=classifier, # Any of the four types
text="Your text to classify",
)
response = client.classify(request)Usage in Streaming
Classifier descriptions are also used with ClassificationStream:
from ai_guard import ClassificationStream
stream = ClassificationStream(
input=source,
classifier_description=classifier, # Any of the four types
client=client,
context={"actor": "agent"},
)What's Next?
- Classify Text β Use classifier descriptions in classification requests
- Classification Profiles β Learn about profile management
- API Reference: Classify Text β REST API classifier description formats
Updated 3 days ago