> ## Documentation Index
> Fetch the complete documentation index at: https://docs.budecosystem.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Custom probes and the guardrail endpoint

> Write custom probes with your own policy, and call guardrails directly.

## Write a custom probe

**Where:** Guardrails → Content Guardrails → Add Guardrail → Create custom probe

1. Choose **Create probe with policy** (**You can define your own LLM policy**) and click **Next**.
2. Fill in **Add Custom GuardRail** using the table below, then click **Save**. If required fields are empty you see **Please fill in all required fields**.
3. On **Guard Rail details** fill in the second table and click **Finish**. The probe is then available in every profile.

| Field | What to enter | Rules and defaults |
| - | - | - |
| **Task Description** | What to classify, for example `Classify content for policy violations related to harmful speech` | Required |
| **Definitions: Term, Definition** | Your terms and their full definitions, word for word from your policy | Required. Add as many as you need |
| **Interpretation Rules** | How to apply the criteria. **Add Interpretation Rule** adds another | Optional |
| **Evaluation Approach: Depiction, Request, Guidance** | Questions the checker asks, for example `Does the content CONTAIN policy violations?` and `Is the user ASKING to generate violating content?`, and how to pick a severity | Optional |
| **Safe Content: Description** | A summary of what counts as legitimate content | Required |
| **Safe Content Types: Name, Description, Example** | Kinds of safe content, each with an example | Required |
| **Safe Content Training Examples: Input, Rationale, Confidence** | Sample texts that are fine, with why | Required. Confidence is **High**, **Medium** or **Low** |
| **Violations: Category Name** | A name in snake\_case, for example `hate_speech`. **Add Violation** adds a category | Required for each category |
| **Violation Severity** | How serious this category is | **Moderate**, **Medium**, **High**, **Critical** or **Maximum** |
| **Escalate** | Switch on a violation category | Off by default. Marks that category for escalation |
| **Violation Types and Training Examples** | Name, description and example of each kind of violation, and sample texts with the expected output and rationale | Required |
| **Ambiguity Handling** | A condition (for example `unclear`) and an action (for example `downgrade severity by 1 level`). **Add Ambiguity Rule** adds another | Optional |

| Field (Guard Rail details) | What to enter | Rules and defaults |
| - | - | - |
| **Guard rail Name** | The probe's name | Required |
| **Guardrail Description** | What it does | Required |
| **Guard type** | **Input**, **Output**, **Agents**, **Retrieval** | Required. Pick one or more |
| **Modality** | **Text**, **Video**, **Image**, **Actions**, **Code** or **Math** | Required. Pick one |

> [!TIP]
>
> Write at least a few training examples for every violation category and for safe content. Examples are how the probe learns the edge of your policy.

## Use a standalone guardrail endpoint

Open the profile and click **Use Guardrail**. It shows ready-made **curl**, **Python** and **JavaScript** snippets with **Copy**. Call `/v1/moderations` with the profile name as `model` and the text as `input`, and your API key in the `Authorization` header:

```bash theme={null}
curl $BUD_BASE_URL/v1/moderations -H "Authorization: Bearer $BUD_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"model": "pii-and-safety", "input": "My card number is 4111 1111 1111 1111"}'
```


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.