apply_guardrail¶
Operation¶
apply_guardrail
async
¶
apply_guardrail(input: ApplyGuardrailInput, plugins: list[Plugin] | None = None) -> ApplyGuardrailOutput
The action to apply a guardrail.
For troubleshooting some of the common errors you might encounter when
using the ApplyGuardrail API, see Troubleshooting Amazon Bedrock API
Error
Codes
in the Amazon Bedrock User Guide
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
input
|
ApplyGuardrailInput
|
An instance of |
required |
plugins
|
list[Plugin] | None
|
A list of callables that modify the configuration dynamically. Changes made by these plugins only apply for the duration of the operation execution and will not affect any other operation invocations. |
None
|
Returns:
| Type | Description |
|---|---|
ApplyGuardrailOutput
|
An instance of |
Source code in src/aws_sdk_bedrock_runtime/client.py
86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 | |
Input¶
ApplyGuardrailInput
dataclass
¶
Dataclass for ApplyGuardrailInput structure.
Source code in src/aws_sdk_bedrock_runtime/models.py
1897 1898 1899 1900 1901 1902 1903 1904 1905 1906 1907 1908 1909 1910 1911 1912 1913 1914 1915 1916 1917 1918 1919 1920 1921 1922 1923 1924 1925 1926 1927 1928 1929 1930 1931 1932 1933 1934 1935 1936 1937 1938 1939 1940 1941 1942 1943 1944 1945 1946 1947 1948 1949 1950 1951 1952 1953 1954 1955 1956 1957 1958 1959 1960 1961 1962 1963 1964 1965 1966 1967 1968 1969 1970 1971 1972 1973 1974 1975 1976 1977 1978 1979 1980 1981 1982 1983 1984 1985 1986 1987 1988 1989 1990 1991 1992 1993 1994 1995 1996 | |
Attributes¶
content
class-attribute
instance-attribute
¶
content: list[GuardrailContentBlock] | None = None
The content details used in the request to apply the guardrail.
guardrail_identifier
class-attribute
instance-attribute
¶
guardrail_identifier: str | None = None
The guardrail identifier used in the request to apply the guardrail.
guardrail_version
class-attribute
instance-attribute
¶
guardrail_version: str | None = None
The guardrail version used in the request to apply the guardrail.
output_scope
class-attribute
instance-attribute
¶
output_scope: str | None = None
Specifies the scope of the output that you get in the response. Set to
FULL to return the entire output, including any detected and
non-detected entries in the response for enhanced debugging.
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).
source
class-attribute
instance-attribute
¶
source: str | None = None
The source of data used in the request to apply the guardrail.
Output¶
ApplyGuardrailOutput
dataclass
¶
Dataclass for ApplyGuardrailOutput structure.
Source code in src/aws_sdk_bedrock_runtime/models.py
5272 5273 5274 5275 5276 5277 5278 5279 5280 5281 5282 5283 5284 5285 5286 5287 5288 5289 5290 5291 5292 5293 5294 5295 5296 5297 5298 5299 5300 5301 5302 5303 5304 5305 5306 5307 5308 5309 5310 5311 5312 5313 5314 5315 5316 5317 5318 5319 5320 5321 5322 5323 5324 5325 5326 5327 5328 5329 5330 5331 5332 5333 5334 5335 5336 5337 5338 5339 5340 5341 5342 5343 5344 5345 5346 5347 5348 5349 5350 5351 5352 5353 5354 5355 5356 5357 5358 5359 5360 5361 5362 5363 5364 | |
Attributes¶
action_reason
class-attribute
instance-attribute
¶
action_reason: str | None = None
The reason for the action taken when harmful content is detected.
assessments
instance-attribute
¶
assessments: list[GuardrailAssessment]
The assessment details in the response from the guardrail.
guardrail_coverage
class-attribute
instance-attribute
¶
guardrail_coverage: GuardrailCoverage | None = None
The guardrail coverage details in the apply guardrail response.
outputs
instance-attribute
¶
outputs: list[GuardrailOutputContent]
The output details in the response from the guardrail.
usage
instance-attribute
¶
usage: GuardrailUsage
The usage details in the response from the guardrail.