BedrockInvokeModelJsonataProps Struct
Properties for invoking a Bedrock Model.
| Source | aws-stepfunctions-tasks/lib/bedrock/invoke-model.ts |
|---|---|
| Type last changed |
Example
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import * as cdk from 'aws-cdk-lib';
import { aws_bedrock as bedrock } from 'aws-cdk-lib';
import { aws_stepfunctions as stepfunctions } from 'aws-cdk-lib';
import { aws_stepfunctions_tasks as stepfunctions_tasks } from 'aws-cdk-lib';
declare const assign: any;
declare const guardrail: stepfunctions_tasks.Guardrail;
declare const model: bedrock.IModel;
declare const outputs: any;
declare const taskInput: stepfunctions.TaskInput;
declare const taskRole: stepfunctions.TaskRole;
declare const timeout: stepfunctions.Timeout;
const bedrockInvokeModelJsonataProps: stepfunctions_tasks.BedrockInvokeModelJsonataProps = {
model: model,
// the properties below are optional
accept: 'accept',
assign: {
assignKey: assign,
},
body: taskInput,
comment: 'comment',
contentType: 'contentType',
credentials: {
role: taskRole,
},
guardrail: guardrail,
heartbeat: cdk.Duration.minutes(30),
heartbeatTimeout: timeout,
input: {
s3InputUri: 's3InputUri',
s3Location: {
bucketName: 'bucketName',
objectKey: 'objectKey',
// the properties below are optional
objectVersion: 'objectVersion',
},
},
integrationPattern: stepfunctions.IntegrationPattern.REQUEST_RESPONSE,
output: {
s3Location: {
bucketName: 'bucketName',
objectKey: 'objectKey',
// the properties below are optional
objectVersion: 'objectVersion',
},
s3OutputUri: 's3OutputUri',
},
outputs: outputs,
queryLanguage: stepfunctions.QueryLanguage.JSON_PATH,
stateName: 'stateName',
taskTimeout: timeout,
timeout: cdk.Duration.minutes(30),
traceEnabled: false,
};
# The code below shows an example of how to instantiate this type.
# The values are placeholders you should change.
import aws_cdk as cdk
from aws_cdk import aws_bedrock as bedrock
from aws_cdk import aws_stepfunctions as stepfunctions
from aws_cdk import aws_stepfunctions_tasks as stepfunctions_tasks
# assign: Any
# guardrail: stepfunctions_tasks.Guardrail
# model: bedrock.IModel
# outputs: Any
# task_input: stepfunctions.TaskInput
# task_role: stepfunctions.TaskRole
# timeout: stepfunctions.Timeout
bedrock_invoke_model_jsonata_props = stepfunctions_tasks.BedrockInvokeModelJsonataProps(
model=model,
# the properties below are optional
accept="accept",
assign={
"assign_key": assign
},
body=task_input,
comment="comment",
content_type="contentType",
credentials=stepfunctions.Credentials(
role=task_role
),
guardrail=guardrail,
heartbeat=cdk.Duration.minutes(30),
heartbeat_timeout=timeout,
input=stepfunctions_tasks.BedrockInvokeModelInputProps(
s3_input_uri="s3InputUri",
s3_location=cdk.aws_s3.Location(
bucket_name="bucketName",
object_key="objectKey",
# the properties below are optional
object_version="objectVersion"
)
),
integration_pattern=stepfunctions.IntegrationPattern.REQUEST_RESPONSE,
output=stepfunctions_tasks.BedrockInvokeModelOutputProps(
s3_location=cdk.aws_s3.Location(
bucket_name="bucketName",
object_key="objectKey",
# the properties below are optional
object_version="objectVersion"
),
s3_output_uri="s3OutputUri"
),
outputs=outputs,
query_language=stepfunctions.QueryLanguage.JSON_PATH,
state_name="stateName",
task_timeout=timeout,
timeout=cdk.Duration.minutes(30),
trace_enabled=False
)
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import software.amazon.awscdk.*;
import software.amazon.awscdk.services.bedrock.*;
import software.amazon.awscdk.services.stepfunctions.*;
import software.amazon.awscdk.services.stepfunctions.tasks.*;
Object assign;
Guardrail guardrail;
IModel model;
Object outputs;
TaskInput taskInput;
TaskRole taskRole;
Timeout timeout;
BedrockInvokeModelJsonataProps bedrockInvokeModelJsonataProps = BedrockInvokeModelJsonataProps.builder()
.model(model)
// the properties below are optional
.accept("accept")
.assign(Map.of(
"assignKey", assign))
.body(taskInput)
.comment("comment")
.contentType("contentType")
.credentials(Credentials.builder()
.role(taskRole)
.build())
.guardrail(guardrail)
.heartbeat(Duration.minutes(30))
.heartbeatTimeout(timeout)
.input(BedrockInvokeModelInputProps.builder()
.s3InputUri("s3InputUri")
.s3Location(Location.builder()
.bucketName("bucketName")
.objectKey("objectKey")
// the properties below are optional
.objectVersion("objectVersion")
.build())
.build())
.integrationPattern(IntegrationPattern.REQUEST_RESPONSE)
.output(BedrockInvokeModelOutputProps.builder()
.s3Location(Location.builder()
.bucketName("bucketName")
.objectKey("objectKey")
// the properties below are optional
.objectVersion("objectVersion")
.build())
.s3OutputUri("s3OutputUri")
.build())
.outputs(outputs)
.queryLanguage(QueryLanguage.JSON_PATH)
.stateName("stateName")
.taskTimeout(timeout)
.timeout(Duration.minutes(30))
.traceEnabled(false)
.build();
// Install: dotnet add package Amazon.CDK.Lib
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
using Amazon.CDK;
using Amazon.CDK.AWS.Bedrock;
using Amazon.CDK.AWS.StepFunctions;
using Amazon.CDK.AWS.StepFunctions.Tasks;
var assign;
Guardrail guardrail;
IModel model;
var outputs;
TaskInput taskInput;
TaskRole taskRole;
Timeout timeout;
var bedrockInvokeModelJsonataProps = new BedrockInvokeModelJsonataProps {
Model = model,
// the properties below are optional
Accept = "accept",
Assign = new Dictionary<string, object> {
{ "assignKey", assign }
},
Body = taskInput,
Comment = "comment",
ContentType = "contentType",
Credentials = new Credentials {
Role = taskRole
},
Guardrail = guardrail,
Heartbeat = Duration.Minutes(30),
HeartbeatTimeout = timeout,
Input = new BedrockInvokeModelInputProps {
S3InputUri = "s3InputUri",
S3Location = new Location {
BucketName = "bucketName",
ObjectKey = "objectKey",
// the properties below are optional
ObjectVersion = "objectVersion"
}
},
IntegrationPattern = IntegrationPattern.REQUEST_RESPONSE,
Output = new BedrockInvokeModelOutputProps {
S3Location = new Location {
BucketName = "bucketName",
ObjectKey = "objectKey",
// the properties below are optional
ObjectVersion = "objectVersion"
},
S3OutputUri = "s3OutputUri"
},
Outputs = outputs,
QueryLanguage = QueryLanguage.JSON_PATH,
StateName = "stateName",
TaskTimeout = timeout,
Timeout = Duration.Minutes(30),
TraceEnabled = false
};
// Install: go get github.com/aws/aws-cdk-go/awscdk/v2
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import "github.com/aws/aws-cdk-go/awscdk"
import "github.com/aws/aws-cdk-go/awscdk"
import "github.com/aws/aws-cdk-go/awscdk"
import "github.com/aws/aws-cdk-go/awscdk"
var assign interface{}
var guardrail Guardrail
var model IModel
var outputs interface{}
var taskInput TaskInput
var taskRole TaskRole
var timeout Timeout
bedrockInvokeModelJsonataProps := &BedrockInvokeModelJsonataProps{
Model: model,
// the properties below are optional
Accept: jsii.String("accept"),
Assign: map[string]interface{}{
"assignKey": assign,
},
Body: taskInput,
Comment: jsii.String("comment"),
ContentType: jsii.String("contentType"),
Credentials: &Credentials{
Role: taskRole,
},
Guardrail: guardrail,
Heartbeat: cdk.Duration_Minutes(jsii.Number(30)),
HeartbeatTimeout: timeout,
Input: &BedrockInvokeModelInputProps{
S3InputUri: jsii.String("s3InputUri"),
S3Location: &Location{
BucketName: jsii.String("bucketName"),
ObjectKey: jsii.String("objectKey"),
// the properties below are optional
ObjectVersion: jsii.String("objectVersion"),
},
},
IntegrationPattern: awscdk.Aws_stepfunctions.IntegrationPattern_REQUEST_RESPONSE,
Output: &BedrockInvokeModelOutputProps{
S3Location: &Location{
BucketName: jsii.String("bucketName"),
ObjectKey: jsii.String("objectKey"),
// the properties below are optional
ObjectVersion: jsii.String("objectVersion"),
},
S3OutputUri: jsii.String("s3OutputUri"),
},
Outputs: outputs,
QueryLanguage: awscdk.*Aws_stepfunctions.QueryLanguage_JSON_PATH,
StateName: jsii.String("stateName"),
TaskTimeout: timeout,
Timeout: cdk.Duration_*Minutes(jsii.Number(30)),
TraceEnabled: jsii.Boolean(false),
}
Properties
acceptoptionalstringacceptoptionalstracceptoptionalStringAcceptoptionalstringAcceptoptional*string = 'application/json' #assignoptional{ [key: string]: any }assignoptionaltyping.Mapping[str, Any]assignoptionalMap<String, Object>AssignoptionalIDictionary<string, object>Assignoptional*map[string]interface{} #Default: Not assign variables
Using workflow variables, you can store data in a step and retrieve that data in future steps.
bodyoptionalTaskInputbodyoptionalTaskInputbodyoptionalTaskInputBodyoptionalTaskInputBodyoptionalTaskInput #Default: Input data is retrieved from the location specified in the input field
notes
The inference parameters contained in the body depend on the Bedrock model being used.
The body must be in the format specified in the contentType field. For example, if the content type is application/json, the body must be JSON formatted.
The body must be up to 256 KB in size. For input data that exceeds 256 KB, use input instead to retrieve the input data from S3.
You must specify either the body or the input field, but not both.
commentoptionalstringcommentoptionalstrcommentoptionalStringCommentoptionalstringCommentoptional*string #Default: No comment
contentTypeoptionalstringcontent_typeoptionalstrcontentTypeoptionalStringContentTypeoptionalstringContentTypeoptional*string = 'application/json' deprecated #credentialsoptionalCredentialscredentialsoptionalCredentialscredentialsoptionalCredentialsCredentialsoptionalCredentialsCredentialsoptionalCredentials #Default: None (Task is executed using the State Machine's execution role)
This enables cross-account resource invocations.
guardrailoptionalGuardrailguardrailoptionalGuardrailguardrailoptionalGuardrailGuardrailoptionalGuardrailGuardrailoptionalGuardrail #Default: No guardrail is applied to the invocation.
heartbeatoptionalDurationheartbeatoptionalDurationheartbeatoptionalDurationHeartbeatoptionalDurationHeartbeatoptionalDuration = None deprecated #heartbeatTimeoutoptionalTimeoutheartbeat_timeoutoptionalTimeoutheartbeatTimeoutoptionalTimeoutHeartbeatTimeoutoptionalTimeoutHeartbeatTimeoutoptionalTimeout = None #[disable-awslint:duration-prop-type] is needed because all props interface in aws-stepfunctions-tasks extend this interface
inputoptionalBedrockInvokeModelInputPropsinputoptionalBedrockInvokeModelInputPropsinputoptionalBedrockInvokeModelInputPropsInputoptionalBedrockInvokeModelInputPropsInputoptionalBedrockInvokeModelInputProps #Default: Input data is retrieved from the body field
integrationPatternoptionalIntegrationPatternintegration_patternoptionalIntegrationPatternintegrationPatternoptionalIntegrationPatternIntegrationPatternoptionalIntegrationPatternIntegrationPatternoptionalIntegrationPattern #Default: IntegrationPattern.REQUEST_RESPONSE for most tasks. IntegrationPattern.RUN_JOB for the following exceptions: BatchSubmitJob, EmrAddStep, EmrCreateCluster, EmrTerminationCluster, and EmrContainersStartJobRun.
You can control these AWS services using service integration patterns.
Depending on the AWS Service, the Service Integration Pattern availability will vary.
outputoptionalBedrockInvokeModelOutputPropsoutputoptionalBedrockInvokeModelOutputPropsoutputoptionalBedrockInvokeModelOutputPropsOutputoptionalBedrockInvokeModelOutputPropsOutputoptionalBedrockInvokeModelOutputProps #Default: The API response body is returned in the result.
If you specify this field, the API response body is replaced with a reference to the output location.
outputsoptionalanyoutputsoptionalAnyoutputsoptionalObjectOutputsoptionalobjectOutputsoptionalinterface{} #Default: $states.result or $states.errorOutput
notes
When specified, the value overrides the state output default. The output field accepts any JSON value (object, array, string, number, boolean, null). Any string value, including those inside objects or arrays, will be evaluated as JSONata if surrounded by {% %} characters. Output also accepts a JSONata expression directly.
queryLanguageoptionalQueryLanguagequery_languageoptionalQueryLanguagequeryLanguageoptionalQueryLanguageQueryLanguageoptionalQueryLanguageQueryLanguageoptionalQueryLanguage = JSONPath #If the state does not contain a queryLanguage field, then it will use the query language specified in the top-level queryLanguage field.
stateNameoptionalstringstate_nameoptionalstrstateNameoptionalStringStateNameoptionalstringStateNameoptional*string #Default: The construct ID will be used as state name
taskTimeoutoptionalTimeouttask_timeoutoptionalTimeouttaskTimeoutoptionalTimeoutTaskTimeoutoptionalTimeoutTaskTimeoutoptionalTimeout = None #[disable-awslint:duration-prop-type] is needed because all props interface in aws-stepfunctions-tasks extend this interface
timeoutoptionalDurationtimeoutoptionalDurationtimeoutoptionalDurationTimeoutoptionalDurationTimeoutoptionalDuration = None deprecated #traceEnabledoptionalbooleantrace_enabledoptionalbooltraceEnabledoptionalBooleanTraceEnabledoptionalboolTraceEnabledoptional*bool #Default: Trace is not enabled for the invocation.