@cdklabs/generative-ai-cdk-constructs
@cdklabs/generative-ai-cdk-constructs / BedrockBatchSfn
A state machine fragment that creates a Bedrock Batch Inference Job and waits for its completion.
Input schema:
{
"job_name": string, // Required. Name of the batch inference job
"manifest_keys": string[], // Required. List of S3 keys of the input manifest files
"model_id": string // Required. Model ID to use.
}
Output schema:
{
"status": string, // Required. Status of the batch job. One of: "Completed" or "PartiallyCompleted"
"bucket": string, // Required. S3 bucket where the output is stored
"keys": string[] // Required. Array of S3 keys for the output files
}
Error schema:
{
"status": string, // Required. Status will be one of: "Failed", "Stopped", or "Expired"
"error": string, // Required. Error code
"cause": string // Required. Error message
}
StateMachineFragment
new BedrockBatchSfn(
parent
,id
,props
):BedrockBatchSfn
Construct
string
sfn.StateMachineFragment.constructor
readonly
endStates:INextable
[]
The states to chain onto if this fragment is used
sfn.StateMachineFragment.endStates
readonly
node:Node
The tree node.
sfn.StateMachineFragment.node
readonly
startState:State
The start state of this state machine fragment
sfn.StateMachineFragment.startState
get id():
string
Descriptive identifier for this chainable
string
sfn.StateMachineFragment.id
next(
next
):Chain
Continue normal execution with the given state
IChainable
Chain
sfn.StateMachineFragment.next
prefixStates(
prefix
?):StateMachineFragment
Prefix the IDs of all states in this state machine fragment
Use this to avoid multiple copies of the state machine all having the same state IDs.
string
The prefix to add. Will use construct ID by default.
StateMachineFragment
sfn.StateMachineFragment.prefixStates
toSingleState(
options
?):Parallel
Wrap all states in this state machine fragment up into a single state.
This can be used to add retry or error handling onto this state machine fragment.
Be aware that this changes the result of the inner state machine to be an array with the result of the state machine in it. Adjust your paths accordingly. For example, change ‘outputPath’ to ‘$[0]’.
SingleStateOptions
Parallel
sfn.StateMachineFragment.toSingleState
toString():
string
Returns a string representation of this construct.
string
sfn.StateMachineFragment.toString
static
isConstruct(x
):x is Construct
Checks if x
is a construct.
Use this method instead of instanceof
to properly detect Construct
instances, even when the construct library is symlinked.
Explanation: in JavaScript, multiple copies of the constructs
library on
disk are seen as independent, completely different libraries. As a
consequence, the class Construct
in each copy of the constructs
library
is seen as a different class, and an instance of one class will not test as
instanceof
the other class. npm install
will not create installations
like this, but users may manually symlink construct libraries together or
use a monorepo tool: in those cases, multiple copies of the constructs
library can be accidentally installed, and instanceof
will behave
unpredictably. It is safest to avoid using instanceof
, and using
this type-testing method instead.
any
Any object
x is Construct
true if x
is an object created from a class which extends Construct
.
sfn.StateMachineFragment.isConstruct