Actualizar la política de barreras de protección
Reemplaza una política de guardrails. Los modelos clasificadores deben estar activos y declarar soporte de salida estructurada o ser un modelo de decisión que responda a la pregunta de la regla; reemplaza el ID del modelo de ejemplo por un modelo adecuado de tu organización. Omite team_id para establecer la política de toda la organización (solo administrador de la organización); proporciona team_id para establecer la política adicional de ese equipo (los administradores de la organización pueden dirigirla a cualquier equipo de su organización; otros usuarios solo a su propio equipo). La política de toda la organización se aplica a todos los equipos; una política de equipo se aplica además de esta — configurar una política de equipo nunca debilita la política de toda la organización.
from meetkai_mka1 import SDK
with SDK(
bearer_auth="<YOUR_BEARER_TOKEN_HERE>",
) as sdk:
res = sdk.guardrails.update_guardrails(guardrails=[
{
"mode": "ban_words",
"enabled": True,
"check_output": True,
"output_timing": "streaming",
"output_window": {
"max_chars": 400,
"max_ms": 2000,
},
"input_sources": [
"user",
"retrieval",
],
"config": {
"words": [
"spam",
"inappropriate",
],
},
},
{
"mode": "classifier",
"enabled": True,
"config": {
"model": "meetkai:custom-classifier",
"prompt": "Allow customer-support questions. Block unrelated requests.",
"on_error": "fail_closed",
},
},
{
"mode": "groundedness",
"enabled": True,
"check_output": True,
"config": {
"model": "meetkai:judge",
"threshold": 0.5,
"action": "flag",
"on_error": "fail_open",
},
},
], team_id="team-alpha")
# 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.updateGuardrails({
updateGuardrailsRequest: {
guardrails: [
{
mode: "ban_words",
enabled: true,
checkOutput: true,
outputTiming: "streaming",
outputWindow: {
maxChars: 400,
maxMs: 2000,
},
inputSources: [
"user",
"retrieval",
],
config: {
words: [
"spam",
"inappropriate",
],
},
},
{
mode: "classifier",
enabled: true,
config: {
model: "meetkai:custom-classifier",
prompt: "Allow customer-support questions. Block unrelated requests.",
onError: "fail_closed",
},
},
{
mode: "groundedness",
enabled: true,
checkOutput: true,
config: {
model: "meetkai:judge",
threshold: 0.5,
action: "flag",
onError: "fail_open",
},
},
],
teamId: "team-alpha",
},
});
console.log(result);
}
run();package main
import(
"context"
mka1 "github.com/MeetKai/mka1-sdks/go"
"github.com/MeetKai/mka1-sdks/go/models/components"
"github.com/MeetKai/mka1-sdks/go/optionalnullable"
"log"
)
func main() {
ctx := context.Background()
s := mka1.New(
mka1.WithSecurity("<YOUR_BEARER_TOKEN_HERE>"),
)
res, err := s.Guardrails.UpdateGuardrails(ctx, components.UpdateGuardrailsRequest{
Guardrails: []components.GuardrailConfig{
components.CreateGuardrailConfigBanWords(
components.BanWordsGuardrail{
CheckOutput: mka1.Pointer(true),
OutputTiming: components.BanWordsGuardrailOutputTimingStreaming.ToPointer(),
OutputWindow: &components.OutputWindow{
MaxChars: mka1.Pointer[int64](400),
MaxMs: mka1.Pointer[int64](2000),
},
InputSources: []components.GuardrailInputSource{
components.GuardrailInputSourceUser,
components.GuardrailInputSourceRetrieval,
},
Config: &components.BanWordsConfig{
Words: []string{
"spam",
"inappropriate",
},
},
},
),
components.CreateGuardrailConfigClassifier(
components.ClassifierGuardrail{
Config: components.ClassifierConfig{
Model: "meetkai:custom-classifier",
Prompt: "Allow customer-support questions. Block unrelated requests.",
},
},
),
components.CreateGuardrailConfigGroundedness(
components.GroundednessGuardrail{
Config: components.GroundednessConfig{
Model: "meetkai:judge",
OnError: components.GroundednessConfigOnErrorFailOpen.ToPointer(),
},
},
),
},
TeamID: optionalnullable.From(mka1.Pointer("team-alpha")),
}, nil)
if err != nil {
log.Fatal(err)
}
if res.UpdateGuardrailsResponse != nil {
// handle response
}
}using MeetKai.MKA1;
using MeetKai.MKA1.Types.Components;
using System.Collections.Generic;
var sdk = new SDK(bearerAuth: "<YOUR_BEARER_TOKEN_HERE>");
var res = await sdk.Guardrails.UpdateGuardrailsAsync(body: new MeetKai.MKA1.Types.Components.UpdateGuardrailsRequest() {
Guardrails = new List<GuardrailConfig>() {
GuardrailConfig.CreateBanWords(
new BanWordsGuardrail() {
CheckOutput = true,
OutputTiming = BanWordsGuardrailOutputTiming.Streaming,
OutputWindow = new OutputWindow() {
MaxChars = 400,
MaxMs = 2000,
},
InputSources = new List<GuardrailInputSource>() {
GuardrailInputSource.User,
GuardrailInputSource.Retrieval,
},
Config = new BanWordsConfig() {
Words = new List<string>() {
"spam",
"inappropriate",
},
},
}
),
GuardrailConfig.CreateClassifier(
new ClassifierGuardrail() {
Config = new ClassifierConfig() {
Model = "meetkai:custom-classifier",
Prompt = "Allow customer-support questions. Block unrelated requests.",
},
}
),
GuardrailConfig.CreateGroundedness(
new GroundednessGuardrail() {
Config = new GroundednessConfig() {
Model = "meetkai:judge",
OnError = GroundednessConfigOnError.FailOpen,
},
}
),
},
TeamId = "team-alpha",
});
// handle responsecurl --request PUT \
--url https://apigw.mka1.com/api/v1/llm/guardrails \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"guardrails": [
{
"mode": "ban_words",
"enabled": true,
"input_sources": [
"user",
"retrieval"
],
"check_output": true,
"output_timing": "streaming",
"output_window": {
"max_chars": 400,
"max_ms": 2000
},
"config": {
"words": [
"spam",
"inappropriate"
]
}
},
{
"mode": "classifier",
"enabled": true,
"config": {
"model": "meetkai:custom-classifier",
"prompt": "Allow customer-support questions. Block unrelated requests.",
"on_error": "fail_closed"
}
},
{
"mode": "groundedness",
"enabled": true,
"check_output": true,
"config": {
"model": "meetkai:judge",
"threshold": 0.5,
"action": "flag",
"on_error": "fail_open"
}
}
],
"team_id": "team-alpha"
}
'const options = {
method: 'PUT',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
guardrails: [
{
mode: 'ban_words',
enabled: true,
input_sources: ['user', 'retrieval'],
check_output: true,
output_timing: 'streaming',
output_window: {max_chars: 400, max_ms: 2000},
config: {words: ['spam', 'inappropriate']}
},
{
mode: 'classifier',
enabled: true,
config: {
model: 'meetkai:custom-classifier',
prompt: 'Allow customer-support questions. Block unrelated requests.',
on_error: 'fail_closed'
}
},
{
mode: 'groundedness',
enabled: true,
check_output: true,
config: {model: 'meetkai:judge', threshold: 0.5, action: 'flag', on_error: 'fail_open'}
}
],
team_id: 'team-alpha'
})
};
fetch('https://apigw.mka1.com/api/v1/llm/guardrails', 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",
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([
'guardrails' => [
[
'mode' => 'ban_words',
'enabled' => true,
'input_sources' => [
'user',
'retrieval'
],
'check_output' => true,
'output_timing' => 'streaming',
'output_window' => [
'max_chars' => 400,
'max_ms' => 2000
],
'config' => [
'words' => [
'spam',
'inappropriate'
]
]
],
[
'mode' => 'classifier',
'enabled' => true,
'config' => [
'model' => 'meetkai:custom-classifier',
'prompt' => 'Allow customer-support questions. Block unrelated requests.',
'on_error' => 'fail_closed'
]
],
[
'mode' => 'groundedness',
'enabled' => true,
'check_output' => true,
'config' => [
'model' => 'meetkai:judge',
'threshold' => 0.5,
'action' => 'flag',
'on_error' => 'fail_open'
]
]
],
'team_id' => 'team-alpha'
]),
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;
}HttpResponse<String> response = Unirest.put("https://apigw.mka1.com/api/v1/llm/guardrails")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"guardrails\": [\n {\n \"mode\": \"ban_words\",\n \"enabled\": true,\n \"input_sources\": [\n \"user\",\n \"retrieval\"\n ],\n \"check_output\": true,\n \"output_timing\": \"streaming\",\n \"output_window\": {\n \"max_chars\": 400,\n \"max_ms\": 2000\n },\n \"config\": {\n \"words\": [\n \"spam\",\n \"inappropriate\"\n ]\n }\n },\n {\n \"mode\": \"classifier\",\n \"enabled\": true,\n \"config\": {\n \"model\": \"meetkai:custom-classifier\",\n \"prompt\": \"Allow customer-support questions. Block unrelated requests.\",\n \"on_error\": \"fail_closed\"\n }\n },\n {\n \"mode\": \"groundedness\",\n \"enabled\": true,\n \"check_output\": true,\n \"config\": {\n \"model\": \"meetkai:judge\",\n \"threshold\": 0.5,\n \"action\": \"flag\",\n \"on_error\": \"fail_open\"\n }\n }\n ],\n \"team_id\": \"team-alpha\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://apigw.mka1.com/api/v1/llm/guardrails")
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 \"guardrails\": [\n {\n \"mode\": \"ban_words\",\n \"enabled\": true,\n \"input_sources\": [\n \"user\",\n \"retrieval\"\n ],\n \"check_output\": true,\n \"output_timing\": \"streaming\",\n \"output_window\": {\n \"max_chars\": 400,\n \"max_ms\": 2000\n },\n \"config\": {\n \"words\": [\n \"spam\",\n \"inappropriate\"\n ]\n }\n },\n {\n \"mode\": \"classifier\",\n \"enabled\": true,\n \"config\": {\n \"model\": \"meetkai:custom-classifier\",\n \"prompt\": \"Allow customer-support questions. Block unrelated requests.\",\n \"on_error\": \"fail_closed\"\n }\n },\n {\n \"mode\": \"groundedness\",\n \"enabled\": true,\n \"check_output\": true,\n \"config\": {\n \"model\": \"meetkai:judge\",\n \"threshold\": 0.5,\n \"action\": \"flag\",\n \"on_error\": \"fail_open\"\n }\n }\n ],\n \"team_id\": \"team-alpha\"\n}"
response = http.request(request)
puts response.read_body{
"object": "guardrails_settings",
"guardrails": [
{
"mode": "ban_words",
"enabled": true,
"input_sources": [
"user",
"retrieval"
],
"check_output": true,
"output_timing": "streaming",
"output_window": {
"max_chars": 400,
"max_ms": 2000
},
"config": {
"words": [
"spam",
"inappropriate"
]
}
},
{
"mode": "classifier",
"enabled": true,
"config": {
"model": "meetkai:custom-classifier",
"prompt": "Allow customer-support questions. Block unrelated requests.",
"on_error": "fail_closed"
}
},
{
"mode": "groundedness",
"enabled": true,
"check_output": true,
"config": {
"model": "meetkai:judge",
"threshold": 0.5,
"action": "flag",
"on_error": "fail_open"
}
}
],
"team_id": "team-alpha",
"updated_at": 1704067200
}Autorizaciones
Cuerpo
Equipo objetivo para esta política. Omita o pase null para establecer la política de toda la organización que se aplica a todos los equipos (solo administrador de la organización). Los llamadores que no sean administradores solo pueden dirigir su propio equipo.
1Respuesta
Está bien
¿Esta página le ayudó?
from meetkai_mka1 import SDK
with SDK(
bearer_auth="<YOUR_BEARER_TOKEN_HERE>",
) as sdk:
res = sdk.guardrails.update_guardrails(guardrails=[
{
"mode": "ban_words",
"enabled": True,
"check_output": True,
"output_timing": "streaming",
"output_window": {
"max_chars": 400,
"max_ms": 2000,
},
"input_sources": [
"user",
"retrieval",
],
"config": {
"words": [
"spam",
"inappropriate",
],
},
},
{
"mode": "classifier",
"enabled": True,
"config": {
"model": "meetkai:custom-classifier",
"prompt": "Allow customer-support questions. Block unrelated requests.",
"on_error": "fail_closed",
},
},
{
"mode": "groundedness",
"enabled": True,
"check_output": True,
"config": {
"model": "meetkai:judge",
"threshold": 0.5,
"action": "flag",
"on_error": "fail_open",
},
},
], team_id="team-alpha")
# 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.updateGuardrails({
updateGuardrailsRequest: {
guardrails: [
{
mode: "ban_words",
enabled: true,
checkOutput: true,
outputTiming: "streaming",
outputWindow: {
maxChars: 400,
maxMs: 2000,
},
inputSources: [
"user",
"retrieval",
],
config: {
words: [
"spam",
"inappropriate",
],
},
},
{
mode: "classifier",
enabled: true,
config: {
model: "meetkai:custom-classifier",
prompt: "Allow customer-support questions. Block unrelated requests.",
onError: "fail_closed",
},
},
{
mode: "groundedness",
enabled: true,
checkOutput: true,
config: {
model: "meetkai:judge",
threshold: 0.5,
action: "flag",
onError: "fail_open",
},
},
],
teamId: "team-alpha",
},
});
console.log(result);
}
run();package main
import(
"context"
mka1 "github.com/MeetKai/mka1-sdks/go"
"github.com/MeetKai/mka1-sdks/go/models/components"
"github.com/MeetKai/mka1-sdks/go/optionalnullable"
"log"
)
func main() {
ctx := context.Background()
s := mka1.New(
mka1.WithSecurity("<YOUR_BEARER_TOKEN_HERE>"),
)
res, err := s.Guardrails.UpdateGuardrails(ctx, components.UpdateGuardrailsRequest{
Guardrails: []components.GuardrailConfig{
components.CreateGuardrailConfigBanWords(
components.BanWordsGuardrail{
CheckOutput: mka1.Pointer(true),
OutputTiming: components.BanWordsGuardrailOutputTimingStreaming.ToPointer(),
OutputWindow: &components.OutputWindow{
MaxChars: mka1.Pointer[int64](400),
MaxMs: mka1.Pointer[int64](2000),
},
InputSources: []components.GuardrailInputSource{
components.GuardrailInputSourceUser,
components.GuardrailInputSourceRetrieval,
},
Config: &components.BanWordsConfig{
Words: []string{
"spam",
"inappropriate",
},
},
},
),
components.CreateGuardrailConfigClassifier(
components.ClassifierGuardrail{
Config: components.ClassifierConfig{
Model: "meetkai:custom-classifier",
Prompt: "Allow customer-support questions. Block unrelated requests.",
},
},
),
components.CreateGuardrailConfigGroundedness(
components.GroundednessGuardrail{
Config: components.GroundednessConfig{
Model: "meetkai:judge",
OnError: components.GroundednessConfigOnErrorFailOpen.ToPointer(),
},
},
),
},
TeamID: optionalnullable.From(mka1.Pointer("team-alpha")),
}, nil)
if err != nil {
log.Fatal(err)
}
if res.UpdateGuardrailsResponse != nil {
// handle response
}
}using MeetKai.MKA1;
using MeetKai.MKA1.Types.Components;
using System.Collections.Generic;
var sdk = new SDK(bearerAuth: "<YOUR_BEARER_TOKEN_HERE>");
var res = await sdk.Guardrails.UpdateGuardrailsAsync(body: new MeetKai.MKA1.Types.Components.UpdateGuardrailsRequest() {
Guardrails = new List<GuardrailConfig>() {
GuardrailConfig.CreateBanWords(
new BanWordsGuardrail() {
CheckOutput = true,
OutputTiming = BanWordsGuardrailOutputTiming.Streaming,
OutputWindow = new OutputWindow() {
MaxChars = 400,
MaxMs = 2000,
},
InputSources = new List<GuardrailInputSource>() {
GuardrailInputSource.User,
GuardrailInputSource.Retrieval,
},
Config = new BanWordsConfig() {
Words = new List<string>() {
"spam",
"inappropriate",
},
},
}
),
GuardrailConfig.CreateClassifier(
new ClassifierGuardrail() {
Config = new ClassifierConfig() {
Model = "meetkai:custom-classifier",
Prompt = "Allow customer-support questions. Block unrelated requests.",
},
}
),
GuardrailConfig.CreateGroundedness(
new GroundednessGuardrail() {
Config = new GroundednessConfig() {
Model = "meetkai:judge",
OnError = GroundednessConfigOnError.FailOpen,
},
}
),
},
TeamId = "team-alpha",
});
// handle responsecurl --request PUT \
--url https://apigw.mka1.com/api/v1/llm/guardrails \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"guardrails": [
{
"mode": "ban_words",
"enabled": true,
"input_sources": [
"user",
"retrieval"
],
"check_output": true,
"output_timing": "streaming",
"output_window": {
"max_chars": 400,
"max_ms": 2000
},
"config": {
"words": [
"spam",
"inappropriate"
]
}
},
{
"mode": "classifier",
"enabled": true,
"config": {
"model": "meetkai:custom-classifier",
"prompt": "Allow customer-support questions. Block unrelated requests.",
"on_error": "fail_closed"
}
},
{
"mode": "groundedness",
"enabled": true,
"check_output": true,
"config": {
"model": "meetkai:judge",
"threshold": 0.5,
"action": "flag",
"on_error": "fail_open"
}
}
],
"team_id": "team-alpha"
}
'const options = {
method: 'PUT',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
guardrails: [
{
mode: 'ban_words',
enabled: true,
input_sources: ['user', 'retrieval'],
check_output: true,
output_timing: 'streaming',
output_window: {max_chars: 400, max_ms: 2000},
config: {words: ['spam', 'inappropriate']}
},
{
mode: 'classifier',
enabled: true,
config: {
model: 'meetkai:custom-classifier',
prompt: 'Allow customer-support questions. Block unrelated requests.',
on_error: 'fail_closed'
}
},
{
mode: 'groundedness',
enabled: true,
check_output: true,
config: {model: 'meetkai:judge', threshold: 0.5, action: 'flag', on_error: 'fail_open'}
}
],
team_id: 'team-alpha'
})
};
fetch('https://apigw.mka1.com/api/v1/llm/guardrails', 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",
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([
'guardrails' => [
[
'mode' => 'ban_words',
'enabled' => true,
'input_sources' => [
'user',
'retrieval'
],
'check_output' => true,
'output_timing' => 'streaming',
'output_window' => [
'max_chars' => 400,
'max_ms' => 2000
],
'config' => [
'words' => [
'spam',
'inappropriate'
]
]
],
[
'mode' => 'classifier',
'enabled' => true,
'config' => [
'model' => 'meetkai:custom-classifier',
'prompt' => 'Allow customer-support questions. Block unrelated requests.',
'on_error' => 'fail_closed'
]
],
[
'mode' => 'groundedness',
'enabled' => true,
'check_output' => true,
'config' => [
'model' => 'meetkai:judge',
'threshold' => 0.5,
'action' => 'flag',
'on_error' => 'fail_open'
]
]
],
'team_id' => 'team-alpha'
]),
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;
}HttpResponse<String> response = Unirest.put("https://apigw.mka1.com/api/v1/llm/guardrails")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"guardrails\": [\n {\n \"mode\": \"ban_words\",\n \"enabled\": true,\n \"input_sources\": [\n \"user\",\n \"retrieval\"\n ],\n \"check_output\": true,\n \"output_timing\": \"streaming\",\n \"output_window\": {\n \"max_chars\": 400,\n \"max_ms\": 2000\n },\n \"config\": {\n \"words\": [\n \"spam\",\n \"inappropriate\"\n ]\n }\n },\n {\n \"mode\": \"classifier\",\n \"enabled\": true,\n \"config\": {\n \"model\": \"meetkai:custom-classifier\",\n \"prompt\": \"Allow customer-support questions. Block unrelated requests.\",\n \"on_error\": \"fail_closed\"\n }\n },\n {\n \"mode\": \"groundedness\",\n \"enabled\": true,\n \"check_output\": true,\n \"config\": {\n \"model\": \"meetkai:judge\",\n \"threshold\": 0.5,\n \"action\": \"flag\",\n \"on_error\": \"fail_open\"\n }\n }\n ],\n \"team_id\": \"team-alpha\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://apigw.mka1.com/api/v1/llm/guardrails")
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 \"guardrails\": [\n {\n \"mode\": \"ban_words\",\n \"enabled\": true,\n \"input_sources\": [\n \"user\",\n \"retrieval\"\n ],\n \"check_output\": true,\n \"output_timing\": \"streaming\",\n \"output_window\": {\n \"max_chars\": 400,\n \"max_ms\": 2000\n },\n \"config\": {\n \"words\": [\n \"spam\",\n \"inappropriate\"\n ]\n }\n },\n {\n \"mode\": \"classifier\",\n \"enabled\": true,\n \"config\": {\n \"model\": \"meetkai:custom-classifier\",\n \"prompt\": \"Allow customer-support questions. Block unrelated requests.\",\n \"on_error\": \"fail_closed\"\n }\n },\n {\n \"mode\": \"groundedness\",\n \"enabled\": true,\n \"check_output\": true,\n \"config\": {\n \"model\": \"meetkai:judge\",\n \"threshold\": 0.5,\n \"action\": \"flag\",\n \"on_error\": \"fail_open\"\n }\n }\n ],\n \"team_id\": \"team-alpha\"\n}"
response = http.request(request)
puts response.read_body{
"object": "guardrails_settings",
"guardrails": [
{
"mode": "ban_words",
"enabled": true,
"input_sources": [
"user",
"retrieval"
],
"check_output": true,
"output_timing": "streaming",
"output_window": {
"max_chars": 400,
"max_ms": 2000
},
"config": {
"words": [
"spam",
"inappropriate"
]
}
},
{
"mode": "classifier",
"enabled": true,
"config": {
"model": "meetkai:custom-classifier",
"prompt": "Allow customer-support questions. Block unrelated requests.",
"on_error": "fail_closed"
}
},
{
"mode": "groundedness",
"enabled": true,
"check_output": true,
"config": {
"model": "meetkai:judge",
"threshold": 0.5,
"action": "flag",
"on_error": "fail_open"
}
}
],
"team_id": "team-alpha",
"updated_at": 1704067200
}