

本文為英文版的機器翻譯版本，如內容有任何歧義或不一致之處，概以英文版為準。

# TwelveLabs Pegasus 1.2
<a name="model-parameters-pegasus"></a>

此 TwelveLabs Pegasus 1.2 模型提供全面的影片理解和分析功能。它可以分析影片內容，並產生有關影片問題的文字描述、洞察和答案。

使用此資訊透過 InvokeModel、InvokeModelWithResponseStream (串流) 操作對 TwelveLabs 模型進行推論呼叫。
+ 供應商 — TwelveLabs
+ 類別 — 影片理解、內容分析
+ 模型 ID — `twelvelabs.pegasus-1-2-v1:0`
+ 輸入模式 — 影片
+ 輸出模式 — 文字
+ 影片大小上限 — 1 小時長的影片 (< 2GB 檔案大小)

## TwelveLabs Pegasus 1.2 請求參數
<a name="model-parameters-pegasus-request"></a>

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


**TwelveLabs Pegasus 1.2 請求參數**  

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

## TwelveLabs Pegasus 1.2 回應欄位
<a name="model-parameters-pegasus-response"></a>

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


**TwelveLabs Pegasus 1.2 回應欄位**  

| 欄位 | Type | Description | 
| --- | --- | --- | 
| message | string | 包含模型對影片分析的輸出訊息。 | 
| finishReason | string | 說明為何結束輸出的停止原因。有效值：stop (API 傳回完全完成，但未達到任何限制)、length (產生但超過 max\$1tokens 限制)。 | 

## TwelveLabs Pegasus 1.2 請求與回應
<a name="model-parameters-pegasus-examples"></a>

下列範例示範如何使用具有不同輸入來源的 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"
}
```

------