Class: AWSCDK::StepFunctionsTasks::BedrockInvokeModelProps

Inherits:
AWSCDK::StepFunctions::TaskStateBaseProps
  • Object
show all
Defined in:
step_functions_tasks/bedrock_invoke_model_props.rb

Overview

Properties for invoking a Bedrock Model.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(comment: nil, query_language: nil, state_name: nil, credentials: nil, heartbeat: nil, heartbeat_timeout: nil, integration_pattern: nil, task_timeout: nil, timeout: nil, assign: nil, input_path: nil, output_path: nil, outputs: nil, result_path: nil, result_selector: nil, model:, accept: nil, body: nil, content_type: nil, guardrail: nil, input: nil, output: nil, trace_enabled: nil) ⇒ BedrockInvokeModelProps

Returns a new instance of BedrockInvokeModelProps.

Parameters:

  • comment (String, nil) (defaults to: nil)

    A comment describing this state.

  • query_language (AWSCDK::StepFunctions::QueryLanguage, nil) (defaults to: nil)

    The name of the query language used by the state.

  • state_name (String, nil) (defaults to: nil)

    Optional name for this state.

  • credentials (AWSCDK::StepFunctions::Credentials, nil) (defaults to: nil)

    Credentials for an IAM Role that the State Machine assumes for executing the task.

  • heartbeat (AWSCDK::Duration, nil) (defaults to: nil)

    Timeout for the heartbeat.

  • heartbeat_timeout (AWSCDK::StepFunctions::Timeout, nil) (defaults to: nil)

    Timeout for the heartbeat.

  • integration_pattern (AWSCDK::StepFunctions::IntegrationPattern, nil) (defaults to: nil)

    AWS Step Functions integrates with services directly in the Amazon States Language.

  • task_timeout (AWSCDK::StepFunctions::Timeout, nil) (defaults to: nil)

    Timeout for the task.

  • timeout (AWSCDK::Duration, nil) (defaults to: nil)

    Timeout for the task.

  • assign (Hash{String => Object}, nil) (defaults to: nil)

    Workflow variables to store in this step.

  • input_path (String, nil) (defaults to: nil)

    JSONPath expression to select part of the state to be the input to this state.

  • output_path (String, nil) (defaults to: nil)

    JSONPath expression to select part of the state to be the output to this state.

  • outputs (Object, nil) (defaults to: nil)

    Used to specify and transform output from the state.

  • result_path (String, nil) (defaults to: nil)

    JSONPath expression to indicate where to inject the state's output.

  • result_selector (Hash{String => Object}, nil) (defaults to: nil)

    The JSON that will replace the state's raw result and become the effective result before ResultPath is applied.

  • model (AWSCDK::Bedrock::IModel)

    The Bedrock model that the task will invoke.

  • accept (String, nil) (defaults to: nil)

    The desired MIME type of the inference body in the response.

  • body (AWSCDK::StepFunctions::TaskInput, nil) (defaults to: nil)

    The input data for the Bedrock model invocation.

  • content_type (String, nil) (defaults to: nil)

    The MIME type of the input data in the request.

  • guardrail (AWSCDK::StepFunctionsTasks::Guardrail, nil) (defaults to: nil)

    The guardrail is applied to the invocation.

  • input (AWSCDK::StepFunctionsTasks::BedrockInvokeModelInputProps, nil) (defaults to: nil)

    The source location to retrieve the input data from.

  • output (AWSCDK::StepFunctionsTasks::BedrockInvokeModelOutputProps, nil) (defaults to: nil)

    The destination location where the API response is written.

  • trace_enabled (Boolean, nil) (defaults to: nil)

    Specifies whether to enable or disable the Bedrock trace.



30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
# File 'step_functions_tasks/bedrock_invoke_model_props.rb', line 30

