> 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/ja/ai-agents/aws-guardrails.md).

# AWS Guardrails

AWS Guardrailsの保護メカニズムは、設定可能な安全対策を提供し、生成AI アプリケーションを大規模かつ安全に構築できるよう支援します。自動推論を使用して、ハルシネーションによる事実誤認の防止を支援します。不要または有害なコンテンツを85%以上ブロックし、検索拡張生成（RAG）や要約のユースケースで使用されるモデルによる ハルシネーション応答を75%以上フィルタリングできます。

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

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

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

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

<figure><img src="https://605688223-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FVYMUz6J7vDZ0QTvb1rbN%2Fuploads%2Fgit-blob-8538be2a81c4517b7802c6058d643a91224bad8d%2Fimage%20(11).png?alt=media" alt=""><figcaption></figcaption></figure>

別案件の設定

<figure><img src="https://605688223-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FVYMUz6J7vDZ0QTvb1rbN%2Fuploads%2Fgit-blob-266b5fb0c56e003aa48b16694c892f6ae325ce4e%2Fimage%20(25).png?alt=media" alt=""><figcaption></figcaption></figure>

### Step 2: コンテンツフィルターを設定します（User Input, Assistant Response）

<figure><img src="https://605688223-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FVYMUz6J7vDZ0QTvb1rbN%2Fuploads%2Fgit-blob-817bad48f8cc391c9329afc86518d5f2afa56a82%2Fimage%20(12).png?alt=media" alt=""><figcaption></figcaption></figure>

有害性のレベルを指定でき、Imageの入力にも対応します。

<figure><img src="https://605688223-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FVYMUz6J7vDZ0QTvb1rbN%2Fuploads%2Fgit-blob-9c2b169d350da8843878d25ea1edc76a5d8d61a4%2Fimage%20(13).png?alt=media" alt=""><figcaption></figcaption></figure>

<figure><img src="https://605688223-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FVYMUz6J7vDZ0QTvb1rbN%2Fuploads%2Fgit-blob-b7add55e33c6117e775e63ee662f1731da1c37ab%2Fimage%20(14).png?alt=media" alt=""><figcaption></figcaption></figure>

別案件の設定

<figure><img src="https://605688223-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FVYMUz6J7vDZ0QTvb1rbN%2Fuploads%2Fgit-blob-955647ed56819a1404526281ae3798773759cb8e%2Fimage%20(26).png?alt=media" alt=""><figcaption></figcaption></figure>

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

<figure><img src="https://605688223-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FVYMUz6J7vDZ0QTvb1rbN%2Fuploads%2Fgit-blob-c0f27367cee961794c435635b6a9f9ca7c25a3c8%2Fimage%20(16).png?alt=media" alt=""><figcaption></figcaption></figure>

<figure><img src="https://605688223-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FVYMUz6J7vDZ0QTvb1rbN%2Fuploads%2Fgit-blob-f81e19ea32f80ded2199f9fda73d8c61da256fb8%2Fimage%20(20).png?alt=media" alt=""><figcaption></figcaption></figure>

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

別案件の設定

<figure><img src="https://605688223-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FVYMUz6J7vDZ0QTvb1rbN%2Fuploads%2Fgit-blob-418c511fc8b4ad57ca71eb1d18516bbec875dc2f%2Fimage%20(27).png?alt=media" alt=""><figcaption></figcaption></figure>

### Step 4: 厳格な単語フィルターを適用します（暴言やXXXへの言及を禁止します）

たとえば、モデルにヴォルデモートと言及させたくない場合は、その単語を追加します。複数の単語を一度に入力できます（csv, txt, ctrl + c）。

<figure><img src="https://605688223-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FVYMUz6J7vDZ0QTvb1rbN%2Fuploads%2Fgit-blob-2981df6b34bae947a8cd422c1eaf731cd2b1ee0b%2Fimage%20(22).png?alt=media" 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="https://605688223-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FVYMUz6J7vDZ0QTvb1rbN%2Fuploads%2Fgit-blob-0e9a5418c49b3a5e0de2bb751aa336b1ccd76591%2Fimage%20(23).png?alt=media" alt=""><figcaption></figcaption></figure>

別案件の設定

<figure><img src="https://605688223-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FVYMUz6J7vDZ0QTvb1rbN%2Fuploads%2Fgit-blob-97cf592fd943fa52fca67ac772ccf389ad94585c%2Fimage%20(28).png?alt=media" alt=""><figcaption></figcaption></figure>

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

### Step 6: ハルシネーションを防止し、関連性のthresholdに基づいて応答をブロックします

<figure><img src="https://605688223-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FVYMUz6J7vDZ0QTvb1rbN%2Fuploads%2Fgit-blob-5fce88e0b2eab851da8e62e9d38c02d3a76b1338%2Fimage%20(24).png?alt=media" alt=""><figcaption></figcaption></figure>

別案件の設定

<figure><img src="https://605688223-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FVYMUz6J7vDZ0QTvb1rbN%2Fuploads%2Fgit-blob-77c3a326f8b00a5e6442f8fd33e195609e5e1ea9%2Fimage%20(29).png?alt=media" 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/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.
