Login
Get Started

Python Client

Estimated reading: 1 minute 6 views

Python Client

The Carlo Python Client allows developers to integrate governance monitoring and ethical AI controls directly into Python applications.
It provides simple APIs to validate prompts, enforce policies, and monitor AI interactions.

Installation

Install the Carlo Python SDK using pip.
pip install carlo-ai
Import the SDK
Import the Carlo module in your Python application.
import carlo

Initialize Carlo Guardian
Create a Guardian instance using your API key.

guardian = carlo.Guardian(
api_key=”YOUR_API_KEY”)

This Guardian will monitor and enforce policies for all AI interactions.

Validate a Prompt

Use the Guardian to validate prompts before sending them to an AI model.

prompt = “Explain artificial intelligence.”
validated_prompt = guardian.validate_prompt(prompt)
print(validated_prompt)

If the prompt violates governance policies, Carlo will block or modify it.

Deploy Policies

Policies can be deployed to enforce governance rules.

guardian.deploy_policy(“block_harmful_content”)

Once deployed, the policy will automatically apply to all requests.
Monitor Requests

All requests passing through Carlo are logged for auditing and compliance monitoring.
You can review these logs through the Carlo dashboard.

Leave a Comment

Share this Doc

Python Client

Or copy link

CONTENTS
Need Help? Chat with us
Compliance Intake

Talk to Compliance Support

Share a few details so we can route you to the right compliance expert.

This site is registered on wpml.org as a development site. Switch to a production site key to remove this banner.