def initialize(comment: nil, query_language: nil, state_name: nil, credentials: nil, heartbeat: nil, heartbeat_timeout: nil, integration_pattern: nil, task_timeout: nil, timeout: nil, assign: nil, input_path: nil, output_path: nil, outputs: nil, result_path: nil, result_selector: nil, model:, accept: nil, body: nil, content_type: nil, guardrail: nil, input: nil, output: nil, trace_enabled: nil)
  @comment = comment
  Jsii::Type.check_type(@comment, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "comment") unless @comment.nil?
  @query_language = query_language
  Jsii::Type.check_type(@query_language, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3Nfc3RlcGZ1bmN0aW9ucy5RdWVyeUxhbmd1YWdlIn0=")), "queryLanguage") unless @query_language.nil?
  @state_name = state_name
  Jsii::Type.check_type(@state_name, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "stateName") unless @state_name.nil?
  @credentials = credentials.is_a?(Hash) ? ::AWSCDK::StepFunctions::Credentials.new(**credentials.transform_keys(&:to_sym)) : credentials
  Jsii::Type.check_type(@credentials, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3Nfc3RlcGZ1bmN0aW9ucy5DcmVkZW50aWFscyJ9")), "credentials") unless @credentials.nil?
  @heartbeat = heartbeat
  Jsii::Type.check_type(@heartbeat, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5EdXJhdGlvbiJ9")), "heartbeat") unless @heartbeat.nil?
  @heartbeat_timeout = heartbeat_timeout
  Jsii::Type.check_type(@heartbeat_timeout, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3Nfc3RlcGZ1bmN0aW9ucy5UaW1lb3V0In0=")), "heartbeatTimeout") unless @heartbeat_timeout.nil?
  @integration_pattern = integration_pattern
  Jsii::Type.check_type(@integration_pattern, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3Nfc3RlcGZ1bmN0aW9ucy5JbnRlZ3JhdGlvblBhdHRlcm4ifQ==")), "integrationPattern") unless @integration_pattern.nil?
  @task_timeout = task_timeout
  Jsii::Type.check_type(@task_timeout, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3Nfc3RlcGZ1bmN0aW9ucy5UaW1lb3V0In0=")), "taskTimeout") unless @task_timeout.nil?
  @timeout = timeout
  Jsii::Type.check_type(@timeout, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5EdXJhdGlvbiJ9")), "timeout") unless @timeout.nil?
  @assign = assign
  Jsii::Type.check_type(@assign, JSON.parse(Base64.strict_decode64("eyJjb2xsZWN0aW9uIjp7ImVsZW1lbnR0eXBlIjp7InByaW1pdGl2ZSI6ImFueSJ9LCJraW5kIjoibWFwIn19")), "assign") unless @assign.nil?
  @input_path = input_path
  Jsii::Type.check_type(@input_path, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "inputPath") unless @input_path.nil?
  @output_path = output_path
  Jsii::Type.check_type(@output_path, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "outputPath") unless @output_path.nil?
  @outputs = outputs
  Jsii::Type.check_type(@outputs, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJhbnkifQ==")), "outputs") unless @outputs.nil?
  @result_path = result_path
  Jsii::Type.check_type(@result_path, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "resultPath") unless @result_path.nil?
  @result_selector = result_selector
  Jsii::Type.check_type(@result_selector, JSON.parse(Base64.strict_decode64("eyJjb2xsZWN0aW9uIjp7ImVsZW1lbnR0eXBlIjp7InByaW1pdGl2ZSI6ImFueSJ9LCJraW5kIjoibWFwIn19")), "resultSelector") unless @result_selector.nil?
  @model = model
  Jsii::Type.check_type(@model, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfYmVkcm9jay5JTW9kZWwifQ==")), "model")
  @accept = accept
  Jsii::Type.check_type(@accept, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "accept") unless @accept.nil?
  @body = body
  Jsii::Type.check_type(@body, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3Nfc3RlcGZ1bmN0aW9ucy5UYXNrSW5wdXQifQ==")), "body") unless @body.nil?
  @content_type = content_type
  Jsii::Type.check_type(@content_type, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "contentType") unless @content_type.nil?
  @guardrail = guardrail
  Jsii::Type.check_type(@guardrail, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3Nfc3RlcGZ1bmN0aW9uc190YXNrcy5HdWFyZHJhaWwifQ==")), "guardrail") unless @guardrail.nil?
  @input = input.is_a?(Hash) ? ::AWSCDK::StepFunctionsTasks::BedrockInvokeModelInputProps.new(**input.transform_keys(&:to_sym)) : input
  Jsii::Type.check_type(@input, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3Nfc3RlcGZ1bmN0aW9uc190YXNrcy5CZWRyb2NrSW52b2tlTW9kZWxJbnB1dFByb3BzIn0=")), "input") unless @input.nil?
  @output = output.is_a?(Hash) ? ::AWSCDK::StepFunctionsTasks::BedrockInvokeModelOutputProps.new(**output.transform_keys(&:to_sym)) : output
  Jsii::Type.check_type(@output, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3Nfc3RlcGZ1bmN0aW9uc190YXNrcy5CZWRyb2NrSW52b2tlTW9kZWxPdXRwdXRQcm9wcyJ9")), "output") unless @output.nil?
  @trace_enabled = trace_enabled
  Jsii::Type.check_type(@trace_enabled, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJib29sZWFuIn0=")), "traceEnabled") unless @trace_enabled.nil?
end

Instance Attribute Details

#acceptString? (readonly)

Note:

Default: 'application/json'

The desired MIME type of the inference body in the response.



206
207
208
# File 'step_functions_tasks/bedrock_invoke_model_props.rb', line 206

def accept
  @accept
end

#assignHash{String => Object}? (readonly)

Note:

Default: - Not assign variables

Workflow variables to store in this step.

Using workflow variables, you can store data in a step and retrieve that data in future steps.

Returns:

  • (Hash{String => Object}, nil)

See Also:



150
151
152
# File 'step_functions_tasks/bedrock_invoke_model_props.rb', line 150

def assign
  @assign
end

#bodyAWSCDK::StepFunctions::TaskInput? (readonly)

Note:

Default: - Input data is retrieved from the location specified in the input field

The input data for the Bedrock model invocation.

The inference parameters contained in the body depend on the Bedrock model being used.

The body must be in the format specified in the content_type 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.



223
224
225
# File 'step_functions_tasks/bedrock_invoke_model_props.rb', line 223

def body
  @body
end

#commentString? (readonly)

Note:

Default: No comment

A comment describing this state.

Returns:

  • (String, nil)


83
84
85
# File 'step_functions_tasks/bedrock_invoke_model_props.rb', line 83

def comment
  @comment
end

#content_typeString? (readonly)

Deprecated.

This property does not require configuration because the only acceptable value is 'application/json'.

Note:

Default: 'application/json'

The MIME type of the input data in the request.



230
231
232
# File 'step_functions_tasks/bedrock_invoke_model_props.rb', line 230

def content_type
  @content_type
end

#credentialsAWSCDK::StepFunctions::Credentials? (readonly)

Note:

Default: - None (Task is executed using the State Machine's execution role)

Credentials for an IAM Role that the State Machine assumes for executing the task.

This enables cross-account resource invocations.



104
105
106
# File 'step_functions_tasks/bedrock_invoke_model_props.rb', line 104

def credentials
  @credentials
end

#guardrailAWSCDK::StepFunctionsTasks::Guardrail? (readonly)

Note:

Default: - No guardrail is applied to the invocation.

The guardrail is applied to the invocation.



235
236
237
# File 'step_functions_tasks/bedrock_invoke_model_props.rb', line 235

def guardrail
  @guardrail
end

#heartbeatAWSCDK::Duration? (readonly)

Deprecated.

use heartbeatTimeout

Note:

Default: - None

Timeout for the heartbeat.

Returns:



110
111
112
# File 'step_functions_tasks/bedrock_invoke_model_props.rb', line 110

def heartbeat
  @heartbeat
end

#heartbeat_timeoutAWSCDK::StepFunctions::Timeout? (readonly)

Note:

Default: - None

Timeout for the heartbeat.

[disable-awslint:duration-prop-type] is needed because all props interface in aws-stepfunctions-tasks extend this interface



118
119
120
# File 'step_functions_tasks/bedrock_invoke_model_props.rb', line 118

def heartbeat_timeout
  @heartbeat_timeout
end

#inputAWSCDK::StepFunctionsTasks::BedrockInvokeModelInputProps? (readonly)

Note:

Default: - Input data is retrieved from the body field

The source location to retrieve the input data from.



240
241
242
# File 'step_functions_tasks/bedrock_invoke_model_props.rb', line 240

def input
  @input
end

#input_pathString? (readonly)

Note:

Default: $

JSONPath expression to select part of the state to be the input to this state.

May also be the special value JsonPath.DISCARD, which will cause the effective input to be the empty object {}.

Returns:

  • (String, nil)


158
159
160
# File 'step_functions_tasks/bedrock_invoke_model_props.rb', line 158

def input_path
  @input_path
end

#integration_patternAWSCDK::StepFunctions::IntegrationPattern? (readonly)

Note:

Default: - IntegrationPattern.REQUEST_RESPONSE for most tasks. IntegrationPattern.RUN_JOB for the following exceptions: BatchSubmitJob, EmrAddStep, EmrCreateCluster, EmrTerminationCluster, and EmrContainersStartJobRun.

AWS Step Functions integrates with services directly in the Amazon States Language.

You can control these AWS services using service integration patterns.

Depending on the AWS Service, the Service Integration Pattern availability will vary.



128
129
130
# File 'step_functions_tasks/bedrock_invoke_model_props.rb', line 128

def integration_pattern
  @integration_pattern
end

#modelAWSCDK::Bedrock::IModel (readonly)

The Bedrock model that the task will invoke.



200
201
202
# File 'step_functions_tasks/bedrock_invoke_model_props.rb', line 200

def model
  @model
end

#outputAWSCDK::StepFunctionsTasks::BedrockInvokeModelOutputProps? (readonly)

Note:

Default: - The API response body is returned in the result.

The destination location where the API response is written.

If you specify this field, the API response body is replaced with a reference to the output location.



248
249
250
# File 'step_functions_tasks/bedrock_invoke_model_props.rb', line 248

def output
  @output
end

#output_pathString? (readonly)

Note:

Default: $

JSONPath expression to select part of the state to be the output to this state.

May also be the special value JsonPath.DISCARD, which will cause the effective output to be the empty object {}.

Returns:

  • (String, nil)


166
167
168
# File 'step_functions_tasks/bedrock_invoke_model_props.rb', line 166

def output_path
  @output_path
end

#outputsObject? (readonly)

Note:

Default: - $states.result or $states.errorOutput

Used to specify and transform output from the state.

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.



178
179
180
# File 'step_functions_tasks/bedrock_invoke_model_props.rb', line 178

def outputs
  @outputs
end

#query_languageAWSCDK::StepFunctions::QueryLanguage? (readonly)

Note:

Default: - JSONPath

The name of the query language used by the state.

If the state does not contain a query_language field, then it will use the query language specified in the top-level query_language field.



91
92
93
# File 'step_functions_tasks/bedrock_invoke_model_props.rb', line 91

def query_language
  @query_language
end

#result_pathString? (readonly)

Note:

Default: $

JSONPath expression to indicate where to inject the state's output.

May also be the special value JsonPath.DISCARD, which will cause the state's input to become its output.

Returns:

  • (String, nil)


186
187
188
# File 'step_functions_tasks/bedrock_invoke_model_props.rb', line 186

def result_path
  @result_path
end

#result_selectorHash{String => Object}? (readonly)

Note:

Default: - None

The JSON that will replace the state's raw result and become the effective result before ResultPath is applied.

You can use ResultSelector to create a payload with values that are static or selected from the state's raw result.



195
196
197
# File 'step_functions_tasks/bedrock_invoke_model_props.rb', line 195

def result_selector
  @result_selector
end

#state_nameString? (readonly)

Note:

Default: - The construct ID will be used as state name

Optional name for this state.

Returns:

  • (String, nil)


96
97
98
# File 'step_functions_tasks/bedrock_invoke_model_props.rb', line 96

def state_name
  @state_name
end

#task_timeoutAWSCDK::StepFunctions::Timeout? (readonly)

Note:

Default: - None

Timeout for the task.

[disable-awslint:duration-prop-type] is needed because all props interface in aws-stepfunctions-tasks extend this interface



136
137
138
# File 'step_functions_tasks/bedrock_invoke_model_props.rb', line 136

def task_timeout
  @task_timeout
end

#timeoutAWSCDK::Duration? (readonly)

Deprecated.

use taskTimeout

Note:

Default: - None

Timeout for the task.

Returns:



142
143
144
# File 'step_functions_tasks/bedrock_invoke_model_props.rb', line 142

def timeout
  @timeout
end

#trace_enabledBoolean? (readonly)

Note:

Default: - Trace is not enabled for the invocation.

Specifies whether to enable or disable the Bedrock trace.

Returns:

  • (Boolean, nil)


253
254
255
# File 'step_functions_tasks/bedrock_invoke_model_props.rb', line 253

def trace_enabled
  @trace_enabled
end

Class Method Details

.jsii_propertiesObject



255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
# File 'step_functions_tasks/bedrock_invoke_model_props.rb', line 255

def self.jsii_properties
  {
    :comment => "comment",
    :query_language => "queryLanguage",
    :state_name => "stateName",
    :credentials => "credentials",
    :heartbeat => "heartbeat",
    :heartbeat_timeout => "heartbeatTimeout",
    :integration_pattern => "integrationPattern",
    :task_timeout => "taskTimeout",
    :timeout => "timeout",
    :assign => "assign",
    :input_path => "inputPath",
    :output_path => "outputPath",
    :outputs => "outputs",
    :result_path => "resultPath",
    :result_selector => "resultSelector",
    :model => "model",
    :accept => "accept",
    :body => "body",
    :content_type => "contentType",
    :guardrail => "guardrail",
    :input => "input",
    :output => "output",
    :trace_enabled => "traceEnabled",
  }
end

Instance Method Details

#to_jsiiObject



283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
# File 'step_functions_tasks/bedrock_invoke_model_props.rb', line 283

def to_jsii
  result = {}
  result.merge!(super)
  result.merge!({
    "comment" => @comment,
    "queryLanguage" => @query_language,
    "stateName" => @state_name,
    "credentials" => @credentials,
    "heartbeat" => @heartbeat,
    "heartbeatTimeout" => @heartbeat_timeout,
    "integrationPattern" => @integration_pattern,
    "taskTimeout" => @task_timeout,
    "timeout" => @timeout,
    "assign" => @assign,
    "inputPath" => @input_path,
    "outputPath" => @output_path,
    "outputs" => @outputs,
    "resultPath" => @result_path,
    "resultSelector" => @result_selector,
    "model" => @model,
    "accept" => @accept,
    "body" => @body,
    "contentType" => @content_type,
    "guardrail" => @guardrail,
    "input" => @input,
    "output" => @output,
    "traceEnabled" => @trace_enabled,
  })
  result.compact
end