ContextualGroundingFilter
- class aws_cdk.aws_bedrock_alpha.ContextualGroundingFilter(*, threshold, type, action=None, enabled=None)
Bases:
object(experimental) Interface to define a Contextual Grounding Filter.
- Parameters:
threshold (
Union[int,float]) – (experimental) The threshold for the contextual grounding filter. -0(blocks nothing) -0.99(blocks almost everything)type (
ContextualGroundingFilterType) – (experimental) The type of contextual grounding filter.action (
Optional[GuardrailAction]) – (experimental) The action to take when contextual grounding is detected. Default: GuardrailAction.BLOCKenabled (
Optional[bool]) – (experimental) Whether the contextual grounding filter is enabled. Default: true
- Stability:
experimental
- ExampleMetadata:
fixture=default infused
Example:
guardrail = bedrock.Guardrail(self, "bedrockGuardrails", guardrail_name="my-BedrockGuardrails" ) # Add contextual grounding filter with action and enabled flag guardrail.add_contextual_grounding_filter( type=bedrock.ContextualGroundingFilterType.GROUNDING, threshold=0.8, # the properties below are optional action=bedrock.GuardrailAction.BLOCK, enabled=True )
Attributes
- action
(experimental) The action to take when contextual grounding is detected.
- Default:
GuardrailAction.BLOCK
- Stability:
experimental
- enabled
(experimental) Whether the contextual grounding filter is enabled.
- Default:
true
- Stability:
experimental
- threshold
(experimental) The threshold for the contextual grounding filter.
0(blocks nothing)0.99(blocks almost everything)
- Stability:
experimental
- type
(experimental) The type of contextual grounding filter.
- Stability:
experimental