Python SDK
The wonderfence-sdk package wraps the Alice evaluate API. Every call returns an action (BLOCK, MASK, DETECT or NO_ACTION), the masked or block text, and the detections that fired, so your code decides what to do next.
Status: Generally available · Evaluates: Prompts, Responses · Vendor: Alice
User prompts, model responses and images. Session and user ids ride along for tracing.
Setup
pip install wonderfence-sdk
Configuration: ALICE_API_KEY, app_id
Example
from wonderfence_sdk.client import WonderFenceV2Client
from wonderfence_sdk.models import AnalysisContext
client = WonderFenceV2Client(api_key="your_api_key")
context = AnalysisContext(session_id="session_id", user_id="user_id")
app_id = "your-app-uuid"
# Synchronous
result = client.evaluate_prompt_sync(app_id=app_id, context=context, prompt="Your prompt text")
result = client.evaluate_response_sync(app_id=app_id, context=context, response="Response text")
# Asynchronous
result = await client.evaluate_prompt(app_id=app_id, context=context, prompt="Your prompt text")
result = await client.evaluate_response(app_id=app_id, context=context, response="Response text")
Good to know
The app_id comes from your Application Inventory and selects which policies apply. Text and image inputs are mutually exclusive per call.