updateKnowledgeBase method

Future<UpdateKnowledgeBaseResponse> updateKnowledgeBase({
  1. required KnowledgeBaseConfiguration knowledgeBaseConfiguration,
  2. required String knowledgeBaseId,
  3. required String name,
  4. required String roleArn,
  5. String? description,
  6. StorageConfiguration? storageConfiguration,
})

Updates the configuration of a knowledge base with the fields that you specify. Because all fields will be overwritten, you must include the same values for fields that you want to keep the same.

You can change the following fields:

  • name
  • description
  • roleArn
You can't change the knowledgeBaseConfiguration or storageConfiguration fields, so you must specify the same configurations as when you created the knowledge base. You can send a GetKnowledgeBase request and copy the same configurations.

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

Parameter knowledgeBaseConfiguration : Specifies the configuration for the embeddings model used for the knowledge base. You must use the same configuration as when the knowledge base was created.

Parameter knowledgeBaseId : The unique identifier of the knowledge base to update.

Parameter name : Specifies a new name for the knowledge base.

Parameter roleArn : Specifies a different Amazon Resource Name (ARN) of the IAM role with permissions to invoke API operations on the knowledge base.

Parameter description : Specifies a new description for the knowledge base.

Parameter storageConfiguration : Specifies the configuration for the vector store used for the knowledge base. You must use the same configuration as when the knowledge base was created.

Implementation

Future<UpdateKnowledgeBaseResponse> updateKnowledgeBase({
  required KnowledgeBaseConfiguration knowledgeBaseConfiguration,
  required String knowledgeBaseId,
  required String name,
  required String roleArn,
  String? description,
  StorageConfiguration? storageConfiguration,
}) async {
  final $payload = <String, dynamic>{
    'knowledgeBaseConfiguration': knowledgeBaseConfiguration,
    'name': name,
    'roleArn': roleArn,
    if (description != null) 'description': description,
    if (storageConfiguration != null)
      'storageConfiguration': storageConfiguration,
  };
  final response = await _protocol.send(
    payload: $payload,
    method: 'PUT',
    requestUri: '/knowledgebases/${Uri.encodeComponent(knowledgeBaseId)}',
    exceptionFnMap: _exceptionFns,
  );
  return UpdateKnowledgeBaseResponse.fromJson(response);
}