Guardrail
- class aws_cdk.aws_stepfunctions_tasks.Guardrail(*args: Any, **kwargs)
Bases:
object
Guradrail settings for BedrockInvokeModel.
- ExampleMetadata:
infused
Example:
import aws_cdk.aws_bedrock as bedrock model = bedrock.FoundationModel.from_foundation_model_id(self, "Model", bedrock.FoundationModelIdentifier.AMAZON_TITAN_TEXT_G1_EXPRESS_V1) task = tasks.BedrockInvokeModel(self, "Prompt Model with guardrail", model=model, body=sfn.TaskInput.from_object({ "input_text": "Generate a list of five first names.", "text_generation_config": { "max_token_count": 100, "temperature": 1 } }), guardrail=tasks.Guardrail.enable("guardrailId", 1), result_selector={ "names": sfn.JsonPath.string_at("$.Body.results[0].outputText") } )
Attributes
- guardrail_identifier
The identitifier of guardrail.
- guardrail_version
The version of guardrail.
Static Methods
- classmethod enable(identifier, version)
Enable guardrail.
- Parameters:
identifier (
str
) – The id or arn of the guardrail.version (
Union
[int
,float
]) – The version of the guardrail.
- Return type: