Class CfnFlow
- All Implemented Interfaces:
IInspectable,IFlowRef,IEnvironmentAware,ITaggableV2,software.amazon.jsii.JsiiSerializable,software.constructs.IConstruct,software.constructs.IDependable
You define a flow by configuring nodes, each of which corresponds to a step of the flow, and creating connections between the nodes to create paths to different outputs. You can define the flow in one of the following ways:
- Define a FlowDefinition in the
Definitionproperty. - Provide the definition in the
DefinitionStringproperty as a JSON-formatted string matching the FlowDefinition property. - Provide an Amazon S3 location in the
DefinitionS3Locationproperty that matches the FlowDefinition .
If you use the DefinitionString or DefinitionS3Location property, you can use the DefinitionSubstitutions property to define key-value pairs to replace at runtime.
For more information, see How it works and Create a prompt flow in Amazon Bedrock in the Amazon Bedrock User Guide.
Example:
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import software.amazon.awscdk.services.bedrock.*;
Object additionalModelRequestFields;
Object collector;
FlowDefinitionProperty flowDefinitionProperty_;
Object input;
Object iterator;
Object loopInput;
Object output;
CfnFlow cfnFlow = CfnFlow.Builder.create(this, "MyCfnFlow")
.executionRoleArn("executionRoleArn")
.name("name")
// the properties below are optional
.customerEncryptionKeyArn("customerEncryptionKeyArn")
.definition(FlowDefinitionProperty.builder()
.connections(List.of(FlowConnectionProperty.builder()
.name("name")
.source("source")
.target("target")
.type("type")
// the properties below are optional
.configuration(FlowConnectionConfigurationProperty.builder()
.conditional(FlowConditionalConnectionConfigurationProperty.builder()
.condition("condition")
.build())
.data(FlowDataConnectionConfigurationProperty.builder()
.sourceOutput("sourceOutput")
.targetInput("targetInput")
.build())
.build())
.build()))
.nodes(List.of(FlowNodeProperty.builder()
.name("name")
.type("type")
// the properties below are optional
.configuration(FlowNodeConfigurationProperty.builder()
.agent(AgentFlowNodeConfigurationProperty.builder()
.agentAliasArn("agentAliasArn")
.build())
.collector(collector)
.condition(ConditionFlowNodeConfigurationProperty.builder()
.conditions(List.of(FlowConditionProperty.builder()
.name("name")
// the properties below are optional
.expression("expression")
.build()))
.build())
.inlineCode(InlineCodeFlowNodeConfigurationProperty.builder()
.code("code")
.language("language")
.build())
.input(input)
.iterator(iterator)
.knowledgeBase(KnowledgeBaseFlowNodeConfigurationProperty.builder()
.knowledgeBaseId("knowledgeBaseId")
// the properties below are optional
.guardrailConfiguration(GuardrailConfigurationProperty.builder()
.guardrailIdentifier("guardrailIdentifier")
.guardrailVersion("guardrailVersion")
.build())
.inferenceConfiguration(PromptInferenceConfigurationProperty.builder()
.text(PromptModelInferenceConfigurationProperty.builder()
.maxTokens(123)
.stopSequences(List.of("stopSequences"))
.temperature(123)
.topP(123)
.build())
.build())
.modelId("modelId")
.numberOfResults(123)
.orchestrationConfiguration(KnowledgeBaseOrchestrationConfigurationProperty.builder()
.additionalModelRequestFields(additionalModelRequestFields)
.inferenceConfig(PromptInferenceConfigurationProperty.builder()
.text(PromptModelInferenceConfigurationProperty.builder()
.maxTokens(123)
.stopSequences(List.of("stopSequences"))
.temperature(123)
.topP(123)
.build())
.build())
.performanceConfig(PerformanceConfigurationProperty.builder()
.latency("latency")
.build())
.promptTemplate(KnowledgeBasePromptTemplateProperty.builder()
.textPromptTemplate("textPromptTemplate")
.build())
.build())
.promptTemplate(KnowledgeBasePromptTemplateProperty.builder()
.textPromptTemplate("textPromptTemplate")
.build())
.rerankingConfiguration(VectorSearchRerankingConfigurationProperty.builder()
.type("type")
// the properties below are optional
.bedrockRerankingConfiguration(VectorSearchBedrockRerankingConfigurationProperty.builder()
.modelConfiguration(VectorSearchBedrockRerankingModelConfigurationProperty.builder()
.modelArn("modelArn")
// the properties below are optional
.additionalModelRequestFields(additionalModelRequestFields)
.build())
// the properties below are optional
.metadataConfiguration(MetadataConfigurationForRerankingProperty.builder()
.selectionMode("selectionMode")
// the properties below are optional
.selectiveModeConfiguration(RerankingMetadataSelectiveModeConfigurationProperty.builder()
.fieldsToExclude(List.of(FieldForRerankingProperty.builder()
.fieldName("fieldName")
.build()))
.fieldsToInclude(List.of(FieldForRerankingProperty.builder()
.fieldName("fieldName")
.build()))
.build())
.build())
.numberOfRerankedResults(123)
.build())
.build())
.build())
.lambdaFunction(LambdaFunctionFlowNodeConfigurationProperty.builder()
.lambdaArn("lambdaArn")
.build())
.lex(LexFlowNodeConfigurationProperty.builder()
.botAliasArn("botAliasArn")
.localeId("localeId")
.build())
.loop(LoopFlowNodeConfigurationProperty.builder()
.definition(flowDefinitionProperty_)
.build())
.loopController(LoopControllerFlowNodeConfigurationProperty.builder()
.continueCondition(FlowConditionProperty.builder()
.name("name")
// the properties below are optional
.expression("expression")
.build())
// the properties below are optional
.maxIterations(123)
.build())
.loopInput(loopInput)
.output(output)
.prompt(PromptFlowNodeConfigurationProperty.builder()
.sourceConfiguration(PromptFlowNodeSourceConfigurationProperty.builder()
.inline(PromptFlowNodeInlineConfigurationProperty.builder()
.modelId("modelId")
.templateConfiguration(PromptTemplateConfigurationProperty.builder()
.text(TextPromptTemplateConfigurationProperty.builder()
.text("text")
// the properties below are optional
.inputVariables(List.of(PromptInputVariableProperty.builder()
.name("name")
.build()))
.build())
.build())
.templateType("templateType")
// the properties below are optional
.inferenceConfiguration(PromptInferenceConfigurationProperty.builder()
.text(PromptModelInferenceConfigurationProperty.builder()
.maxTokens(123)
.stopSequences(List.of("stopSequences"))
.temperature(123)
.topP(123)
.build())
.build())
.build())
.resource(PromptFlowNodeResourceConfigurationProperty.builder()
.promptArn("promptArn")
.build())
.build())
// the properties below are optional
.guardrailConfiguration(GuardrailConfigurationProperty.builder()
.guardrailIdentifier("guardrailIdentifier")
.guardrailVersion("guardrailVersion")
.build())
.build())
.retrieval(RetrievalFlowNodeConfigurationProperty.builder()
.serviceConfiguration(RetrievalFlowNodeServiceConfigurationProperty.builder()
.s3(RetrievalFlowNodeS3ConfigurationProperty.builder()
.bucketName("bucketName")
.build())
.build())
.build())
.storage(StorageFlowNodeConfigurationProperty.builder()
.serviceConfiguration(StorageFlowNodeServiceConfigurationProperty.builder()
.s3(StorageFlowNodeS3ConfigurationProperty.builder()
.bucketName("bucketName")
.build())
.build())
.build())
.build())
.inputs(List.of(FlowNodeInputProperty.builder()
.expression("expression")
.name("name")
.type("type")
// the properties below are optional
.category("category")
.build()))
.outputs(List.of(FlowNodeOutputProperty.builder()
.name("name")
.type("type")
.build()))
.build()))
.build())
.definitionS3Location(S3LocationProperty.builder()
.bucket("bucket")
.key("key")
// the properties below are optional
.version("version")
.build())
.definitionString("definitionString")
.definitionSubstitutions(Map.of(
"definitionSubstitutionsKey", "definitionSubstitutions"))
.description("description")
.tags(Map.of(
"tagsKey", "tags"))
.testAliasTags(Map.of(
"testAliasTagsKey", "testAliasTags"))
.build();
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic interfaceDefines an agent node in your flow.static final classA fluent builder forCfnFlow.static interfaceDefines a condition node in your flow.static interfaceSpecifies a field to be used during the reranking process in a Knowledge Base vector search.static interfaceThe configuration of a connection between a condition node and another node.static interfaceDefines a condition in the condition node.static interfaceThe configuration of the connection.static interfaceContains information about a connection between two nodes in the flow.static interfaceThe configuration of a connection originating from a node that isn't a Condition node.static interfaceThe definition of the nodes and connections between nodes in the flow.static interfaceContains configurations for a node in your flow.static interfaceContains configurations for an input in an Amazon Bedrock Flows node.static interfaceContains configurations for an output from a node.static interfaceContains configurations about a node in the flow.static interfaceContains information about validation of the flow.static interfaceConfiguration information for a guardrail that you use with the Converse operation.static interfaceContains configurations for an inline code node in your flow.static interfaceContains configurations for a knowledge base node in a flow.static interfaceConfigures how the knowledge base orchestrates the retrieval and generation process, allowing for customization of prompts, inference parameters, and performance settings.static interfaceDefines a custom prompt template for orchestrating the retrieval and generation process.static interfaceContains configurations for a Lambda function node in the flow.static interfaceContains configurations for a Lex node in the flow.static interfaceContains configurations for the controller node of a DoWhile loop in the flow.static interfaceContains configurations for the nodes of a DoWhile loop in your flow.static interfaceConfiguration for how metadata should be used during the reranking process in Knowledge Base vector searches.static interfacePerformance settings for a model.static interfaceContains configurations for a prompt node in the flow.static interfaceContains configurations for a prompt defined inline in the node.static interfaceContains configurations for a prompt from Prompt management to use in a node.static interfaceContains configurations for a prompt and whether it is from Prompt management or defined inline.static interfaceContains inference configurations for the prompt.static interfaceContains information about a variable in the prompt.static interfaceContains inference configurations related to model inference for a prompt.static interfaceContains the message for a prompt.static interfaceConfiguration for selectively including or excluding metadata fields during the reranking process.static interfaceContains configurations for a Retrieval node in a flow.static interfaceContains configurations for the Amazon S3 location from which to retrieve data to return as the output from the node.static interfaceContains configurations for the service to use for retrieving data to return as the output from the node.static interfaceThe S3 location of the flow definition.static interfaceContains configurations for a Storage node in a flow.static interfaceContains configurations for the Amazon S3 location in which to store the input into the node.static interfaceContains configurations for the service to use for storing the input into the node.static interfaceContains configurations for a text prompt template.static interfaceConfiguration for using Amazon Bedrock foundation models to rerank Knowledge Base vector search results.static interfaceConfiguration for the Amazon Bedrock foundation model used for reranking vector search results.static interfaceConfiguration for reranking vector search results to improve relevance.Nested classes/interfaces inherited from class software.amazon.jsii.JsiiObject
software.amazon.jsii.JsiiObject.InitializationModeNested classes/interfaces inherited from interface software.constructs.IConstruct
software.constructs.IConstruct.Jsii$DefaultNested classes/interfaces inherited from interface software.amazon.awscdk.interfaces.bedrock.IFlowRef
IFlowRef.Jsii$Default, IFlowRef.Jsii$ProxyNested classes/interfaces inherited from interface software.amazon.awscdk.IInspectable
IInspectable.Jsii$Default, IInspectable.Jsii$ProxyNested classes/interfaces inherited from interface software.amazon.awscdk.ITaggableV2
ITaggableV2.Jsii$Default, ITaggableV2.Jsii$Proxy -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StringThe CloudFormation resource type name for this resource class. -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedCfnFlow(software.amazon.jsii.JsiiObject.InitializationMode initializationMode) protectedCfnFlow(software.amazon.jsii.JsiiObjectRef objRef) CfnFlow(software.constructs.Construct scope, String id, CfnFlowProps props) Create a newAWS::Bedrock::Flow. -
Method Summary
Modifier and TypeMethodDescriptionstatic StringarnForFlow(IFlowRef resource) The Amazon Resource Name (ARN) of the flow.The time at which the flow was created.The unique identifier of the flow.The status of the flow.The time at which the flow was last updated.List of flow validations.The latest version of the flow.Tag Manager which manages the tags for this resource.The Amazon Resource Name (ARN) of the KMS key that the flow is encrypted with.The definition of the nodes and connections between the nodes in the flow.The Amazon S3 location of the flow definition.The definition of the flow as a JSON-formatted string.A map that specifies the mappings for placeholder variables in the prompt flow definition.A description of the flow.The Amazon Resource Name (ARN) of the service role with permissions to create a flow.A reference to a Flow resource.getName()The name of the flow.getTags()Metadata that you can assign to a resource as key-value pairs.A map of tag keys and values.voidinspect(TreeInspector inspector) Examines the CloudFormation resource and discloses attributes.static BooleanChecks whether the given object is a CfnFlow.renderProperties(Map<String, Object> props) voidThe Amazon Resource Name (ARN) of the KMS key that the flow is encrypted with.voidsetDefinition(IResolvable value) The definition of the nodes and connections between the nodes in the flow.voidThe definition of the nodes and connections between the nodes in the flow.voidThe Amazon S3 location of the flow definition.voidThe Amazon S3 location of the flow definition.voidsetDefinitionString(String value) The definition of the flow as a JSON-formatted string.voidsetDefinitionSubstitutions(Map<String, Object> value) A map that specifies the mappings for placeholder variables in the prompt flow definition.voidA map that specifies the mappings for placeholder variables in the prompt flow definition.voidsetDescription(String value) A description of the flow.voidsetExecutionRoleArn(String value) The Amazon Resource Name (ARN) of the service role with permissions to create a flow.voidThe name of the flow.voidMetadata that you can assign to a resource as key-value pairs.voidsetTestAliasTags(Map<String, String> value) A map of tag keys and values.voidsetTestAliasTags(IResolvable value) A map of tag keys and values.Methods inherited from class software.amazon.awscdk.CfnResource
addDeletionOverride, addDependency, addDependsOn, addMetadata, addOverride, addPropertyDeletionOverride, addPropertyOverride, applyRemovalPolicy, applyRemovalPolicy, applyRemovalPolicy, getAtt, getAtt, getCfnOptions, getCfnResourceType, getEnv, getMetadata, getUpdatedProperites, getUpdatedProperties, isCfnResource, obtainDependencies, obtainResourceDependencies, removeDependency, replaceDependency, shouldSynthesize, toString, validatePropertiesMethods inherited from class software.amazon.awscdk.CfnRefElement
getRefMethods inherited from class software.amazon.awscdk.CfnElement
getCreationStack, getLogicalId, getStack, isCfnElement, overrideLogicalIdMethods inherited from class software.constructs.Construct
getNode, isConstructMethods inherited from class software.amazon.jsii.JsiiObject
jsiiAsyncCall, jsiiAsyncCall, jsiiCall, jsiiCall, jsiiGet, jsiiGet, jsiiSet, jsiiStaticCall, jsiiStaticCall, jsiiStaticGet, jsiiStaticGet, jsiiStaticSet, jsiiStaticSetMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface software.constructs.IConstruct
getNodeMethods inherited from interface software.amazon.awscdk.interfaces.IEnvironmentAware
getEnvMethods inherited from interface software.amazon.jsii.JsiiSerializable
$jsii$toJson
-
Field Details
-
CFN_RESOURCE_TYPE_NAME
The CloudFormation resource type name for this resource class.
-
-
Constructor Details
-
CfnFlow
protected CfnFlow(software.amazon.jsii.JsiiObjectRef objRef) -
CfnFlow
protected CfnFlow(software.amazon.jsii.JsiiObject.InitializationMode initializationMode) -
CfnFlow
@Stability(Stable) public CfnFlow(@NotNull software.constructs.Construct scope, @NotNull String id, @NotNull CfnFlowProps props) Create a newAWS::Bedrock::Flow.- Parameters:
scope- Scope in which this resource is defined. This parameter is required.id- Construct identifier for this resource (unique in its scope). This parameter is required.props- Resource properties. This parameter is required.
-
-
Method Details
-
arnForFlow
- Parameters:
resource- This parameter is required.
-
isCfnFlow
Checks whether the given object is a CfnFlow.- Parameters:
x- This parameter is required.
-
inspect
Examines the CloudFormation resource and discloses attributes.- Specified by:
inspectin interfaceIInspectable- Parameters:
inspector- tree inspector to collect and process attributes. This parameter is required.
-
renderProperties
@Stability(Stable) @NotNull protected Map<String,Object> renderProperties(@NotNull Map<String, Object> props) - Overrides:
renderPropertiesin classCfnResource- Parameters:
props- This parameter is required.
-
getAttrArn
The Amazon Resource Name (ARN) of the flow. -
getAttrCreatedAt
The time at which the flow was created. -
getAttrId
The unique identifier of the flow. -
getAttrStatus
The status of the flow. The following statuses are possible:.- NotPrepared – The flow has been created or updated, but hasn't been prepared. If you just created the flow, you can't test it. If you updated the flow, the
DRAFTversion won't contain the latest changes for testing. Send a PrepareFlow request to package the latest changes into theDRAFTversion. - Preparing – The flow is being prepared so that the
DRAFTversion contains the latest changes for testing. - Prepared – The flow is prepared and the
DRAFTversion contains the latest changes for testing. - Failed – The last API operation that you invoked on the flow failed. Send a GetFlow request and check the error message in the
validationsfield.
- NotPrepared – The flow has been created or updated, but hasn't been prepared. If you just created the flow, you can't test it. If you updated the flow, the
-
getAttrUpdatedAt
The time at which the flow was last updated. -
getAttrValidations
List of flow validations. -
getAttrVersion
The latest version of the flow. -
getCdkTagManager
Tag Manager which manages the tags for this resource.- Specified by:
getCdkTagManagerin interfaceITaggableV2
-
getCfnProperties
- Overrides:
getCfnPropertiesin classCfnResource
-
getFlowRef
A reference to a Flow resource.- Specified by:
getFlowRefin interfaceIFlowRef
-
getExecutionRoleArn
The Amazon Resource Name (ARN) of the service role with permissions to create a flow. -
setExecutionRoleArn
The Amazon Resource Name (ARN) of the service role with permissions to create a flow. -
getName
The name of the flow. -
setName
The name of the flow. -
getCustomerEncryptionKeyArn
The Amazon Resource Name (ARN) of the KMS key that the flow is encrypted with. -
setCustomerEncryptionKeyArn
The Amazon Resource Name (ARN) of the KMS key that the flow is encrypted with. -
getDefinition
The definition of the nodes and connections between the nodes in the flow.Returns union: either
IResolvableorCfnFlow.FlowDefinitionProperty -
setDefinition
The definition of the nodes and connections between the nodes in the flow. -
setDefinition
The definition of the nodes and connections between the nodes in the flow. -
getDefinitionS3Location
The Amazon S3 location of the flow definition.Returns union: either
IResolvableorCfnFlow.S3LocationProperty -
setDefinitionS3Location
The Amazon S3 location of the flow definition. -
setDefinitionS3Location
The Amazon S3 location of the flow definition. -
getDefinitionString
The definition of the flow as a JSON-formatted string. -
setDefinitionString
The definition of the flow as a JSON-formatted string. -
getDefinitionSubstitutions
A map that specifies the mappings for placeholder variables in the prompt flow definition.Returns union: either
IResolvableor Mapinvalid input: '<'String, eitherStringorNumberorBooleanorIResolvable> -
setDefinitionSubstitutions
A map that specifies the mappings for placeholder variables in the prompt flow definition. -
setDefinitionSubstitutions
A map that specifies the mappings for placeholder variables in the prompt flow definition. -
getDescription
A description of the flow. -
setDescription
A description of the flow. -
getTags
Metadata that you can assign to a resource as key-value pairs.For more information, see the following resources:.
-
setTags
Metadata that you can assign to a resource as key-value pairs.For more information, see the following resources:.
-
getTestAliasTags
A map of tag keys and values.Returns union: either Mapinvalid input: '<'String,
String> orIResolvable -
setTestAliasTags
A map of tag keys and values. -
setTestAliasTags
A map of tag keys and values.
-