createPromptVersion method

Future<CreatePromptVersionResponse> createPromptVersion({
  1. required String promptIdentifier,
  2. String? clientToken,
  3. String? description,
  4. Map<String, String>? tags,
})

Creates 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.

May throw AccessDeniedException. May throw ConflictException. May throw InternalServerException. May throw ResourceNotFoundException. May throw ServiceQuotaExceededException. May throw ThrottlingException. May throw ValidationException.

Parameter promptIdentifier : The unique identifier of the prompt that you want to create a version of.

Parameter clientToken : A unique, case-sensitive identifier to ensure that the API request completes no more than one time. If this token matches a previous request, Amazon Bedrock ignores the request, but does not return an error. For more information, see Ensuring idempotency.

Parameter description : A description for the version of the prompt.

Parameter tags : Any tags that you want to attach to the version of the prompt. For more information, see Tagging resources in Amazon Bedrock.

Implementation

Future<CreatePromptVersionResponse> createPromptVersion({
  required String promptIdentifier,
  String? clientToken,
  String? description,
  Map<String, String>? tags,
}) async {
  final $payload = <String, dynamic>{
    'clientToken': clientToken ?? _s.generateIdempotencyToken(),
    if (description != null) 'description': description,
    if (tags != null) 'tags': tags,
  };
  final response = await _protocol.send(
    payload: $payload,
    method: 'POST',
    requestUri: '/prompts/${Uri.encodeComponent(promptIdentifier)}/versions',
    exceptionFnMap: _exceptionFns,
  );
  return CreatePromptVersionResponse.fromJson(response);
}