BedrockInvokeModelJsonPathProps 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 resultSelector: any;
declare const taskInput: stepfunctions.TaskInput;
declare const taskRole: stepfunctions.TaskRole;
declare const timeout: stepfunctions.Timeout;
const bedrockInvokeModelJsonPathProps: stepfunctions_tasks.BedrockInvokeModelJsonPathProps = {
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',
},
},
inputPath: 'inputPath',
integrationPattern: stepfunctions.IntegrationPattern.REQUEST_RESPONSE,
output: {
s3Location: {
bucketName: 'bucketName',
objectKey: 'objectKey',
// the properties below are optional
objectVersion: 'objectVersion',
},
s3OutputUri: 's3OutputUri',
},
outputPath: 'outputPath',
queryLanguage: stepfunctions.QueryLanguage.JSON_PATH,
resultPath: 'resultPath',
resultSelector: {
resultSelectorKey: resultSelector,
},
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
# result_selector: Any
# task_input: stepfunctions.TaskInput
# task_role: stepfunctions.TaskRole
# timeout: stepfunctions.Timeout
bedrock_invoke_model_json_path_props = stepfunctions_tasks.BedrockInvokeModelJsonPathProps(
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"
)
),
input_path="inputPath",
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"
),
output_path="outputPath",
query_language=stepfunctions.QueryLanguage.JSON_PATH,
result_path="resultPath",
result_selector={
"result_selector_key": result_selector
},
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 resultSelector;
TaskInput taskInput;
TaskRole taskRole;
Timeout timeout;
BedrockInvokeModelJsonPathProps bedrockInvokeModelJsonPathProps = BedrockInvokeModelJsonPathProps.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())
.inputPath("inputPath")
.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())
.outputPath("outputPath")
.queryLanguage(QueryLanguage.JSON_PATH)
.resultPath("resultPath")
.resultSelector(Map.of(
"resultSelectorKey", resultSelector))
.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 resultSelector;
TaskInput taskInput;
TaskRole taskRole;
Timeout timeout;
var bedrockInvokeModelJsonPathProps = new BedrockInvokeModelJsonPathProps {
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"
}
},
InputPath = "inputPath",
IntegrationPattern = IntegrationPattern.REQUEST_RESPONSE,
Output = new BedrockInvokeModelOutputProps {
S3Location = new Location {
BucketName = "bucketName",
ObjectKey = "objectKey",
// the properties below are optional
ObjectVersion = "objectVersion"
},
S3OutputUri = "s3OutputUri"
},
OutputPath = "outputPath",
QueryLanguage = QueryLanguage.JSON_PATH,
ResultPath = "resultPath",
ResultSelector = new Dictionary<string, object> {
{ "resultSelectorKey", resultSelector }
},
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 resultSelector interface{}
var taskInput TaskInput
var taskRole TaskRole
var timeout Timeout
bedrockInvokeModelJsonPathProps := &BedrockInvokeModelJsonPathProps{
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"),
},
},
InputPath: jsii.String("inputPath"),
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"),
},
OutputPath: jsii.String("outputPath"),
QueryLanguage: awscdk.*Aws_stepfunctions.QueryLanguage_JSON_PATH,
ResultPath: jsii.String("resultPath"),
ResultSelector: map[string]interface{}{
"resultSelectorKey": resultSelector,
},
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
inputPathoptionalstringinput_pathoptionalstrinputPathoptionalStringInputPathoptionalstringInputPathoptional*string = $ #May also be the special value JsonPath.DISCARD, which will cause the effective input to be the empty object {}.
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.
outputPathoptionalstringoutput_pathoptionalstroutputPathoptionalStringOutputPathoptionalstringOutputPathoptional*string = $ #May also be the special value JsonPath.DISCARD, which will cause the effective output to be the empty object {}.
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.
resultPathoptionalstringresult_pathoptionalstrresultPathoptionalStringResultPathoptionalstringResultPathoptional*string = $ #May also be the special value JsonPath.DISCARD, which will cause the state's input to become its output.
resultSelectoroptional{ [key: string]: any }result_selectoroptionaltyping.Mapping[str, Any]resultSelectoroptionalMap<String, Object>ResultSelectoroptionalIDictionary<string, object>ResultSelectoroptional*map[string]interface{} = None #You can use ResultSelector to create a payload with values that are static or selected from the state's raw result.
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.