from mka1 import SDK
with SDK(
bearer_auth="<YOUR_BEARER_TOKEN_HERE>",
) as sdk:
res = sdk.guardrails.update_guardrails(guardrails=[
{
"mode": "ban_words",
"config": {
"words": [
"spam",
"inappropriate",
],
},
},
])
# Handle response
print(res){
"object": "guardrails_settings",
"guardrails": [
{
"mode": "ban_words",
"enabled": true,
"config": {
"words": [
"spam",
"inappropriate"
]
}
}
],
"updated_at": 1704067200
}Update the guardrails configuration for the authenticated user. Configure multiple guardrail modes including ban words (custom word list), prompt injection detection, and system prompt leakage detection. Each guardrail can be individually enabled/disabled with custom thresholds and rejection messages.
from mka1 import SDK
with SDK(
bearer_auth="<YOUR_BEARER_TOKEN_HERE>",
) as sdk:
res = sdk.guardrails.update_guardrails(guardrails=[
{
"mode": "ban_words",
"config": {
"words": [
"spam",
"inappropriate",
],
},
},
])
# Handle response
print(res){
"object": "guardrails_settings",
"guardrails": [
{
"mode": "ban_words",
"enabled": true,
"config": {
"words": [
"spam",
"inappropriate"
]
}
}
],
"updated_at": 1704067200
}Gateway auth: send Authorization: Bearer <mka1-api-key>. For multi-user server-side integrations, you can also send X-On-Behalf-Of: <external-user-id>.
List of guardrails to configure
Show child attributes
Was this page helpful?