Description
Description
Description:
The Prompt Management feature streamlines the creation, evaluation, deployment, and sharing of prompts. This feature helps developers and business users obtain the best responses from FMs for their specific use cases.
Key benefits of Prompt Management include the following:
Rapid prompt creation and iteration – Create your prompts and variations with the built-in prompt builder on the Amazon Bedrock console or with the CreatePrompt Incorporate dynamic information using inputs for building your prompt templates.
Seamless testing and deployment – Quickly test individual prompts, set variables and their test values. Create prompt versions stored in the built-in prompt library for cataloging and management using the Amazon Bedrock console or the GetPrompt, ListPrompts, and CreatePromptVersion.
Features:
- Create a new prompt (create_prompt)
- Create a version of a prompt (create_prompt_version)
- Retrieve information about a specific prompt (get_prompt)
- List all prompts (list_prompts)
Requested Resource(s) and/or Data Source(s)
- aws_bedrockagent_prompt
Potential Terraform Configuration
# Provider configuration
terraform {
required_providers {
aws = {
source = "hashicorp/aws"
version = "~> 4.0"
}
}
}
provider "aws" {
region = var.aws_region
}
# Variables
variable "aws_region" {
description = "The AWS region to create resources in"
default = "us-west-2"
}
variable "prompt_name" {
description = "Name of the BedrockAgent Prompt"
default = "my_bedrockagent_prompt"
}
variable "prompt_description" {
description = "Description of the BedrockAgent Prompt"
default = "Example BedrockAgent prompt for agent"
}
variable "specialization" {
description = "Specialization of the AI assistant"
default = "customer service"
}
variable "tone" {
description = "Tone of the AI assistant's responses"
default = "professional"
}
# BedrockAgent Prompt Resource
resource "aws_bedrockagent_prompt" "example" {
name = var.prompt_name
description = var.prompt_description
prompt_template = <<EOF
You are an AI assistant specialized in ${var.specialization}.
User query: {{user_input}}
Consider the following context: {{context}}
Respond in a ${var.tone} tone.
EOF
input_parameter {
name = "user_input"
description = "The user's query or input"
}
input_parameter {
name = "context"
description = "Additional context for the prompt"
}
tags = {
Environment = "Production"
Project = "AI Assistant"
}
}
# Prompt Version Resource
resource "aws_bedrockagent_prompt_version" "example_version" {
prompt_id = aws_bedrockagent_prompt.example.id
version = "1.0"
}
# Data source to get information about a specific prompt
data "aws_bedrockagent_prompt" "example" {
prompt_id = aws_bedrockagent_prompt.example.id
}
# Data source to list all prompts
data "aws_bedrockagent_prompts" "all_prompts" {
depends_on = [aws_bedrockagent_prompt.example]
}
# Outputs
output "prompt_id" {
description = "The ID of the created BedrockAgent Prompt"
value = aws_bedrockagent_prompt.example.id
}
output "prompt_version" {
description = "The version of the created BedrockAgent Prompt"
value = aws_bedrockagent_prompt_version.example_version.version
}
output "prompt_details" {
description = "Details of the created BedrockAgent Prompt"
value = data.aws_bedrockagent_prompt.example
}
output "all_prompts" {
description = "List of all BedrockAgent Prompts"
value = data.aws_bedrockagent_prompts.all_prompts.prompts
}
References
- Streamline generative AI development in Amazon Bedrock with Prompt Management and Prompt Flows (preview)
- Prompt Management for Amazon Bedrock
Would you like to implement a fix?
No