optimizePrompt method

Future<OptimizePromptResponse> optimizePrompt({
  1. required InputPrompt input,
  2. required String targetModelId,
})

Optimizes a prompt for the task that you specify. For more information, see Optimize a prompt in the Amazon Bedrock User Guide.

May throw AccessDeniedException. May throw BadGatewayException. May throw DependencyFailedException. May throw InternalServerException. May throw ThrottlingException. May throw ValidationException.

Parameter input : Contains the prompt to optimize.

Parameter targetModelId : The unique identifier of the model that you want to optimize the prompt for.

Implementation

Future<OptimizePromptResponse> optimizePrompt({
  required InputPrompt input,
  required String targetModelId,
}) async {
  final $payload = <String, dynamic>{
    'input': input,
    'targetModelId': targetModelId,
  };
  final response = await _protocol.sendRaw(
    payload: $payload,
    method: 'POST',
    requestUri: '/optimize-prompt',
    exceptionFnMap: _exceptionFns,
  );
  final $json = await _s.jsonFromResponse(response);
  return OptimizePromptResponse(
    optimizedPrompt: OptimizedPromptStream.fromJson($json),
  );
}