updateAgentKnowledgeBase method

Future<UpdateAgentKnowledgeBaseResponse> updateAgentKnowledgeBase({
  1. required String agentId,
  2. required String agentVersion,
  3. required String knowledgeBaseId,
  4. String? description,
  5. KnowledgeBaseState? knowledgeBaseState,
})

Updates the configuration for a knowledge base that has been associated with an agent.

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

Parameter agentId : The unique identifier of the agent associated with the knowledge base that you want to update.

Parameter agentVersion : The version of the agent associated with the knowledge base that you want to update.

Parameter knowledgeBaseId : The unique identifier of the knowledge base that has been associated with an agent.

Parameter description : Specifies a new description for the knowledge base associated with an agent.

Parameter knowledgeBaseState : Specifies whether the agent uses the knowledge base or not when sending an InvokeAgent request.

Implementation

Future<UpdateAgentKnowledgeBaseResponse> updateAgentKnowledgeBase({
  required String agentId,
  required String agentVersion,
  required String knowledgeBaseId,
  String? description,
  KnowledgeBaseState? knowledgeBaseState,
}) async {
  final $payload = <String, dynamic>{
    if (description != null) 'description': description,
    if (knowledgeBaseState != null)
      'knowledgeBaseState': knowledgeBaseState.value,
  };
  final response = await _protocol.send(
    payload: $payload,
    method: 'PUT',
    requestUri:
        '/agents/${Uri.encodeComponent(agentId)}/agentversions/${Uri.encodeComponent(agentVersion)}/knowledgebases/${Uri.encodeComponent(knowledgeBaseId)}/',
    exceptionFnMap: _exceptionFns,
  );
  return UpdateAgentKnowledgeBaseResponse.fromJson(response);
}