AgentPrompt class

Resource for managing an AWS Bedrock Agents Prompt.

Example Usage

Basic Usage

import * as pulumi from "@pulumi/pulumi";
import * as aws from "@pulumi/aws";

const example = new aws.bedrock.AgentPrompt("example", {
    name: "MyPrompt",
    description: "My prompt description.",
});
import pulumi
import pulumi_aws as aws

example = aws.bedrock.AgentPrompt("example",
    name="MyPrompt",
    description="My prompt description.")
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Aws = Pulumi.Aws;

return await Deployment.RunAsync(() =>
{
    var example = new Aws.Bedrock.AgentPrompt("example", new()
    {
        Name = "MyPrompt",
        Description = "My prompt description.",
    });

});
package main

import (
	"github.com/pulumi/pulumi-aws/sdk/v7/go/aws/bedrock"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		_, err := bedrock.NewAgentPrompt(ctx, "example", &bedrock.AgentPromptArgs{
			Name:        pulumi.String("MyPrompt"),
			Description: pulumi.String("My prompt description."),
		})
		if err != nil {
			return err
		}
		return nil
	})
}
pulumi {
  required_providers {
    aws = {
      source = "pulumi/aws"
    }
  }
}

resource "aws_bedrock_agentprompt" "example" {
  name        = "MyPrompt"
  description = "My prompt description."
}
package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.aws.bedrock.AgentPrompt;
import com.pulumi.aws.bedrock.AgentPromptArgs;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Map;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;

public class App {
    public static void main(String[] args) {
        Pulumi.run(App::stack);
    }

    public static void stack(Context ctx) {
        var example = new AgentPrompt("example", AgentPromptArgs.builder()
            .name("MyPrompt")
            .description("My prompt description.")
            .build());

    }
}
resources:
  example:
    type: aws:bedrock:AgentPrompt
    properties:
      name: MyPrompt
      description: My prompt description.

With Variants

import * as pulumi from "@pulumi/pulumi";
import * as aws from "@pulumi/aws";

const example = new aws.bedrock.AgentPrompt("example", {
    variants: [{
        inferenceConfiguration: {
            text: {
                temperature: 0.8,
            },
        },
        templateConfiguration: {
            text: {
                inputVariables: [
                    {
                        name: "genre",
                    },
                    {
                        name: "number",
                    },
                ],
                text: "Make me a {{genre}} playlist consisting of the following number of songs: {{number}}.",
            },
        },
        name: "Variant1",
        modelId: "amazon.titan-text-express-v1",
        templateType: "TEXT",
    }],
    name: "MakePlaylist",
    description: "My first prompt.",
    defaultVariant: "Variant1",
});
import pulumi
import pulumi_aws as aws

example = aws.bedrock.AgentPrompt("example",
    variants=[{
        "inference_configuration": {
            "text": {
                "temperature": 0.8,
            },
        },
        "template_configuration": {
            "text": {
                "input_variables": [
                    {
                        "name": "genre",
                    },
                    {
                        "name": "number",
                    },
                ],
                "text": "Make me a {{genre}} playlist consisting of the following number of songs: {{number}}.",
            },
        },
        "name": "Variant1",
        "model_id": "amazon.titan-text-express-v1",
        "template_type": "TEXT",
    }],
    name="MakePlaylist",
    description="My first prompt.",
    default_variant="Variant1")
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Aws = Pulumi.Aws;

return await Deployment.RunAsync(() =>
{
    var example = new Aws.Bedrock.AgentPrompt("example", new()
    {
        Variants = new[]
        {
            new Aws.Bedrock.Inputs.AgentPromptVariantArgs
            {
                InferenceConfiguration = new Aws.Bedrock.Inputs.AgentPromptVariantInferenceConfigurationArgs
                {
                    Text = new Aws.Bedrock.Inputs.AgentPromptVariantInferenceConfigurationTextArgs
                    {
                        Temperature = 0.8,
                    },
                },
                TemplateConfiguration = new Aws.Bedrock.Inputs.AgentPromptVariantTemplateConfigurationArgs
                {
                    Text = new Aws.Bedrock.Inputs.AgentPromptVariantTemplateConfigurationTextArgs
                    {
                        InputVariables = new[]
                        {
                            new Aws.Bedrock.Inputs.AgentPromptVariantTemplateConfigurationTextInputVariableArgs
                            {
                                Name = "genre",
                            },
                            new Aws.Bedrock.Inputs.AgentPromptVariantTemplateConfigurationTextInputVariableArgs
                            {
                                Name = "number",
                            },
                        },
                        Text = "Make me a {{genre}} playlist consisting of the following number of songs: {{number}}.",
                    },
                },
                Name = "Variant1",
                ModelId = "amazon.titan-text-express-v1",
                TemplateType = "TEXT",
            },
        },
        Name = "MakePlaylist",
        Description = "My first prompt.",
        DefaultVariant = "Variant1",
    });

});
package main

