Skip to content
v2.277.0

BedrockInvokeModelInputProps Struct ​

Location to retrieve the input data, prior to calling Bedrock InvokeModel.

Example ​

ts

import * as bedrock from 'aws-cdk-lib/aws-bedrock';

const model = bedrock.FoundationModel.fromFoundationModelId(
  this,
  'Model',
  bedrock.FoundationModelIdentifier.AMAZON_TITAN_TEXT_G1_EXPRESS_V1,
);

const task = new tasks.BedrockInvokeModel(this, 'Prompt Model', {
  model,
  input : { s3InputUri: sfn.JsonPath.stringAt('$.prompt') },
  output: { s3OutputUri: sfn.JsonPath.stringAt('$.prompt') },
});
python
import aws_cdk.aws_bedrock as bedrock


model = bedrock.FoundationModel.from_foundation_model_id(self, "Model", bedrock.FoundationModelIdentifier.AMAZON_TITAN_TEXT_G1_EXPRESS_V1)

task = tasks.BedrockInvokeModel(self, "Prompt Model",
    model=model,
    input=tasks.BedrockInvokeModelInputProps(s3_input_uri=sfn.JsonPath.string_at("$.prompt")),
    output=tasks.BedrockInvokeModelOutputProps(s3_output_uri=sfn.JsonPath.string_at("$.prompt"))
)
java
import software.amazon.awscdk.services.bedrock.*;


FoundationModel model = FoundationModel.fromFoundationModelId(this, "Model", FoundationModelIdentifier.AMAZON_TITAN_TEXT_G1_EXPRESS_V1);

BedrockInvokeModel task = BedrockInvokeModel.Builder.create(this, "Prompt Model")
        .model(model)
        .input(BedrockInvokeModelInputProps.builder().s3InputUri(JsonPath.stringAt("$.prompt")).build())
        .output(BedrockInvokeModelOutputProps.builder().s3OutputUri(JsonPath.stringAt("$.prompt")).build())
        .build();
csharp
// Install: dotnet add package Amazon.CDK.Lib
using Amazon.CDK.AWS.Bedrock;


var model = FoundationModel.FromFoundationModelId(this, "Model", FoundationModelIdentifier.AMAZON_TITAN_TEXT_G1_EXPRESS_V1);

var task = new BedrockInvokeModel(this, "Prompt Model", new BedrockInvokeModelProps {
    Model = model,
    Input = new BedrockInvokeModelInputProps { S3InputUri = JsonPath.StringAt("$.prompt") },
    Output = new BedrockInvokeModelOutputProps { S3OutputUri = JsonPath.StringAt("$.prompt") }
});
go
// Install: go get github.com/aws/aws-cdk-go/awscdk/v2
import "github.com/aws/aws-cdk-go/awscdk"


model := bedrock.FoundationModel_FromFoundationModelId(this, jsii.String("Model"), bedrock.FoundationModelIdentifier_AMAZON_TITAN_TEXT_G1_EXPRESS_V1())

task := tasks.NewBedrockInvokeModel(this, jsii.String("Prompt Model"), &BedrockInvokeModelProps{
	Model: Model,
	Input: &BedrockInvokeModelInputProps{
		S3InputUri: sfn.JsonPath_StringAt(jsii.String("$.prompt")),
	},
	Output: &BedrockInvokeModelOutputProps{
		S3OutputUri: sfn.JsonPath_*StringAt(jsii.String("$.prompt")),
	},
})

Properties ​

s3InputUrioptionalstrings3_input_urioptionalstrs3InputUrioptionalStringS3InputUrioptionalstringS3InputUrioptional*string#
The source location where the API response is written.

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

This field can be used to specify s3 URI in the form of token

s3LocationoptionalLocations3_locationoptionalLocations3LocationoptionalLocationS3LocationoptionalLocationS3LocationoptionalLocation#
S3 object to retrieve the input data from.

Default: Input data is retrieved from the body field

If the S3 location is not set, then the Body must be set.