Use the AI Guardrails SDK for Python to delete a business scenario that is no longer needed.
Only delete a business scenario that is not currently in use. If you call DeleteBizType on an active business scenario, the customized moderation policy tied to it becomes unavailable and falls back to the default moderation policy, which may cause errors in your moderation results.
Prerequisites
Before you begin, ensure that you have:
Python dependencies installed using the Python version specified in the Installation guide — using a different Python version causes subsequent operation calls to fail
The Extension.Uploader utility class downloaded and imported into your project
Delete a business scenario
Call DeleteBizType to delete a business scenario by name.
| Operation | Description | Supported regions |
|---|---|---|
| DeleteBizType | Deletes a business scenario | cn-shanghai (China (Shanghai)), cn-beijing (China (Beijing)), cn-shenzhen (China (Shenzhen)), ap-southeast-1 (Singapore) |
# coding=utf-8
from aliyunsdkcore import client
from aliyunsdkcore.profile import region_provider
from aliyunsdkgreen.request.v20170823 import DeleteBizTypeRequest
# Reuse the client instance across requests to improve performance
# and avoid repeated connection overhead.
# Get your RAM user credentials from environment variables:
# AccessKey ID: os.environ['ALIBABA_CLOUD_ACCESS_KEY_ID']
# AccessKey secret: os.environ['ALIBABA_CLOUD_ACCESS_KEY_SECRET']
clt = client.AcsClient("We recommend that you obtain the AccessKey ID of your RAM user from environment variables", "We recommend that you obtain the AccessKey secret of your RAM user from environment variables", "cn-shanghai")
region_provider.modify_point('Green', "cn-shanghai", 'green.cn-shanghai.aliyuncs.com')
request = DeleteBizTypeRequest.DeleteBizTypeRequest()
# Specify the name of the business scenario to delete.
request.set_BizTypeName("The name of the business scenario")
request.set_accept_format('JSON')
response = clt.do_action_with_exception(request)
print(response)What's next
DeleteBizType API reference — full parameter reference for the delete operation
Installation — SDK setup and Python version requirements