Your team screens patient-uploaded PDF documents before a clinical agent processes them. The application calls the Azure AI Content Safety Prompt Shields API (shieldPrompt) directly, and no Foundry guardrail is assigned to the agent. The live user message is screened separately.
Requirements:
- Analyze the extracted document text for document attacks, such as hidden instructions that try to hijack the model session.
- Ensure a document classified as an attack is not passed to the agent.
Which design meets both requirements?
Prompt Shields analyze document attacks in the documents field, so untrusted PDF text belongs there rather than in the user prompt field. When the Content Safety API is called directly, it reports a result but does not block or route anything. The application must act on the attackDetected flag. The flag is a boolean, so the decision is based on that flag, not on a severity threshold.
- Not correct: Send the text in
documents; the API withholds the document whenattackDetectedis true. When the Content Safety API is called directly, it does not itself block or route content. Blocking before the model is a Foundry guardrail behavior, and no guardrail is assigned here. - Not correct: Send the text in
documents; the application withholds the document when attack severity is 4 or higher. The shieldPrompt API returns a boolean attackDetected flag, not a severity score, so there is no severity level to compare against a threshold. - Correct: Send the text in
documents; the application withholds the document whenattackDetectedis true. Document attacks are analyzed in the documents field. The API returns an attackDetected flag, and the application decides how to handle a detected attack, so withholding the document meets both requirements. - Not correct: Send the text in
userPrompt; the application withholds the document whenattackDetectedis true. Text in the user prompt field is analyzed for user prompt attacks. Document attack analysis applies to text in the documents field.