from meetkai_mka1 import SDK
with SDK(
bearer_auth="<YOUR_BEARER_TOKEN_HERE>",
) as sdk:
res = sdk.guardrails.update_cluster_default_guardrails(enabled=True, guardrails=[
{
"mode": "prompt_injection",
"enabled": True,
"config": {
"threshold": 0.7,
},
},
{
"mode": "leakage",
"enabled": True,
"config": {
"threshold": 0.7,
},
},
{
"mode": "classifier",
"enabled": True,
"config": {
"model": "meetkai:custom-classifier",
"prompt": "Block content that expresses hate toward people based on a protected characteristic, threatens or glorifies violence, is sexually explicit or sexualizes minors, or encourages or instructs self-harm. Allow neutral educational, news, medical and support discussion of these topics.",
"on_error": "fail_closed",
"rejection_message": "This request is not allowed by your organization's content policy.",
},
},
])
# Handle response
print(res)import { SDK } from "@meetkai/mka1";
const sdk = new SDK({
bearerAuth: "<YOUR_BEARER_TOKEN_HERE>",
});
async function run() {
const result = await sdk.guardrails.updateClusterDefaultGuardrails({
enabled: true,
guardrails: [
{
mode: "prompt_injection",
enabled: true,
config: {
threshold: 0.7,
},
},
{
mode: "leakage",
enabled: true,
config: {
threshold: 0.7,
},
},
{
mode: "classifier",
enabled: true,
config: {
model: "meetkai:custom-classifier",
prompt: "Block content that expresses hate toward people based on a protected characteristic, threatens or glorifies violence, is sexually explicit or sexualizes minors, or encourages or instructs self-harm. Allow neutral educational, news, medical and support discussion of these topics.",
onError: "fail_closed",
rejectionMessage: "This request is not allowed by your organization's content policy.",
},
},
],
});
console.log(result);
}
run();using MeetKai.MKA1;
using MeetKai.MKA1.Types.Components;
using System.Collections.Generic;
var sdk = new SDK(bearerAuth: "<YOUR_BEARER_TOKEN_HERE>");
UpdateClusterDefaultGuardrailsRequest req = new UpdateClusterDefaultGuardrailsRequest() {
Enabled = true,
Guardrails = new List<GuardrailConfig>() {
GuardrailConfig.CreatePromptInjection(
new PromptInjectionGuardrail() {
Config = new PromptInjectionConfig() {},
}
),
GuardrailConfig.CreateLeakage(
new LeakageGuardrail() {
Config = new LeakageConfig() {},
}
),
GuardrailConfig.CreateClassifier(
new ClassifierGuardrail() {
Config = new ClassifierConfig() {
Model = "meetkai:custom-classifier",
Prompt = "Block content that expresses hate toward people based on a protected characteristic, threatens or glorifies violence, is sexually explicit or sexualizes minors, or encourages or instructs self-harm. Allow neutral educational, news, medical and support discussion of these topics.",
},
}
),
},
};
var res = await sdk.Guardrails.UpdateClusterDefaultGuardrailsAsync(req);
// handle responsecurl --request PUT \
--url https://apigw.mka1.com/api/v1/llm/guardrails/cluster-default \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data @- <<EOF
{
"enabled": true,
"guardrails": [
{
"mode": "prompt_injection",
"enabled": true,
"config": {
"threshold": 0.7
}
},
{
"mode": "leakage",
"enabled": true,
"config": {
"threshold": 0.7
}
},
{
"mode": "classifier",
"enabled": true,
"config": {
"model": "meetkai:custom-classifier",
"prompt": "Block content that expresses hate toward people based on a protected characteristic, threatens or glorifies violence, is sexually explicit or sexualizes minors, or encourages or instructs self-harm. Allow neutral educational, news, medical and support discussion of these topics.",
"on_error": "fail_closed",
"rejection_message": "This request is not allowed by your organization's content policy."
}
}
]
}
EOFconst options = {
method: 'PUT',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
enabled: true,
guardrails: [
{mode: 'prompt_injection', enabled: true, config: {threshold: 0.7}},
{mode: 'leakage', enabled: true, config: {threshold: 0.7}},
{
mode: 'classifier',
enabled: true,
config: {
model: 'meetkai:custom-classifier',
prompt: 'Block content that expresses hate toward people based on a protected characteristic, threatens or glorifies violence, is sexually explicit or sexualizes minors, or encourages or instructs self-harm. Allow neutral educational, news, medical and support discussion of these topics.',
on_error: 'fail_closed',
rejection_message: 'This request is not allowed by your organization\'s content policy.'
}
}
]
})
};
fetch('https://apigw.mka1.com/api/v1/llm/guardrails/cluster-default', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://apigw.mka1.com/api/v1/llm/guardrails/cluster-default",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_POSTFIELDS => json_encode([
'enabled' => true,
'guardrails' => [
[
'mode' => 'prompt_injection',
'enabled' => true,
'config' => [
'threshold' => 0.7
]
],
[
'mode' => 'leakage',
'enabled' => true,
'config' => [
'threshold' => 0.7
]
],
[
'mode' => 'classifier',
'enabled' => true,
'config' => [
'model' => 'meetkai:custom-classifier',
'prompt' => 'Block content that expresses hate toward people based on a protected characteristic, threatens or glorifies violence, is sexually explicit or sexualizes minors, or encourages or instructs self-harm. Allow neutral educational, news, medical and support discussion of these topics.',
'on_error' => 'fail_closed',
'rejection_message' => 'This request is not allowed by your organization\'s content policy.'
]
]
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://apigw.mka1.com/api/v1/llm/guardrails/cluster-default"
payload := strings.NewReader("{\n \"enabled\": true,\n \"guardrails\": [\n {\n \"mode\": \"prompt_injection\",\n \"enabled\": true,\n \"config\": {\n \"threshold\": 0.7\n }\n },\n {\n \"mode\": \"leakage\",\n \"enabled\": true,\n \"config\": {\n \"threshold\": 0.7\n }\n },\n {\n \"mode\": \"classifier\",\n \"enabled\": true,\n \"config\": {\n \"model\": \"meetkai:custom-classifier\",\n \"prompt\": \"Block content that expresses hate toward people based on a protected characteristic, threatens or glorifies violence, is sexually explicit or sexualizes minors, or encourages or instructs self-harm. Allow neutral educational, news, medical and support discussion of these topics.\",\n \"on_error\": \"fail_closed\",\n \"rejection_message\": \"This request is not allowed by your organization's content policy.\"\n }\n }\n ]\n}")
req, _ := http.NewRequest("PUT", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.put("https://apigw.mka1.com/api/v1/llm/guardrails/cluster-default")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"enabled\": true,\n \"guardrails\": [\n {\n \"mode\": \"prompt_injection\",\n \"enabled\": true,\n \"config\": {\n \"threshold\": 0.7\n }\n },\n {\n \"mode\": \"leakage\",\n \"enabled\": true,\n \"config\": {\n \"threshold\": 0.7\n }\n },\n {\n \"mode\": \"classifier\",\n \"enabled\": true,\n \"config\": {\n \"model\": \"meetkai:custom-classifier\",\n \"prompt\": \"Block content that expresses hate toward people based on a protected characteristic, threatens or glorifies violence, is sexually explicit or sexualizes minors, or encourages or instructs self-harm. Allow neutral educational, news, medical and support discussion of these topics.\",\n \"on_error\": \"fail_closed\",\n \"rejection_message\": \"This request is not allowed by your organization's content policy.\"\n }\n }\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://apigw.mka1.com/api/v1/llm/guardrails/cluster-default")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Put.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"enabled\": true,\n \"guardrails\": [\n {\n \"mode\": \"prompt_injection\",\n \"enabled\": true,\n \"config\": {\n \"threshold\": 0.7\n }\n },\n {\n \"mode\": \"leakage\",\n \"enabled\": true,\n \"config\": {\n \"threshold\": 0.7\n }\n },\n {\n \"mode\": \"classifier\",\n \"enabled\": true,\n \"config\": {\n \"model\": \"meetkai:custom-classifier\",\n \"prompt\": \"Block content that expresses hate toward people based on a protected characteristic, threatens or glorifies violence, is sexually explicit or sexualizes minors, or encourages or instructs self-harm. Allow neutral educational, news, medical and support discussion of these topics.\",\n \"on_error\": \"fail_closed\",\n \"rejection_message\": \"This request is not allowed by your organization's content policy.\"\n }\n }\n ]\n}"
response = http.request(request)
puts response.read_body{
"object": "guardrails_cluster_default",
"enabled": true,
"guardrails": [
{
"mode": "prompt_injection",
"enabled": true,
"config": {
"threshold": 0.7
}
},
{
"mode": "leakage",
"enabled": true,
"config": {
"threshold": 0.7
}
},
{
"mode": "classifier",
"enabled": true,
"config": {
"model": "meetkai:custom-classifier",
"prompt": "Block content that expresses hate toward people based on a protected characteristic, threatens or glorifies violence, is sexually explicit or sexualizes minors, or encourages or instructs self-harm. Allow neutral educational, news, medical and support discussion of these topics.",
"on_error": "fail_closed",
"rejection_message": "This request is not allowed by your organization's content policy."
}
}
],
"built_in": false,
"settings_unreadable": false,
"updated_by": "user-cluster-admin-1",
"updated_at": "2026-10-16T12:00:00.000Z"
}Atualizar as proteções padrão do cluster
Substitua as proteções padrão aplicadas a todas as organizações inscritas e ative-as ou desative-as para todo o cluster. Os administradores da organização podem adicionar regras além do padrão do cluster, mas não podem enfraquecê-lo ou removê-lo. Os modelos classificadores devem estar ativos no registro da organização do cluster; suas chamadas são executadas e contabilizadas como a organização do cluster, de modo que os inquilinos não precisam de acesso ao modelo e seus orçamentos não são cobrados.
from meetkai_mka1 import SDK
with SDK(
bearer_auth="<YOUR_BEARER_TOKEN_HERE>",
) as sdk:
res = sdk.guardrails.update_cluster_default_guardrails(enabled=True, guardrails=[
{
"mode": "prompt_injection",
"enabled": True,
"config": {
"threshold": 0.7,
},
},
{
"mode": "leakage",
"enabled": True,
"config": {
"threshold": 0.7,
},
},
{
"mode": "classifier",
"enabled": True,
"config": {
"model": "meetkai:custom-classifier",
"prompt": "Block content that expresses hate toward people based on a protected characteristic, threatens or glorifies violence, is sexually explicit or sexualizes minors, or encourages or instructs self-harm. Allow neutral educational, news, medical and support discussion of these topics.",
"on_error": "fail_closed",
"rejection_message": "This request is not allowed by your organization's content policy.",
},
},
])
# Handle response
print(res)import { SDK } from "@meetkai/mka1";
const sdk = new SDK({
bearerAuth: "<YOUR_BEARER_TOKEN_HERE>",
});
async function run() {
const result = await sdk.guardrails.updateClusterDefaultGuardrails({
enabled: true,
guardrails: [
{
mode: "prompt_injection",
enabled: true,
config: {
threshold: 0.7,
},
},
{
mode: "leakage",
enabled: true,
config: {
threshold: 0.7,
},
},
{
mode: "classifier",
enabled: true,
config: {
model: "meetkai:custom-classifier",
prompt: "Block content that expresses hate toward people based on a protected characteristic, threatens or glorifies violence, is sexually explicit or sexualizes minors, or encourages or instructs self-harm. Allow neutral educational, news, medical and support discussion of these topics.",
onError: "fail_closed",
rejectionMessage: "This request is not allowed by your organization's content policy.",
},
},
],
});
console.log(result);
}
run();using MeetKai.MKA1;
using MeetKai.MKA1.Types.Components;
using System.Collections.Generic;
var sdk = new SDK(bearerAuth: "<YOUR_BEARER_TOKEN_HERE>");
UpdateClusterDefaultGuardrailsRequest req = new UpdateClusterDefaultGuardrailsRequest() {
Enabled = true,
Guardrails = new List<GuardrailConfig>() {
GuardrailConfig.CreatePromptInjection(
new PromptInjectionGuardrail() {
Config = new PromptInjectionConfig() {},
}
),
GuardrailConfig.CreateLeakage(
new LeakageGuardrail() {
Config = new LeakageConfig() {},
}
),
GuardrailConfig.CreateClassifier(
new ClassifierGuardrail() {
Config = new ClassifierConfig() {
Model = "meetkai:custom-classifier",
Prompt = "Block content that expresses hate toward people based on a protected characteristic, threatens or glorifies violence, is sexually explicit or sexualizes minors, or encourages or instructs self-harm. Allow neutral educational, news, medical and support discussion of these topics.",
},
}
),
},
};
var res = await sdk.Guardrails.UpdateClusterDefaultGuardrailsAsync(req);
// handle responsecurl --request PUT \
--url https://apigw.mka1.com/api/v1/llm/guardrails/cluster-default \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data @- <<EOF
{
"enabled": true,
"guardrails": [
{
"mode": "prompt_injection",
"enabled": true,
"config": {
"threshold": 0.7
}
},
{
"mode": "leakage",
"enabled": true,
"config": {
"threshold": 0.7
}
},
{
"mode": "classifier",
"enabled": true,
"config": {
"model": "meetkai:custom-classifier",
"prompt": "Block content that expresses hate toward people based on a protected characteristic, threatens or glorifies violence, is sexually explicit or sexualizes minors, or encourages or instructs self-harm. Allow neutral educational, news, medical and support discussion of these topics.",
"on_error": "fail_closed",
"rejection_message": "This request is not allowed by your organization's content policy."
}
}
]
}
EOFconst options = {
method: 'PUT',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
enabled: true,
guardrails: [
{mode: 'prompt_injection', enabled: true, config: {threshold: 0.7}},
{mode: 'leakage', enabled: true, config: {threshold: 0.7}},
{
mode: 'classifier',
enabled: true,
config: {
model: 'meetkai:custom-classifier',
prompt: 'Block content that expresses hate toward people based on a protected characteristic, threatens or glorifies violence, is sexually explicit or sexualizes minors, or encourages or instructs self-harm. Allow neutral educational, news, medical and support discussion of these topics.',
on_error: 'fail_closed',
rejection_message: 'This request is not allowed by your organization\'s content policy.'
}
}
]
})
};
fetch('https://apigw.mka1.com/api/v1/llm/guardrails/cluster-default', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://apigw.mka1.com/api/v1/llm/guardrails/cluster-default",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_POSTFIELDS => json_encode([
'enabled' => true,
'guardrails' => [
[
'mode' => 'prompt_injection',
'enabled' => true,
'config' => [
'threshold' => 0.7
]
],
[
'mode' => 'leakage',
'enabled' => true,
'config' => [
'threshold' => 0.7
]
],
[
'mode' => 'classifier',
'enabled' => true,
'config' => [
'model' => 'meetkai:custom-classifier',
'prompt' => 'Block content that expresses hate toward people based on a protected characteristic, threatens or glorifies violence, is sexually explicit or sexualizes minors, or encourages or instructs self-harm. Allow neutral educational, news, medical and support discussion of these topics.',
'on_error' => 'fail_closed',
'rejection_message' => 'This request is not allowed by your organization\'s content policy.'
]
]
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://apigw.mka1.com/api/v1/llm/guardrails/cluster-default"
payload := strings.NewReader("{\n \"enabled\": true,\n \"guardrails\": [\n {\n \"mode\": \"prompt_injection\",\n \"enabled\": true,\n \"config\": {\n \"threshold\": 0.7\n }\n },\n {\n \"mode\": \"leakage\",\n \"enabled\": true,\n \"config\": {\n \"threshold\": 0.7\n }\n },\n {\n \"mode\": \"classifier\",\n \"enabled\": true,\n \"config\": {\n \"model\": \"meetkai:custom-classifier\",\n \"prompt\": \"Block content that expresses hate toward people based on a protected characteristic, threatens or glorifies violence, is sexually explicit or sexualizes minors, or encourages or instructs self-harm. Allow neutral educational, news, medical and support discussion of these topics.\",\n \"on_error\": \"fail_closed\",\n \"rejection_message\": \"This request is not allowed by your organization's content policy.\"\n }\n }\n ]\n}")
req, _ := http.NewRequest("PUT", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.put("https://apigw.mka1.com/api/v1/llm/guardrails/cluster-default")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"enabled\": true,\n \"guardrails\": [\n {\n \"mode\": \"prompt_injection\",\n \"enabled\": true,\n \"config\": {\n \"threshold\": 0.7\n }\n },\n {\n \"mode\": \"leakage\",\n \"enabled\": true,\n \"config\": {\n \"threshold\": 0.7\n }\n },\n {\n \"mode\": \"classifier\",\n \"enabled\": true,\n \"config\": {\n \"model\": \"meetkai:custom-classifier\",\n \"prompt\": \"Block content that expresses hate toward people based on a protected characteristic, threatens or glorifies violence, is sexually explicit or sexualizes minors, or encourages or instructs self-harm. Allow neutral educational, news, medical and support discussion of these topics.\",\n \"on_error\": \"fail_closed\",\n \"rejection_message\": \"This request is not allowed by your organization's content policy.\"\n }\n }\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://apigw.mka1.com/api/v1/llm/guardrails/cluster-default")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Put.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"enabled\": true,\n \"guardrails\": [\n {\n \"mode\": \"prompt_injection\",\n \"enabled\": true,\n \"config\": {\n \"threshold\": 0.7\n }\n },\n {\n \"mode\": \"leakage\",\n \"enabled\": true,\n \"config\": {\n \"threshold\": 0.7\n }\n },\n {\n \"mode\": \"classifier\",\n \"enabled\": true,\n \"config\": {\n \"model\": \"meetkai:custom-classifier\",\n \"prompt\": \"Block content that expresses hate toward people based on a protected characteristic, threatens or glorifies violence, is sexually explicit or sexualizes minors, or encourages or instructs self-harm. Allow neutral educational, news, medical and support discussion of these topics.\",\n \"on_error\": \"fail_closed\",\n \"rejection_message\": \"This request is not allowed by your organization's content policy.\"\n }\n }\n ]\n}"
response = http.request(request)
puts response.read_body{
"object": "guardrails_cluster_default",
"enabled": true,
"guardrails": [
{
"mode": "prompt_injection",
"enabled": true,
"config": {
"threshold": 0.7
}
},
{
"mode": "leakage",
"enabled": true,
"config": {
"threshold": 0.7
}
},
{
"mode": "classifier",
"enabled": true,
"config": {
"model": "meetkai:custom-classifier",
"prompt": "Block content that expresses hate toward people based on a protected characteristic, threatens or glorifies violence, is sexually explicit or sexualizes minors, or encourages or instructs self-harm. Allow neutral educational, news, medical and support discussion of these topics.",
"on_error": "fail_closed",
"rejection_message": "This request is not allowed by your organization's content policy."
}
}
],
"built_in": false,
"settings_unreadable": false,
"updated_by": "user-cluster-admin-1",
"updated_at": "2026-10-16T12:00:00.000Z"
}Autorizações
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>.
Corpo
Switch do cluster. Quando falso, o padrão do cluster se aplica a nenhuma organização.
Guardrails aplicados em todas as organizações inscritas. Os modelos classificadores são resolvidos no registro da organização do cluster e faturados para ela.
Guia de palavras proibidas
- Option 1
- Option 2
- Option 3
- Option 4
Show child attributes
Show child attributes
Resposta
OK
Switch do cluster. Quando falso, o padrão do cluster se aplica a nenhuma organização.
Restrições aplicadas a cada organização inscrita
Guia de palavras proibidas
- Option 1
- Option 2
- Option 3
- Option 4
Show child attributes
Show child attributes
Verdadeiro enquanto o cluster estiver executando o padrão interno (detecção de injeção de prompt e vazamento) porque nenhum operador salvou um
Verdadeiro quando o padrão do cluster salvo não pode ser lido: as regras integradas mostradas aqui são aplicadas em seu lugar. Salve uma política para substituí-lo; não salve estas regras de volta, a menos que isso seja intencional
Usuário que alterou por último o padrão do cluster; nulo enquanto o padrão integrado se aplica
Quando o padrão do cluster foi alterado pela última vez; nulo enquanto o padrão integrado se aplica
Esta página foi útil?