TwelveLabs Pegasus 1.2 - Amazon Bedrock

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

TwelveLabs Pegasus 1.2

该TwelveLabs Pegasus 1.2模型提供了全面的视频理解和分析功能。它可以分析视频内容并生成有关视频的文字描述、见解和问题的答案。

使用此信息对带有 InvokeModel、 InvokeModelWithResponseStream (流式传输)操作的 TwelveLabs 模型进行推理调用。

  • 提供商 — TwelveLabs

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

  • 型号编号 — twelvelabs.pegasus-1-2-v1:0

  • 输入模式-视频

  • 输出模式-文本

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

TwelveLabs Pegasus 1.2请求参数

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

TwelveLabs Pegasus 1.2请求参数
字段 类型 必需 描述
inputPrompt 字符串 提示分析视频。上限:2000 个代币。
temperature double 模型的温度。控制输出中的随机性。默认值:0.2,最小值:0,最大值:1。
responseFormat 对象 允许用户指定结构化输出格式。目前仅支持 json_schema。
mediaSource 对象 描述媒体来源。s3Location必须提供base64String或。
mediaSource.base64String 字符串 视频的 Base64 编码字节字符串。最大容量:36MB。
mediaSource.s3Location.uri 字符串 可以从中下载视频的 S3 URI。最大:长达 1 小时的视频(< 2GB 文件大小)。
mediaSource.s3Location.bucketOwner 字符串 存储桶拥有者的 AWS 账户 ID。
maxOutputTokens 整数 要生成的最大代币数量。Max: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" }