updatePrompt method
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.
May throw AccessDeniedException.
May throw ConflictException.
May throw InternalServerException.
May throw ResourceNotFoundException.
May throw ServiceQuotaExceededException.
May throw ThrottlingException.
May throw ValidationException.
Parameter name :
A name for the prompt.
Parameter promptIdentifier :
The unique identifier of the prompt.
Parameter customerEncryptionKeyArn :
The Amazon Resource Name (ARN) of the KMS key to encrypt the prompt.
Parameter defaultVariant :
The name of the default variant for the prompt. This value must match the
name field in the relevant PromptVariant
object.
Parameter description :
A description for the prompt.
Parameter variants :
A list of objects, each containing details about a variant of the prompt.
Implementation
Future<UpdatePromptResponse> updatePrompt({
required String name,
required String promptIdentifier,
String? customerEncryptionKeyArn,
String? defaultVariant,
String? description,
List<PromptVariant>? variants,
}) async {
final $payload = <String, dynamic>{
'name': name,
if (customerEncryptionKeyArn != null)
'customerEncryptionKeyArn': customerEncryptionKeyArn,
if (defaultVariant != null) 'defaultVariant': defaultVariant,
if (description != null) 'description': description,
if (variants != null) 'variants': variants,
};
final response = await _protocol.send(
payload: $payload,
method: 'PUT',
requestUri: '/prompts/${Uri.encodeComponent(promptIdentifier)}/',
exceptionFnMap: _exceptionFns,
);
return UpdatePromptResponse.fromJson(response);
}