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 小時長的影片 (< 2GB 檔案大小)

TwelveLabs Pegasus 1.2 請求參數

下表說明TwelveLabs Pegasus 1.2模型的輸入參數:

TwelveLabs Pegasus 1.2 請求參數
欄位 類型 必要 描述
inputPrompt string 提示 分析影片。上限:2000 個字符。
temperature double 模型的溫度。控制輸出中的隨機性。預設:0.2,最小值:0,最大值:1。
responseFormat 物件 允許使用者指定結構化輸出格式。目前僅支援 json_schema。
mediaSource object 描述媒體來源。s3Location 必須提供 base64String或 。
mediaSource.base64String string 影片的 Base64 編碼位元組字串。上限:36MB。
mediaSource.s3Location.uri string 可從中下載影片的 S3 URI。上限:1 小時長影片 (< 2GB 檔案大小)。
mediaSource.s3Location.bucketOwner string 儲存貯體擁有者的 AWS 帳戶 ID。
maxOutputTokens integer 要產生的字符數目上限。最大值:4096。

TwelveLabs Pegasus 1.2回應欄位

下表說明TwelveLabs Pegasus 1.2模型的輸出欄位:

TwelveLabs Pegasus 1.2回應欄位
欄位 Type 描述
message string 包含模型的影片分析的輸出訊息。
finishReason string 說明輸出結束原因的停止原因。有效值: 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" }