蓝图操作 CLI - Amazon Bedrock

本文属于机器翻译版本。若本译文内容与英语原文存在差异,则一律以英文原文为准。

蓝图操作 CLI

本指南涵盖了通过 AWS Amazon Bedrock 数据自动化命令行接口 (CLI) (BDA) 提供的蓝图操作。

创建蓝图

蓝图定义了要从文档、图像、音频或视频文件中提取的数据的结构和属性。使用 create-blueprint 命令定义新的蓝图。

以下命令创建了专为从护照图像中提取数据而量身定制的新蓝图。

语法

aws bedrock-data-automation create-blueprint \ --blueprint-name "passport-blueprint" \ --type "IMAGE" \ --blueprint-stage "DEVELOPMENT" \ --schema '{ "class": "Passport", "description": "Blueprint for processing passport images", "properties": { "passport_number": { "type": "string", "inferenceType": "explicit", "instruction": "The passport identification number" }, "full_name": { "type": "string", "inferenceType": "explicit", "instruction": "The full name of the passport holder" }, "expiration_date": { "type": "string", "inferenceType": "explicit", "instruction": "The passport expiration date" } } }'

完整的参数参考

下表显示了该create-blueprint命令的所有可用参数:

创建蓝图的参数
参数 必需 默认值 Description
--blueprint-name 不适用 蓝图的名称
--type 不适用 内容类型(图像、文档、音频、视频)
--blueprint-stage 实时 蓝图的舞台(开发或上线)
--schema 不适用 定义蓝图结构的 JSON 架构
--client-token 自动生成 请求隐性的唯一标识符

查看蓝图配置

列出所有蓝图

使用 list-blueprints 命令检索与您的账户关联的所有蓝图的列表。

语法

aws bedrock-data-automation list-blueprints

查看蓝图详情

要查看有关特定蓝图的详细信息,包括其架构和配置,请使用 get-blueprint 命令。

语法

aws bedrock-data-automation get-blueprint \ --blueprint-arn "Amazon Resource Name (ARN)"

检查特定版本

使用版本控制的蓝图时,使用带有--blueprint-version 选项的 get-blueprint 命令来查看特定版本。

语法

aws bedrock-data-automation get-blueprint \ --blueprint-arn "Amazon Resource Name (ARN)" \ --blueprint-version "version-number"

检查特定阶段

要在 “开发” 或 “实时” 阶段查看蓝图,请使用:

aws bedrock-data-automation get-blueprint \ --blueprint-arn "Amazon Resource Name (ARN)" \ --blueprint-stage "LIVE"

编辑蓝图规范

更新蓝图设置

要修改现有蓝图的架构或属性,请使用 update-blueprint 命令。

语法

aws bedrock-data-automation update-blueprint \ --blueprint-arn "Amazon Resource Name (ARN)" \ --schema '{ "class": "Passport", "description": "Updated blueprint for processing passport images", "properties": { "passport_number": { "type": "string", "inferenceType": "explicit", "instruction": "The passport identification number" }, "full_name": { "type": "string", "inferenceType": "explicit", "instruction": "The full name of the passport holder" }, "expiration_date": { "type": "string", "inferenceType": "explicit", "instruction": "The passport expiration date" } } }'

注意:更新蓝图时,即使字段没有更改,也必须提供完整的架构。

晋升为直播

要将蓝图从开发阶段移至上线阶段进行生产,请使用带有--blueprint-stage选项的更新蓝图命令。

语法

aws bedrock-data-automation update-blueprint \ --blueprint-arn "Amazon Resource Name (ARN)" \ --blueprint-stage "LIVE"

蓝图版本控制

在使用 create-blueprint-version命令进行重大更改之前,创建蓝图的新版本以保留其当前状态。

语法

aws bedrock-data-automation create-blueprint-version \ --blueprint-arn "Amazon Resource Name (ARN)"

管理蓝图标签

标签可帮助用户对蓝图进行组织和分类,从而简化管理。

添加标签

通过添加标签将元数据应用于蓝图。

语法

aws bedrock-data-automation tag-resource \ --resource-arn "Amazon Resource Name (ARN)" \ --tags '{"Department":"Finance","Project":"PassportProcessing"}'

移除标签

使用 untag-resource 命令从蓝图中移除特定标签。

语法

aws bedrock-data-automation untag-resource \ --resource-arn "Amazon Resource Name (ARN)" \ --tag-keys '["Department","Project"]'

查看标签

使用 list-tags-for-resource命令列出与您的蓝图关联的所有标签。

语法

aws bedrock-data-automation list-tags-for-resource \ --resource-arn "Amazon Resource Name (ARN)"

删除蓝图

删除整个蓝图

使用 delete-blueprint 命令永久移除蓝图及其所有版本。

语法

aws bedrock-data-automation delete-blueprint \ --blueprint-arn "Amazon Resource Name (ARN)"

注意:此命令会永久删除蓝图且无法将其恢复。

重要提示:您不能删除任何项目当前正在使用的蓝图。删除之前,请确保任何项目的自定义输出配置中均未引用蓝图。