Cómo utilizar UpdateFlow con un AWS SDK - Amazon Bedrock

Cómo utilizar UpdateFlow con un AWS SDK

En el siguiente ejemplo de código, se muestra cómo utilizar UpdateFlow.

Python
SDK para Python (Boto3)
nota

Hay más en GitHub. Busque el ejemplo completo y aprenda a configurar y ejecutar en el Repositorio de ejemplos de código de AWS.

Actualizar un flujo de Amazon Bedrock.

def update_flow(client, flow_id, flow_name, flow_description, role_arn, flow_def): """ Updates an Amazon Bedrock flow. Args: client: bedrock agent boto3 client. flow_id (str): The ID for the flow that you want to update. flow_name (str): The name for the flow. role_arn (str): The ARN for the IAM role that use flow uses. flow_def (json): The JSON definition of the flow that you want to create. Returns: dict: Flow information if successful. """ try: logger.info("Updating flow: %s.", flow_id) response = client.update_flow( flowIdentifier=flow_id, name=flow_name, description=flow_description, executionRoleArn=role_arn, definition=flow_def ) logger.info("Successfully updated flow: %s. ID: %s", flow_name, {response['id']}) return response except ClientError as e: logger.exception("Client error updating flow: %s", {str(e)}) raise except Exception as e: logger.exception("Unexepcted error updating flow: %s", {str(e)}) raise
  • Para obtener información sobre la API, consulte UpdateFlow en la Referencia de la API de AWS SDK para Python (Boto3).

Para obtener una lista completa de las guías para desarrolladores de AWS SDK y ejemplos de código, consulte Uso de Amazon Bedrock con un AWS SDK. En este tema también se incluye información sobre cómo comenzar a utilizar el SDK y detalles sobre sus versiones anteriores.