TwelveLabs Pegasus 1.2 - Amazon Bedrock

TwelveLabs Pegasus 1.2

TwelveLabs Pegasus 1.2 模型具备全面的视频理解与分析能力,能够分析视频内容,并生成关于视频的文本描述、见解及问题解答。

使用这些信息,您可以通过 InvokeModel 和 InvokeModelWithResponseStream(流式传输)操作对 TwelveLabs 模型进行推理调用。

  • 提供商 – TwelveLabs

  • 类别 – 视频理解、内容分析

  • 模型 ID – twelvelabs.pegasus-1-2-v1:0

  • 输入模态 – 视频

  • 输出模态 – 文本

  • 最大视频大小 – 时长 1 小时的视频(文件大小 < 2 GB)

TwelveLabs Pegasus 1.2 请求参数

下表描述了 TwelveLabs Pegasus 1.2 模型的输入参数:

TwelveLabs Pegasus 1.2 请求参数
字段 类型 必需 描述
inputPrompt 字符串 用于分析视频的提示。最大值:2000 个词元。
temperature double 模型的温度。控制输出的随机性。默认值:0.2,最小值:0,最大值:1。
responseFormat 对象 可让用户指定结构化输出格式。目前仅支持 json_schema。
mediaSource 对象 描述媒体源。必须提供 base64Strings3Location
mediaSource.base64String 字符串 视频的 Base64 编码字节字符串。最大值:36 MB。
mediaSource.s3Location.uri 字符串 可用于下载视频的 S3 URI。最大值:时长 1 小时的视频(文件大小 < 2 GB)。
mediaSource.s3Location.bucketOwner 字符串 存储桶拥有者的 AWS 账户 ID。
maxOutputTokens 整数 要生成的最大词元数。最大值:4096。

TwelveLabs Pegasus 1.2 响应字段

下表描述了 TwelveLabs Pegasus 1.2 模型的输出字段:

TwelveLabs Pegasus 1.2 响应字段
字段 类型 描述
message 字符串 包含模型对视频的分析结果的输出消息。
finishReason 字符串 描述输出终止原因的停止原因。有效值:stop(API 返回完整补全结果,未触发任何限制)、length(生成内容超出 max_tokens 限制)。

TwelveLabs Pegasus 1.2 请求和响应

以下示例展示了如何将 TwelveLabs Pegasus 1.2 模型与不同的输入源结合使用。

Request

以下示例展示了 TwelveLabs Pegasus 1.2 模型的请求格式。

使用 base64 编码的视频:

{ "inputPrompt": "tell me about the video", "mediaSource": { "base64String": "<BASE64 STRING OF VIDEO FILE>" }, "temperature": 0 }

使用 S3 存储的视频:

{ "inputPrompt": "Tell me about this video", "mediaSource": { "s3Location": { "uri": "s3://path-to-video-object-in-s3", "bucketOwner": "bucket-owner-account-id" } }, "temperature": 0 }

使用结构化输出格式:

{ "inputPrompt": "Analyze this video and provide a structured summary", "mediaSource": { "s3Location": { "uri": "s3://path-to-video-object-in-s3", "bucketOwner": "bucket-owner-account-id" } }, "temperature": 0.2, "maxOutputTokens": 2048, "responseFormat": { "type": "json_schema", "json_schema": { "name": "video_analysis", "schema": { "type": "object", "properties": { "summary": {"type": "string"}, "key_scenes": {"type": "array", "items": {"type": "string"}}, "duration": {"type": "string"} }, "required": ["summary", "key_scenes"] } } } }
Response

以下示例展示了来自 TwelveLabs Pegasus 1.2 模型的响应格式。

标准响应:

{ "message": "This video shows a person walking through a park during sunset. The scene includes trees, a walking path, and golden lighting from the setting sun. The person appears to be enjoying a peaceful evening stroll.", "finishReason": "stop" }

带结构化输出的响应:

{ "message": "{\"summary\": \"A peaceful evening walk through a park at sunset\", \"key_scenes\": [\"Person entering the park\", \"Walking along tree-lined path\", \"Sunset lighting through trees\", \"Person sitting on bench\"], \"duration\": \"Approximately 2 minutes\"}", "finishReason": "stop" }

达到最大词元数时的响应:

{ "message": "This video contains multiple scenes showing various activities. The first scene shows...", "finishReason": "length" }