ContentFilterStrength

class aws_cdk.aws_bedrock_alpha.ContentFilterStrength(*values)

Bases: Enum

(experimental) The strength of the content filter.

As you increase the filter strength, the likelihood of filtering harmful content increases and the probability of seeing harmful content in your application reduces.

Stability:

experimental

ExampleMetadata:

fixture=default infused

Example:

# Create a guardrail to filter inappropriate content
guardrail = bedrock.Guardrail(self, "bedrockGuardrails",
    guardrail_name="my-BedrockGuardrails",
    description="Legal ethical guardrails."
)

guardrail.add_content_filter(
    type=bedrock.ContentFilterType.SEXUAL,
    input_strength=bedrock.ContentFilterStrength.HIGH,
    output_strength=bedrock.ContentFilterStrength.MEDIUM
)

# Create an agent with the guardrail
agent_with_guardrail = bedrock.Agent(self, "AgentWithGuardrail",
    foundation_model=bedrock.BedrockFoundationModel.ANTHROPIC_CLAUDE_HAIKU_V1_0,
    instruction="You are a helpful and friendly agent that answers questions about literature.",
    guardrail=guardrail
)

Attributes

HIGH

(experimental) High strength content filtering - aggressive filtering of harmful content.

Stability:

experimental

LOW

(experimental) Low strength content filtering - minimal filtering of harmful content.

Stability:

experimental

MEDIUM

(experimental) Medium strength content filtering - balanced filtering of harmful content.

Stability:

experimental

NONE

(experimental) No content filtering applied.

Stability:

experimental