deleteKnowledgeBaseDocuments method

Future<DeleteKnowledgeBaseDocumentsResponse> deleteKnowledgeBaseDocuments({
  1. required String dataSourceId,
  2. required List<DocumentIdentifier> documentIdentifiers,
  3. required String knowledgeBaseId,
  4. String? clientToken,
})

Deletes documents from a data source and syncs the changes to the knowledge base that is connected to it. For more information, see Ingest changes directly into a knowledge base in the Amazon Bedrock User Guide.

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

Parameter dataSourceId : The unique identifier of the data source that contains the documents.

Parameter documentIdentifiers : A list of objects, each of which contains information to identify a document to delete.

Parameter knowledgeBaseId : The unique identifier of the knowledge base that is connected to the data source.

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.

Implementation

Future<DeleteKnowledgeBaseDocumentsResponse> deleteKnowledgeBaseDocuments({
  required String dataSourceId,
  required List<DocumentIdentifier> documentIdentifiers,
  required String knowledgeBaseId,
  String? clientToken,
}) async {
  final $payload = <String, dynamic>{
    'documentIdentifiers': documentIdentifiers,
    'clientToken': clientToken ?? _s.generateIdempotencyToken(),
  };
  final response = await _protocol.send(
    payload: $payload,
    method: 'POST',
    requestUri:
        '/knowledgebases/${Uri.encodeComponent(knowledgeBaseId)}/datasources/${Uri.encodeComponent(dataSourceId)}/documents/deleteDocuments',
    exceptionFnMap: _exceptionFns,
  );
  return DeleteKnowledgeBaseDocumentsResponse.fromJson(response);
}