import (
	"github.com/pulumi/pulumi-aws/sdk/v7/go/aws/bedrock"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		_, err := bedrock.NewAgentPrompt(ctx, "example", &bedrock.AgentPromptArgs{
			Variants: bedrock.AgentPromptVariantArray{
				&bedrock.AgentPromptVariantArgs{
					InferenceConfiguration: &bedrock.AgentPromptVariantInferenceConfigurationArgs{
						Text: &bedrock.AgentPromptVariantInferenceConfigurationTextArgs{
							Temperature: pulumi.Float64(0.8),
						},
					},
					TemplateConfiguration: &bedrock.AgentPromptVariantTemplateConfigurationArgs{
						Text: &bedrock.AgentPromptVariantTemplateConfigurationTextArgs{
							InputVariables: bedrock.AgentPromptVariantTemplateConfigurationTextInputVariableArray{
								&bedrock.AgentPromptVariantTemplateConfigurationTextInputVariableArgs{
									Name: pulumi.String("genre"),
								},
								&bedrock.AgentPromptVariantTemplateConfigurationTextInputVariableArgs{
									Name: pulumi.String("number"),
								},
							},
							Text: pulumi.String("Make me a {{genre}} playlist consisting of the following number of songs: {{number}}."),
						},
					},
					Name:         pulumi.String("Variant1"),
					ModelId:      pulumi.String("amazon.titan-text-express-v1"),
					TemplateType: pulumi.String("TEXT"),
				},
			},
			Name:           pulumi.String("MakePlaylist"),
			Description:    pulumi.String("My first prompt."),
			DefaultVariant: pulumi.String("Variant1"),
		})
		if err != nil {
			return err
		}
		return nil
	})
}
pulumi {
  required_providers {
    aws = {
      source = "pulumi/aws"
    }
  }
}

resource "aws_bedrock_agentprompt" "example" {
  variants {
    inference_configuration = {
      text = {
        temperature = 0.8
      }
    }
    template_configuration = {
      text = {
        input_variables = [{
          "name" = "genre"
          }, {
          "name" = "number"
        }]
        text = "Make me a {{genre}} playlist consisting of the following number of songs: {{number}}."
      }
    }
    name          = "Variant1"
    model_id      = "amazon.titan-text-express-v1"
    template_type = "TEXT"
  }
  name            = "MakePlaylist"
  description     = "My first prompt."
  default_variant = "Variant1"
}
package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.aws.bedrock.AgentPrompt;
import com.pulumi.aws.bedrock.AgentPromptArgs;
import com.pulumi.aws.bedrock.inputs.AgentPromptVariantArgs;
import com.pulumi.aws.bedrock.inputs.AgentPromptVariantInferenceConfigurationArgs;
import com.pulumi.aws.bedrock.inputs.AgentPromptVariantInferenceConfigurationTextArgs;
import com.pulumi.aws.bedrock.inputs.AgentPromptVariantTemplateConfigurationArgs;
import com.pulumi.aws.bedrock.inputs.AgentPromptVariantTemplateConfigurationTextArgs;
import com.pulumi.aws.bedrock.inputs.AgentPromptVariantTemplateConfigurationTextInputVariableArgs;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Map;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;

public class App {
    public static void main(String[] args) {
        Pulumi.run(App::stack);
    }

    public static void stack(Context ctx) {
        var example = new AgentPrompt("example", AgentPromptArgs.builder()
            .variants(AgentPromptVariantArgs.builder()
                .inferenceConfiguration(AgentPromptVariantInferenceConfigurationArgs.builder()
                    .text(AgentPromptVariantInferenceConfigurationTextArgs.builder()
                        .temperature(0.8)
                        .build())
                    .build())
                .templateConfiguration(AgentPromptVariantTemplateConfigurationArgs.builder()
                    .text(AgentPromptVariantTemplateConfigurationTextArgs.builder()
                        .inputVariables(
                            AgentPromptVariantTemplateConfigurationTextInputVariableArgs.builder()
                                .name("genre")
                                .build(),
                            AgentPromptVariantTemplateConfigurationTextInputVariableArgs.builder()
                                .name("number")
                                .build())
                        .text("Make me a {{genre}} playlist consisting of the following number of songs: {{number}}.")
                        .build())
                    .build())
                .name("Variant1")
                .modelId("amazon.titan-text-express-v1")
                .templateType("TEXT")
                .build())
            .name("MakePlaylist")
            .description("My first prompt.")
            .defaultVariant("Variant1")
            .build());

    }
}
resources:
  example:
    type: aws:bedrock:AgentPrompt
    properties:
      variants:
        - inferenceConfiguration:
            text:
              temperature: 0.8
          templateConfiguration:
            text:
              inputVariables:
                - name: genre
                - name: number
              text: 'Make me a {{genre}} playlist consisting of the following number of songs: {{number}}.'
          name: Variant1
          modelId: amazon.titan-text-express-v1
          templateType: TEXT
      name: MakePlaylist
      description: My first prompt.
      defaultVariant: Variant1

