Skip to main content

prompts

Creates, updates, deletes, gets or lists a prompts resource.

Overview

Nameprompts
TypeResource
Idaws.bedrock_agent.prompts

Fields

The following fields are returned by SELECT queries:

NameDatatypeDescription
idstringThe unique identifier of the prompt. (pattern: <code>[0-9a-zA-Z]{10}</code>)
namestringThe name of the prompt. (pattern: <code>([0-9a-zA-Z][_-]?){1,100}</code>)
arnstringThe Amazon Resource Name (ARN) of the prompt or the prompt version (if you specified a version in the request). (pattern: <code>(arn:aws:bedrock:[a-z0-9-]{1,20}:[0-9]{12}:prompt/[0-9a-zA-Z]{10}(?::[0-9]{1,5})?)</code>)
created_atstring (date-time)The time at which the prompt was created.
customer_encryption_key_arnstringThe Amazon Resource Name (ARN) of the KMS key that the prompt is encrypted with. (pattern: <code>arn:aws(|-cn|-us-gov):kms:[a-zA-Z0-9-]*:[0-9]{12}:key/[a-zA-Z0-9-]{36}</code>)
default_variantstringThe name of the default variant for the prompt. This value must match the name field in the relevant PromptVariant object. (pattern: <code>([0-9a-zA-Z][_-]?){1,100}</code>)
descriptionstringThe descriptino of the prompt.
updated_atstring (date-time)The time at which the prompt was last updated.
variantsarrayA list of objects, each containing details about a variant of the prompt.
versionstringThe version of the prompt. (pattern: <code>(DRAFT|[0-9]{0,4}[1-9][0-9]{0,4})</code>)

Methods

The following methods are available for this resource:

NameAccessible byRequired ParamsOptional ParamsDescription
get_promptselectprompt_identifier, regionpromptVersion, includedDataRetrieves information about the working draft (DRAFT version) of a prompt or a version of it, depending on whether you include the promptVersion field or not. For more information, see View information about prompts using Prompt management and View information about a version of your prompt in the Amazon Bedrock User Guide.
list_promptsselectregionpromptIdentifier, maxResults, nextTokenReturns either information about the working draft (DRAFT version) of each prompt in an account, or information about of all versions of a prompt, depending on whether you include the promptIdentifier field or not. For more information, see View information about prompts using Prompt management in the Amazon Bedrock User Guide.
create_promptinsertregion, nameCreates a prompt in your prompt library that you can add to a flow. For more information, see Prompt management in Amazon Bedrock, Create a prompt using Prompt management and Prompt flows in Amazon Bedrock in the Amazon Bedrock User Guide.
create_prompt_versioninsertprompt_identifier, regionCreates a static snapshot of your prompt that can be deployed to production. For more information, see Deploy prompts using Prompt management by creating versions in the Amazon Bedrock User Guide.
update_promptupdateprompt_identifier, region, nameModifies a prompt in your prompt library. Include both fields that you want to keep and fields that you want to replace. For more information, see Prompt management in Amazon Bedrock and Edit prompts in your prompt library in the Amazon Bedrock User Guide.
delete_promptdeleteprompt_identifier, regionpromptVersionDeletes a prompt or a version of it, depending on whether you include the promptVersion field or not. For more information, see Delete prompts from the Prompt management tool and Delete a version of a prompt from the Prompt management tool in the Amazon Bedrock User Guide.

Parameters

Parameters can be passed in the WHERE clause of a query. Check the Methods section to see which parameters are required or optional for each operation.

NameDatatypeDescription
prompt_identifierstringThe unique identifier of the prompt.
regionstringAWS region (default: us-east-1)
includedDatastringControls the scope of data returned. Set to METADATA_ONLY to return only resource metadata. Set to ALL_DATA or omit this field to return the full response.
maxResultsintegerThe maximum number of results to return in the response. If the total number of results is greater than this value, use the token returned in the response in the nextToken field when making another request to return the next batch of results.
nextTokenstringIf the total number of results is greater than the maxResults value provided in the request, enter the token returned in the nextToken field in the response in this field to return the next batch of results.
promptIdentifierstringThe unique identifier of the prompt for whose versions you want to return information. Omit this field to list information about all prompts in an account.
promptVersionstringThe version of the prompt to delete. To delete the prompt, omit this field.

SELECT examples

Retrieves information about the working draft (DRAFT version) of a prompt or a version of it, depending on whether you include the promptVersion field or not. For more information, see View information about prompts using Prompt management and View information about a version of your prompt in the Amazon Bedrock User Guide.

SELECT
id,
name,
arn,
created_at,
customer_encryption_key_arn,
default_variant,
description,
updated_at,
variants,
version
FROM aws.bedrock_agent.prompts
WHERE prompt_identifier = '{{ prompt_identifier }}' -- required
AND region = '{{ region }}' -- required
AND promptVersion = '{{ promptVersion }}'
AND includedData = '{{ includedData }}'
;

INSERT examples

Creates a prompt in your prompt library that you can add to a flow. For more information, see Prompt management in Amazon Bedrock, Create a prompt using Prompt management and Prompt flows in Amazon Bedrock in the Amazon Bedrock User Guide.

INSERT INTO aws.bedrock_agent.prompts (
name,
description,
customerEncryptionKeyArn,
defaultVariant,
variants,
clientToken,
tags,
region
)
SELECT
'{{ name }}' /* required */,
'{{ description }}',
'{{ customerEncryptionKeyArn }}',
'{{ defaultVariant }}',
'{{ variants }}',
'{{ clientToken }}',
'{{ tags }}',
'{{ region }}'
RETURNING
id,
name,
arn,
created_at,
customer_encryption_key_arn,
default_variant,
description,
updated_at,
variants,
version
;

UPDATE examples

Modifies a prompt in your prompt library. Include both fields that you want to keep and fields that you want to replace. For more information, see Prompt management in Amazon Bedrock and Edit prompts in your prompt library in the Amazon Bedrock User Guide.

UPDATE aws.bedrock_agent.prompts
SET
name = '{{ name }}',
description = '{{ description }}',
customerEncryptionKeyArn = '{{ customerEncryptionKeyArn }}',
defaultVariant = '{{ defaultVariant }}',
variants = '{{ variants }}'
WHERE
prompt_identifier = '{{ prompt_identifier }}' --required
AND region = '{{ region }}' --required
AND name = '{{ name }}' --required
RETURNING
id,
name,
arn,
created_at,
customer_encryption_key_arn,
default_variant,
description,
updated_at,
variants,
version;

DELETE examples

Deletes a prompt or a version of it, depending on whether you include the promptVersion field or not. For more information, see Delete prompts from the Prompt management tool and Delete a version of a prompt from the Prompt management tool in the Amazon Bedrock User Guide.

DELETE FROM aws.bedrock_agent.prompts
WHERE prompt_identifier = '{{ prompt_identifier }}' --required
AND region = '{{ region }}' --required
AND promptVersion = '{{ promptVersion }}'
;