Web Application Firewall (WAF) の AI アプリケーション保護機能は、アセットを使用して AI アプリケーション内のユーザー入力 (リクエスト) とモデル出力 (応答) を特定し、検査します。アセットを作成した後、プロンプト攻撃防御またはコンテンツモデレーションを有効にできます。
アセットの追加
開始する前に、Web サイトまたはドメインが保護のために WAF に追加されていることを確認してください。つまり、保護対象オブジェクトが存在することです。サービスを WAF に追加していない場合、詳細については、「オンボーディングの概要」をご参照ください。
アセット管理ページに移動します。上部のメニューバーから、WAF インスタンスのリソースグループとリージョン (中国本土 または 中国本土以外) を選択し、Add Asset をクリックします。
[一致条件] を指定します。一致条件は、保護したい AI API エンドポイントを定義し、WAF が対象のトラフィックを正確に識別するのに役立ちます。
一致フィールド
一致コンテンツ
ドメイン名
ドメイン名または IP アドレスを入力します。たとえば、保護対象オブジェクトのドメイン名が
domain.comの場合、domain.comと入力します。URL パス
API の URL パスを入力します。たとえば、ここで
/chat/messageと入力し、[ドメイン名] にdomain.comと入力した場合、保護対象はdomain.com/chat/messageとなります。HTTP リクエストメソッド
選択肢:
POST、GET、PUT。プロンプト位置 および Response Content セクションで、WAF が HTTP メッセージ内のコンテンツを検査する場所を指定するフィールドを入力します。JSONPath 式を使用する必要があります。
重要この構成は、保護モジュールがどのコンテンツを検査するかを決定します。
ユーザーリクエストとモデル応答の両方を検査するには、プロンプト位置 と Response Content の両方を構成します。
[墨消し] 操作を使用するには、Response Content を構成します。
Response Content で、サービスの特性に一致するオプションを選択します。
非ストリーミング応答: サーバーは、処理が完了した後、完全な JSON 応答本文を単一のパッケージで送信します。クライアントは、結果を受信する前にすべてのデータが生成されるのを待つ必要があります。
ストリーミング応答: サーバーは応答データのチャンクを継続的にプッシュします。クライアントは、接続が閉じられるまで、部分的な結果をリアルタイムで受信して処理できます。サーバーセントイベント (SSE) プロトコルのみがサポートされています。
ディープシンキング: 最終的な回答を生成する前に、モデルはその推論プロセスを明示的に出力します。この出力は、モデルの推論を構造化されたステップで表示し、結果の解釈可能性と精度を向上させます。
説明コンテンツ位置フィールドに何を入力すればよいかわからない場合は、以下の例を参照するか、入力ボックスの横にある [テスト] をクリックして構成を検証してください。
リクエストプロンプト位置の例
例 1
次の HTTP リクエスト本文では、プロンプト位置の JSONPath は
$.messages[0].content.parts[0]です。{ "action": "next", "messages": [{ "id": "c86043d3-6657-4a9e-85df-a22c98666367", "create_time": 1742977262.085, "content": { "content_type": "text", "parts": ["What is a large language model prompt?"] } }] }例 2
次の HTTP リクエスト本文では、プロンプト位置の JSONPath は
$.messages[1].contentです。{ "model": "gpt-3.5-turbo", "messages": [ { "role": "system", "content": "You are an assistant." }, { "role": "user", "content": "Help me write a thank-you letter." } ], "temperature": 0.7 }例 3
次の HTTP リクエスト本文では、最後のターンのユーザープロンプトの JSONPath は
$.messages[-1].contentです。{ "messages": [ { "role": "user", "content": "Explain neural networks." }, { "role": "assistant", "content": "A neural network is a computational model that simulates the structure of the human brain..." }, { "role": "user", "content": "What about a Transformer?" } ] }応答コンテンツ位置の例
非ストリーミング応答
次の HTTP 応答本文では、応答コンテンツ位置の JSONPath は
$.choices[0].message.contentです。{ "choices": [ { "message": { "role": "assistant", "content": "A large language model prompt is the input text that guides the model to generate a specific output." } } ] }ストリーミング応答
次の HTTP 応答本文には 5 つのコンテンツチャンクが含まれています。各チャンクのコンテンツパスの JSONPath は
$.answerです。data: {"event": "message", "message_id": "5adxxx6290", "conversation_id": "457xxx55f2", "answer": "Very", "created_at": 1679586595} data: {"event": "message", "message_id": "5adxxx6290", "conversation_id": "457xxx55f2", "answer": "glad", "created_at": 1679586595} data: {"event": "message", "message_id": "5adxxx6290", "conversation_id": "457xxx55f2", "answer": "to", "created_at": 1679586595} data: {"event": "message", "message_id": "5adxxx6290", "conversation_id": "457xxx55f2", "answer": "see", "created_at": 1679586595} data: {"event": "message", "message_id" : "5adxxx6290", "conversation_id": "457xxx55f2", "answer": "you", "created_at": 1679586595} data: {"event": "message_end", "id": "5adxxx6290", "conversation_id": "457xxx55f2", "metadata": {} }ディープシンキング
次の HTTP 応答本文では、ディープシンキング位置の JSONPath は
$.choices[0].delta.reasoning_contentです。data: {"choices":[{"delta":{"content":null,"role":"assistant","reasoning_content":""},"index":0,"logprobs":null,"finish_reason":null}],"object":"chat.completion.chunk","usage":null,"created":1758787252,"system_fingerprint":null,"model":"deepseek-v3.1","id":"chatcmpl-xxx-e30c1"} data: {"choices":[{"finish_reason":null,"logprobs":null,"delta":{"content":null,"reasoning_content":"Hmm"},"index":0}],"object":"chat.completion.chunk","usage":null,"created":1758787252,"system_fingerprint":null,"model":"deepseek-v3.1","id":"chatcmpl-xxx-e30c1"} data: {"choices":[{"delta":{"content":null,"reasoning_content":", the user"},"finish_reason":null,"index":0,"logprobs":null}],"object":"chat.completion.chunk","usage":null,"created":1758787252,"system_fingerprint":null,"model":"deepseek-v3.1","id":"chatcmpl-xxx-e30c1"} data: {"choices":[{"delta":{"content":null,"reasoning_content":" asked a"},"finish_reason":null,"index":0,"logprobs":null}],"object":"chat.completion.chunk","usage":null,"created":1758787252,"system_fingerprint":null,"model":"deepseek-v3.1","id":"chatcmpl-xxx-e30c1"} data: {"choices":[{"delta":{"content":null,"reasoning_content":" basic"},"finish_reason":null,"index":0,"logprobs":null}],"object":"chat.completion.chunk","usage":null,"created":1758787252,"system_fingerprint":null,"model":"deepseek-v3.1","id":"chatcmpl-xxx-e30c1"} data: {"choices":[{"delta":{"content":null,"reasoning_content":" self-introduction question."},"finish_reason":null,"index":0,"logprobs":null}],"object":"chat.completion.chunk","usage":null,"created":1758787252,"system_fingerprint":null,"model":"deepseek-v3.1","id":"chatcmpl-xxx-e30c1"} data: {"choices":[{"delta":{"content":"I am DeepSeek","reasoning_content":null},"finish_reason":null,"index":0,"logprobs":null}],"object":"chat.completion.chunk","usage":null,"created":1758787252,"system_fingerprint":null,"model":"deepseek-v3.1","id":"chatcmpl-xxx-e30c1"} data: {"choices":[{"delta":{"content":"How can","reasoning_content":null},"finish_reason":null,"index":0,"logprobs":null}],"object":"chat.completion.chunk","usage":null,"created":1758787252,"system_fingerprint":null,"model":"deepseek-v3.1","id":"chatcmpl-xxx-e30c1"} data: {"choices":[{"delta":{"content":" I","reasoning_content":null},"finish_reason":null,"index":0,"logprobs":null}],"object":"chat.completion.chunk","usage":null,"created":1758787252,"system_fingerprint":null,"model":"deepseek-v3.1","id":"chatcmpl-xxx-e30c1"} data: {"choices":[{"delta":{"content":" help","reasoning_content":null},"finish_reason":null,"index":0,"logprobs":null}],"object":"chat.completion.chunk","usage":null,"created":1758787252,"system_fingerprint":null,"model":"deepseek-v3.1","id":"chatcmpl-xxx-e30c1"} data: {"choices":[{"finish_reason":"stop","delta":{"content":" you?"},"index":0,"logprobs":null}],"object":"chat.completion.chunk","usage":null,"created":1758787252,"system_fingerprint":null,"model":"deepseek-v3.1","id":"chatcmpl-xxx-e30c1"} data: [DONE]
Associate with Protected Object を設定します。各アセットは 1 つの保護対象オブジェクトにのみ関連付けることができます。
アセットの表示と管理
Asset Management ページで、アセットを表示および管理できます。
アセットの表示: Protection Status 列で、アセットに構成されている保護を表示できます。保護が構成されていない場合、ステータスは [保護されていません] になります。
アセットの編集: [操作] 列で [編集] をクリックして、アセットの プロンプト位置 と Response Content を変更します。
アセットの削除: [操作] 列で [削除] をクリックしてアセットを削除します。削除されると、アセットは保護されなくなります。

次のステップ
作成後、アセットには緩和機能がありません。必要に応じて、アセットに プロンプト攻撃防御 またはコンテンツモデレーション保護テンプレートを構成します。
制限事項
アセットが作成されると、その 一致条件 と Associate with Protected Object は変更できません。
各アセットは 1 つの保護対象オブジェクトにのみ関連付けることができます。
ストリーミング応答は SSE プロトコルのみをサポートします。