護欄
列出預設模板
儀表盤在護欄空狀態下提供的只讀藍圖。
GET
/
api
/
v1
/
guardrail-policies
/
presets
列出預設模板
curl --request GET \
--url https://api.example.com/api/v1/guardrail-policies/presetsimport requests
url = "https://api.example.com/api/v1/guardrail-policies/presets"
response = requests.get(url)
print(response.text)const options = {method: 'GET'};
fetch('https://api.example.com/api/v1/guardrail-policies/presets', 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://api.example.com/api/v1/guardrail-policies/presets",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.example.com/api/v1/guardrail-policies/presets"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://api.example.com/api/v1/guardrail-policies/presets")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/api/v1/guardrail-policies/presets")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body返回四個精心策劃的預設模板:
pii-safe、strict-json、cost-conscious 和 enterprise-default。預設是隻讀的——應用某個預設只是一次普通的創建策略調用,只不過用該預設的 rules 數組作為初始值。
根據嚴格的顯式啓用(opt-in)約定,獲取或應用預設永遠不會自動將其綁定到某個 API 密鑰。
身份驗證
需要攜帶具備billing API 密鑰權限範圍的 Bearer 令牌。
請求示例
curl https://www.hitheo.ai/api/v1/guardrail-policies/presets \
-H "Authorization: Bearer $THEO_API_KEY"
const presets = await theo.guardrails.presets.list();
const enterprise = presets.find((p) => p.id === "enterprise-default")!;
const policy = await theo.guardrails.policies.create({
name: "Production defaults",
rules: enterprise.rules,
});
響應
每個預設都包含id、name、tagline、description 和 rules。目前提供的四個預設分別是:
- pii-safe —— 對輸入進行 PII(個人身份信息)遮蔽。
- strict-json —— 提示注入拒絕 + 輸出端 JSON 修復。
- cost-conscious —— 對輸入和輸出兩個階段都設置硬性長度上限(約 4K 令牌)。
- enterprise-default —— 完整組合:PII 遮蔽 + 注入拒絕 + 長度上限 + 不當言論標記 + JSON 修復。
{
"presets": [
{
"id": "pii-safe",
"name": "PII-safe",
"tagline": "Redact email / phone / SSN / credit-card / DL before the model sees them.",
"description": "Sensible default for compliance-sensitive teams. ...",
"rules": [
{
"guardrail_id": "pii_redactor",
"phase": "input",
"verdict": "redact",
"config": {},
"enabled": true,
"rule_order": 0
}
]
}
]
}
這個頁面有幫助嗎?
列出預設模板
curl --request GET \
--url https://api.example.com/api/v1/guardrail-policies/presetsimport requests
url = "https://api.example.com/api/v1/guardrail-policies/presets"
response = requests.get(url)
print(response.text)const options = {method: 'GET'};
fetch('https://api.example.com/api/v1/guardrail-policies/presets', 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://api.example.com/api/v1/guardrail-policies/presets",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.example.com/api/v1/guardrail-policies/presets"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://api.example.com/api/v1/guardrail-policies/presets")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/api/v1/guardrail-policies/presets")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body