invokeAssistant method
Invokes SiteWise Assistant to start or continue a conversation.
May throw AccessDeniedException.
May throw ConflictingOperationException.
May throw InternalFailureException.
May throw InvalidRequestException.
May throw LimitExceededException.
May throw ResourceNotFoundException.
May throw ThrottlingException.
Parameter message :
A text message sent to the SiteWise Assistant by the user.
Parameter conversationId :
The ID assigned to a conversation. IoT SiteWise automatically generates a
unique ID for you, and this parameter is never required. However, if you
prefer to have your own ID, you must specify it here in UUID format. If
you specify your own ID, it must be globally unique.
Parameter enableTrace :
Specifies if to turn trace on or not. It is used to track the SiteWise
Assistant's reasoning, and data access process.
Implementation
Future<InvokeAssistantResponse> invokeAssistant({
required String message,
String? conversationId,
bool? enableTrace,
}) async {
final $payload = <String, dynamic>{
'message': message,
if (conversationId != null) 'conversationId': conversationId,
if (enableTrace != null) 'enableTrace': enableTrace,
};
final response = await _protocol.sendRaw(
payload: $payload,
method: 'POST',
requestUri: '/assistant/invocation',
exceptionFnMap: _exceptionFns,
);
final $json = await _s.jsonFromResponse(response);
return InvokeAssistantResponse(
body: ResponseStream.fromJson($json),
conversationId: _s.extractHeaderStringValue(
response.headers, 'x-amz-iotsitewise-assistant-conversation-id')!,
);
}