createAIPrompt method
- required AIPromptAPIFormat apiFormat,
- required String assistantId,
- required String modelId,
- required String name,
- required AIPromptTemplateConfiguration templateConfiguration,
- required AIPromptTemplateType templateType,
- required AIPromptType type,
- required VisibilityStatus visibilityStatus,
- String? clientToken,
- String? description,
- AIPromptInferenceConfiguration? inferenceConfiguration,
- Map<
String, String> ? tags,
Creates an Amazon Q in Connect AI Prompt.
May throw AccessDeniedException.
May throw ConflictException.
May throw ResourceNotFoundException.
May throw ServiceQuotaExceededException.
May throw ThrottlingException.
May throw UnauthorizedException.
May throw ValidationException.
Parameter apiFormat :
The API Format of the AI Prompt.
Recommended values: MESSAGES | TEXT_COMPLETIONS
Parameter assistantId :
The identifier of the Amazon Q in Connect assistant. Can be either the ID
or the ARN. URLs cannot contain the ARN.
Parameter modelId :
The identifier of the model used for this AI Prompt.
Parameter name :
The name of the AI Prompt.
Parameter templateConfiguration :
The configuration of the prompt template for this AI Prompt.
Parameter templateType :
The type of the prompt template for this AI Prompt.
Parameter type :
The type of this AI Prompt.
Parameter visibilityStatus :
The visibility status of the AI Prompt.
Parameter clientToken :
A unique, case-sensitive identifier that you provide to ensure the
idempotency of the request. If not provided, the Amazon Web Services SDK
populates this field. For more information about idempotency, see Making
retries safe with idempotent APIs..
Parameter description :
The description of the AI Prompt.
Parameter inferenceConfiguration :
The inference configuration for the AI Prompt being created.
Parameter tags :
The tags used to organize, track, or control access for this resource.
Implementation
Future<CreateAIPromptResponse> createAIPrompt({
required AIPromptAPIFormat apiFormat,
required String assistantId,
required String modelId,
required String name,
required AIPromptTemplateConfiguration templateConfiguration,
required AIPromptTemplateType templateType,
required AIPromptType type,
required VisibilityStatus visibilityStatus,
String? clientToken,
String? description,
AIPromptInferenceConfiguration? inferenceConfiguration,
Map<String, String>? tags,
}) async {
final $payload = <String, dynamic>{
'apiFormat': apiFormat.value,
'modelId': modelId,
'name': name,
'templateConfiguration': templateConfiguration,
'templateType': templateType.value,
'type': type.value,
'visibilityStatus': visibilityStatus.value,
'clientToken': clientToken ?? _s.generateIdempotencyToken(),
if (description != null) 'description': description,
if (inferenceConfiguration != null)
'inferenceConfiguration': inferenceConfiguration,
if (tags != null) 'tags': tags,
};
final response = await _protocol.send(
payload: $payload,
method: 'POST',
requestUri: '/assistants/${Uri.encodeComponent(assistantId)}/aiprompts',
exceptionFnMap: _exceptionFns,
);
return CreateAIPromptResponse.fromJson(response);
}