Terjemahan disediakan oleh mesin penerjemah. Jika konten terjemahan yang diberikan bertentangan dengan versi bahasa Inggris aslinya, utamakan versi bahasa Inggris.
Gunakan ListFlowsdengan AWS SDK
Contoh kode berikut menunjukkan cara menggunakanListFlows.
- Python
-
- SDK untuk Python (Boto3)
-
Ada lebih banyak tentang GitHub. Temukan contoh lengkapnya dan pelajari cara mengatur dan menjalankannya di Repositori Contoh Kode AWS.
Daftar aliran Amazon Bedrock.
def list_flows(client):
"""
Lists versions of an Amazon Bedrock flow.
Args:
client: Amazon Bedrock agent boto3 client.
flow_id (str): The identifier of the flow.
Returns:
Nothing.
"""
try:
finished = False
logger.info("Listing flows:")
response = client.list_flows(maxResults=10)
while finished is False:
for flow in response['flowSummaries']:
print(f"ID: {flow['id']}")
print(f"Name: {flow['name']}")
print(
f"Description: {flow.get('description', 'No description')}")
print(f"Latest version: {flow['version']}")
print(f"Status: {flow['status']}\n")
if 'nextToken' in response:
next_token = response['nextToken']
response = client.list_flows(maxResults=10,
nextToken=next_token)
else:
finished = True
logging.info("Successfully listed flows.")
except ClientError as e:
logging.exception("Client error listing flow versions: %s", str(e))
raise
except Exception as e:
logging.exception("Unexpected error listing flow versions: %s", str(e))
raise
Untuk daftar lengkap panduan pengembang AWS SDK dan contoh kode, lihatMenggunakan Amazon Bedrock dengan AWS SDK. Topik ini juga mencakup informasi tentang memulai dan detail tentang versi SDK sebelumnya.