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

TypeUse CaseConfiguration Required
ClassifierDescriptionDefaultUse the built-in default profileNone
ClassifierDescriptionProfileSelect a specific profile by UUID and versionProfile UUID + version
ClassifierDescriptionCodesSpecify individual classifiers by codeList of classifier codes
ClassifierDescriptionJsonProvide inline classifier definitionsJSON 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 Profile

The 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,
)
ParameterTypeDescription
uuidstrThe UUID of the classification profile
versionintThe 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 Profiles

Custom 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),
    ]
)
ParameterTypeDescription
codeslist[ClassifierDescriptionCode]List of classifier codes and versions

Each ClassifierDescriptionCode requires:

ParameterTypeDescription
codestrThe classifier code
versionintThe 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"}]
)
ParameterTypeDescription
classifierslist[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

ScenarioRecommended Type
Getting started / general-purpose classificationClassifierDescriptionDefault
Using an organization-approved classification profileClassifierDescriptionProfile
Targeting specific classifiers onlyClassifierDescriptionCodes
Custom or dynamic classifier configurationClassifierDescriptionJson

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?