D’autres exemples de kits AWS SDK sont disponibles dans le référentiel GitHub AWS Doc SDK Examples
Utilisation de ListFlowVersions avec un kit SDK AWS
L’exemple de code suivant illustre comment utiliser ListFlowVersions.
- Python
-
- Kit SDK pour Python (Boto3)
-
Note
Il y en a plus sur GitHub. Trouvez l’exemple complet et découvrez comment le configurer et l’exécuter dans le référentiel d’exemples de code AWS
. Répertoriez les versions d’un flux Amazon Bedrock.
def list_flow_versions(client, flow_id): """ Lists the versions of an Amazon Bedrock flow. Args: client: Amazon bedrock agent boto3 client. flow_id (str): The identifier of the flow. Returns: dict: The response from ListFlowVersions. """ try: finished = False logger.info("Listing flow versions for flow: %s.", flow_id) response = client.list_flow_versions( flowIdentifier=flow_id, maxResults=10) while finished is False: print(f"Versions for flow:{flow_id}") for version in response['flowVersionSummaries']: print(f"Version: {version['version']}") print(f"Status: {version['status']}\n") if 'nextToken' in response: next_token = response['nextToken'] response = client.list_flow_versions(maxResults=10, nextToken=next_token) else: finished = True logging.info("Successfully listed flow versions for flow %s.", flow_id) return response 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-
Pour plus de détails sur l’API, consultez ListFlowVersions dans la Référence des API du kit AWS SDK for Python (Boto3).
-
ListFlowAliases
ListFlows