AWS SDK 예제 GitHub 리포지토리에 더 많은 AWS문서 SDK 예제가 있습니다.
AWS SDK와 함께 CreateFlowAlias사용
다음 코드 예시는 CreateFlowAlias의 사용 방법을 보여 줍니다.
작업 예제는 대규모 프로그램에서 발췌한 코드이며 컨텍스트에 맞춰 실행해야 합니다. 다음 코드 예제에서는 컨텍스트 내에서 이 작업을 확인할 수 있습니다.
- Python
-
- SDK for Python (Boto3)
-
GitHub에 더 많은 내용이 있습니다. AWS코드 예 리포지토리에서 전체 예를 찾고 설정 및 실행하는 방법을 배워보세요.
Amazon Bedrock 흐름의 별칭을 생성합니다.
def create_flow_alias(client, flow_id, flow_version, name, description):
"""
Creates an alias for an Amazon Bedrock flow.
Args:
client: bedrock agent boto3 client.
flow_id (str): The identifier of the flow.
Returns:
str: The ID for the flow alias.
"""
try:
logger.info("Creating flow alias for flow: %s.", flow_id)
response = client.create_flow_alias(
flowIdentifier=flow_id,
name=name,
description=description,
routingConfiguration=[
{
"flowVersion": flow_version
}
]
)
logger.info("Successfully created flow alias for %s.", flow_id)
return response['id']
except ClientError as e:
logging.exception("Client error creating alias for flow: %s - %s",
flow_id, str(e))
raise
except Exception as e:
logging.exception("Unexpected error creating alias for flow : %s - %s",
flow_id, str(e))
raise