Import

Using pulumi import, import Bedrock Agents Prompt using the id. For example:

$ pulumi import aws:bedrock/agentPrompt:AgentPrompt example 1A2BC3DEFG

Constructors

AgentPrompt(String name, {AgentPromptArgs? args, CustomResourceOptions? options})
Creates a new AgentPrompt. name The Pulumi resource name. args Arguments used to configure this AgentPrompt. The set of arguments for AgentPrompt. options Resource options controlling this resource's behavior.
AgentPrompt.reference(String urn)
Creates a typed reference to an existing AgentPrompt resource.

Properties

arn ↔ Output<String>
ARN of the prompt.
latefinal
childResources → Set<Resource>
finalinherited
completionSources ↔ Map<String, IOutputCompletionSource>
latefinalinherited
createdAt ↔ Output<String>
Time at which the prompt was created.
latefinal
customerEncryptionKeyArn ↔ Output<String?>
ARN of the KMS key that you encrypted the prompt with.
latefinal
defaultVariant ↔ Output<String?>
Name of the default variant for your prompt.
latefinal
description ↔ Output<String?>
Description of the prompt.
latefinal
hashCode → int
The hash code for this object.
no setterinherited
id ↔ Output<String>
getter/setter pairinherited
isCustom → bool
Returns whether this resource is provider-managed.
no setterinherited
isProtected → bool
Returns whether this resource is protected from deletion.
no setterinherited
isRemote → bool
Whether this resource is registered as remote.
no setterinherited
isResourceReference → bool
Whether this instance represents a resource value returned over RPC.
finalinherited
name ↔ Output<String>
Name of the prompt.
latefinal
region ↔ Output<String>
Region where this resource will be managed. Defaults to the Region set in the provider configuration.
latefinal
resourceTransforms → List<ResourceTransform>
Inherited/explicit async transforms.
no setterinherited
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
tags ↔ Output<Map<String, String>?>
Key-value map of resource tags. If configured with a provider defaultTags configuration block present, tags with matching keys will overwrite those defined at the provider-level.
latefinal
tagsAll ↔ Output<Map<String, String>>
A map of tags assigned to the resource, including those inherited from the provider defaultTags configuration block.
latefinal
transformations → List<ResourceTransformation>
Inherited/explicit legacy transformations.
no setterinherited
updatedAt ↔ Output<String>
Time at which the prompt was last updated.
latefinal
urn ↔ Output<String>
latefinalinherited
variants ↔ Output<List<AgentPromptVariant>?>
A list of objects, each containing details about a variant of the prompt. See Variant for more information.
latefinal
version ↔ Output<String>
Version of the prompt. When you create a prompt, the version created is the DRAFT version.
latefinal

Methods

failId(Object error) → void
Completes this resource ID with an error when registration fails.
inherited
failOutputs(Object error) → void
Completes all output properties with error.
inherited
failUrn(Object error) → void
Completes this resource URN with an error when registration fails.
inherited
getProvider(String moduleMember) → ProviderResource?
Returns provider for moduleMember's package, if configured.
inherited
getResourceName() → String
Returns this resource's logical name.
inherited
getResourceType() → String
Returns this resource's Pulumi type token.
inherited
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
registerOutput<T>(String propertyName, {Object? decoder(Object?)?, bool isSecret = false}) → Output<T>
Registers a dynamic output property for this resource.
inherited
resolveId(String? value, {required bool isKnown}) → void
Resolves the provider-assigned ID for this resource.
inherited
resolveOutputs(Struct outputs) → void
Resolves all output properties from a monitor response payload.
inherited
resolveUrn(String value) → void
Resolves this resource's URN once assigned by the engine.
inherited
serializeProperties(Map<String, dynamic> properties) → Future<Struct>
Serializes resource properties for RPC transmission.
inherited
toString() → String
A string representation of this object.
inherited

Operators

operator ==(Object other) → bool
The equality operator.
inherited

Static Methods

get(String name, Input<String> id, {AgentPromptState? state, CustomResourceOptions? options}) → AgentPrompt
Gets an existing AgentPrompt resource's state with the given name and id.