createInvocation method

Future<CreateInvocationResponse> createInvocation({
  1. required String sessionIdentifier,
  2. String? description,
  3. String? invocationId,
})

Creates a new invocation within a session. An invocation groups the related invocation steps that store the content from a conversation. For more information about sessions, see Store and retrieve conversation history and context with Amazon Bedrock sessions.

Related APIs

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

Parameter sessionIdentifier : The unique identifier for the associated session for the invocation. You can specify either the session's sessionId or its Amazon Resource Name (ARN).

Parameter description : A description for the interactions in the invocation. For example, "User asking about weather in Seattle".

Parameter invocationId : A unique identifier for the invocation in UUID format.

Implementation

Future<CreateInvocationResponse> createInvocation({
  required String sessionIdentifier,
  String? description,
  String? invocationId,
}) async {
  final $payload = <String, dynamic>{
    if (description != null) 'description': description,
    if (invocationId != null) 'invocationId': invocationId,
  };
  final response = await _protocol.send(
    payload: $payload,
    method: 'PUT',
    requestUri:
        '/sessions/${Uri.encodeComponent(sessionIdentifier)}/invocations/',
    exceptionFnMap: _exceptionFns,
  );
  return CreateInvocationResponse.fromJson(response);
}