> For the complete documentation index, see [llms.txt](https://docs.maiagent.ai/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.maiagent.ai/tech/maiagent-tech-ja/ai-agents/aws-guardrails.md).

# AWS Guardrails

AWS Guardrails には次の機能があります。

* コンテンツフィルタリング（性的・暴力的表現などの防止）
* 話題逸脱の防止
* 禁止ワード（ワードフィルタリング）
* 機密データの除去
* ハルシネーションの防止

## <mark style="color:blue;">操作手順の説明</mark>

### Step 1: Config の設定（名称、説明、ブロックされた場合に返すメッセージ）

<figure><img src="/files/uHxhFSaL7TeZpIYpioOp" alt=""><figcaption></figcaption></figure>

他の事例での設定

<figure><img src="/files/NPdvCi7ejZzgV5yr5SqJ" alt=""><figcaption></figcaption></figure>

### Step 2: コンテンツフィルタリングの設定（User Input, Assistant Response）

<figure><img src="/files/4EWVz1onWuZ69IGNDQvK" alt=""><figcaption></figcaption></figure>

危害レベルを指定でき、Image の入力も含めることが可能です

<figure><img src="/files/RiWvajEOLVHScSN1cauy" alt=""><figcaption></figcaption></figure>

<figure><img src="/files/ODMEmARcsoOAoCeq6sIj" alt=""><figcaption></figcaption></figure>

他の事例での設定

<figure><img src="/files/NC1wkny4v58JhXKwehUx" alt=""><figcaption></figcaption></figure>

### Step 3: 拒否するトピックを設定し、話題逸脱を防止する

<figure><img src="/files/5uwN0ZQb6wiQZNwAxQLC" alt=""><figcaption></figcaption></figure>

<figure><img src="/files/ccmkZReXR76s39HoXBVo" alt=""><figcaption></figcaption></figure>

説明や定義を追加し、例を提供することで、話題の逸脱を防止できます

他の事例での設定

<figure><img src="/files/dlkezLBz1oUWPexejGpB" alt=""><figcaption></figcaption></figure>

### Step 4: ワードフィルタリングの設定（罵倒語や特定の語句への言及を禁止する）

例えば、モデルに「ヴォルデモート」と言及してほしくない場合は、その単語を追加します。複数の単語を一度に入力することも可能です（csv, txt, ctrl + c）。

<figure><img src="/files/pk6KPyvzRmm0E2wtq4Dy" alt=""><figcaption></figcaption></figure>

他の事例での設定

![](https://lh7-rt.googleusercontent.com/docsz/AD_4nXcb-3vRt-Q0UkPhKEbzpygdBa4ALAaKUsXTil3m5PS3PHLQcR_3jpXXkn6T6-YoaONvnCc0H1RDrhIj-aq0WzCunLW99auRRCu36bNOEBnYqrsgK6Up5uehpKqqreKzXPWxSU0x?key=z1hebxFSyJWvHprMJ3hgOr8k)

### ![](https://lh7-rt.googleusercontent.com/docsz/AD_4nXczJwuyAQ4-FbNaBymncor9v3HA9mUURj_ghPn8N1FyNUkNvr_hW9WXw1C9ZYX3gcR5s0uYS_IybmgQ_1pSfnHNf6GTiJCu8H7apoiIm2Bczjfe1csDR3WVDpRuYWRCPS22K2OdQQ?key=z1hebxFSyJWvHprMJ3hgOr8k)

### Step 5: 機密データ (PII) のブロック、正規表現による置換

クレジットカード、ナンバープレート、マイナンバーなど、いくつかのパターンがあらかじめ設定されています

<figure><img src="/files/NZdEfKWV89qSwPABxTV7" alt=""><figcaption></figcaption></figure>

他の事例での設定

<figure><img src="/files/OIb56T0YiSHgE1dIGSmu" alt=""><figcaption></figcaption></figure>

正規表現による置換では、AI アシスタントの応答内で、任意の正規表現を用いて不要な構造を置き換えることができます。

### Step 6: ハルシネーションの防止、および関連性に基づいて応答をブロックする閾値 (threshold)

<figure><img src="/files/ExRBEfjFKWJ7pKgwXmK9" alt=""><figcaption></figcaption></figure>

他の事例での設定

<figure><img src="/files/1XIW2Yq6UFEcImxB6egU" alt=""><figcaption></figcaption></figure>


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.maiagent.ai/tech/maiagent-tech-ja/ai-agents/aws-guardrails.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
