文件 AWS 開發套件範例 GitHub 儲存庫中有更多可用的 AWS SDK 範例。
本文為英文版的機器翻譯版本,如內容有任何歧義或不一致之處,概以英文版為準。
GetFlowVersion
搭配 AWS SDK 使用
以下程式碼範例顯示如何使用 GetFlowVersion
。
動作範例是大型程式的程式碼摘錄,必須在內容中執行。您可以在下列程式碼範例的內容中看到此動作:
- Python
-
- SDK for Python (Boto3)
-
取得 Amazon Bedrock 流程的版本。
def get_flow_version(client, flow_id, flow_version):
"""
Gets information about a version of an Amazon Bedrock flow.
Args:
client: Amazon Bedrock agent boto3 client.
flow_id (str): The identifier of the flow.
flow_version (str): The flow version of the flow.
Returns:
dict: The response from the call to GetFlowVersion.
"""
try:
logger.info("Deleting flow version for flow: %s.", flow_id)
# Call GetFlowVersion operation
response = client.get_flow_version(
flowIdentifier=flow_id,
flowVersion=flow_version
)
logging.info("Successfully got flow version %s information for flow %s.",
flow_version,
flow_id)
return response
except ClientError as e:
logging.exception("Client error getting flow version: %s", str(e))
raise
except Exception as e:
logging.exception("Unexpected error getting flow version: %s", str(e))
raise