将 UpdateFlow 和 AWS SDK 搭配使用 - Amazon Bedrock

UpdateFlow 和 AWS SDK 搭配使用

以下代码示例演示了如何使用 UpdateFlow

Python
适用于 Python 的 SDK (Boto3)
注意

查看 GitHub,了解更多信息。在 AWS 代码示例存储库中查找完整示例,了解如何进行设置和运行。

更新 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
  • 有关 API 详细信息,请参阅《适用于 Python 的 AWS SDK(Boto3)API 参考》中的 UpdateFlow

有关 AWS SDK 开发人员指南和代码示例的完整列表,请参阅 将 Amazon Bedrock 与 AWS SDK 结合使用。本主题还包括有关入门的信息以及有关先前的 SDK 版本的详细信息。