Apply Guardrail
bedrockruntime_apply_guardrail | R Documentation |
The action to apply a guardrail¶
Description¶
The action to apply a guardrail.
For troubleshooting some of the common errors you might encounter when
using the apply_guardrail
API, see Troubleshooting Amazon Bedrock API
Error
Codes
in the Amazon Bedrock User Guide
Usage¶
bedrockruntime_apply_guardrail(guardrailIdentifier, guardrailVersion,
source, content, outputScope)
Arguments¶
guardrailIdentifier |
[required] The guardrail identifier used in the request to apply the guardrail. |
guardrailVersion |
[required] The guardrail version used in the request to apply the guardrail. |
source |
[required] The source of data used in the request to apply the guardrail. |
content |
[required] The content details used in the request to apply the guardrail. |
outputScope |
Specifies the scope of the output that you get in the response.
Set to Note that the full output scope doesn't apply to word filters or regex in sensitive information filters. It does apply to all other filtering policies, including sensitive information with filters that can detect personally identifiable information (PII). |
Value¶
A list with the following syntax:
list(
usage = list(
topicPolicyUnits = 123,
contentPolicyUnits = 123,
wordPolicyUnits = 123,
sensitiveInformationPolicyUnits = 123,
sensitiveInformationPolicyFreeUnits = 123,
contextualGroundingPolicyUnits = 123,
contentPolicyImageUnits = 123
),
action = "NONE"|"GUARDRAIL_INTERVENED",
actionReason = "string",
outputs = list(
list(
text = "string"
)
),
assessments = list(
list(
topicPolicy = list(
topics = list(
list(
name = "string",
type = "DENY",
action = "BLOCKED"|"NONE",
detected = TRUE|FALSE
)
)
),
contentPolicy = list(
filters = list(
list(
type = "INSULTS"|"HATE"|"SEXUAL"|"VIOLENCE"|"MISCONDUCT"|"PROMPT_ATTACK",
confidence = "NONE"|"LOW"|"MEDIUM"|"HIGH",
filterStrength = "NONE"|"LOW"|"MEDIUM"|"HIGH",
action = "BLOCKED"|"NONE",
detected = TRUE|FALSE
)
)
),
wordPolicy = list(
customWords = list(
list(
match = "string",
action = "BLOCKED"|"NONE",
detected = TRUE|FALSE
)
),
managedWordLists = list(
list(
match = "string",
type = "PROFANITY",
action = "BLOCKED"|"NONE",
detected = TRUE|FALSE
)
)
),
sensitiveInformationPolicy = list(
piiEntities = list(
list(
match = "string",
type = "ADDRESS"|"AGE"|"AWS_ACCESS_KEY"|"AWS_SECRET_KEY"|"CA_HEALTH_NUMBER"|"CA_SOCIAL_INSURANCE_NUMBER"|"CREDIT_DEBIT_CARD_CVV"|"CREDIT_DEBIT_CARD_EXPIRY"|"CREDIT_DEBIT_CARD_NUMBER"|"DRIVER_ID"|"EMAIL"|"INTERNATIONAL_BANK_ACCOUNT_NUMBER"|"IP_ADDRESS"|"LICENSE_PLATE"|"MAC_ADDRESS"|"NAME"|"PASSWORD"|"PHONE"|"PIN"|"SWIFT_CODE"|"UK_NATIONAL_HEALTH_SERVICE_NUMBER"|"UK_NATIONAL_INSURANCE_NUMBER"|"UK_UNIQUE_TAXPAYER_REFERENCE_NUMBER"|"URL"|"USERNAME"|"US_BANK_ACCOUNT_NUMBER"|"US_BANK_ROUTING_NUMBER"|"US_INDIVIDUAL_TAX_IDENTIFICATION_NUMBER"|"US_PASSPORT_NUMBER"|"US_SOCIAL_SECURITY_NUMBER"|"VEHICLE_IDENTIFICATION_NUMBER",
action = "ANONYMIZED"|"BLOCKED"|"NONE",
detected = TRUE|FALSE
)
),
regexes = list(
list(
name = "string",
match = "string",
regex = "string",
action = "ANONYMIZED"|"BLOCKED"|"NONE",
detected = TRUE|FALSE
)
)
),
contextualGroundingPolicy = list(
filters = list(
list(
type = "GROUNDING"|"RELEVANCE",
threshold = 123.0,
score = 123.0,
action = "BLOCKED"|"NONE",
detected = TRUE|FALSE
)
)
),
invocationMetrics = list(
guardrailProcessingLatency = 123,
usage = list(
topicPolicyUnits = 123,
contentPolicyUnits = 123,
wordPolicyUnits = 123,
sensitiveInformationPolicyUnits = 123,
sensitiveInformationPolicyFreeUnits = 123,
contextualGroundingPolicyUnits = 123,
contentPolicyImageUnits = 123
),
guardrailCoverage = list(
textCharacters = list(
guarded = 123,
total = 123
),
images = list(
guarded = 123,
total = 123
)
)
)
)
),
guardrailCoverage = list(
textCharacters = list(
guarded = 123,
total = 123
),
images = list(
guarded = 123,
total = 123
)
)
)
Request syntax¶
svc$apply_guardrail(
guardrailIdentifier = "string",
guardrailVersion = "string",
source = "INPUT"|"OUTPUT",
content = list(
list(
text = list(
text = "string",
qualifiers = list(
"grounding_source"|"query"|"guard_content"
)
),
image = list(
format = "png"|"jpeg",
source = list(
bytes = raw
)
)
)
),
outputScope = "INTERVENTIONS"|"FULL"
)