Titles, topics, and hashtags

Use the /gist endpoint if you require a swift breakdown of the essence of your videos. This endpoint operates exclusively on a set of predefined formats to generate the following:

  • Title: Distills the essence of a video into a brief, coherent phrase, facilitating quick understanding and categorization. For example, a title like "From Consumerism to Minimalism: A Journey Toward Sustainable Living" clearly indicates the video's narrative trajectory, emphasizing themes related to consumption patterns and sustainable lifestyles.
  • Topic: Represents the central themes or subjects of a video and provides a high-level understanding based on the meaning conveyed by all modalities. Topics enable effective categorization and quick referencing. For example, "Shopping Vlog Lifestyle" denotes a video covering aspects related to shopping experiences, vlogging, and the associated lifestyle.
  • Hashtag: Concisely summarizes the themes, subjects, or sentiments expressed within a video. Hashtags improve categorization and searchability on social media platforms. For example, hashtags such as #BlackFriday, #ShoppingMania, and #Consumerism indicate key focal points in a video, potentially related to shopping events, consumer behaviors, or broader commentary on consumption patterns.

For a description of each field in the request and response, see the API Reference > Generate a gist section.

📘

Note:

This endpoint is currently in early beta. Therefore, Twelve Labs recommends you validate the results before relying on them for critical applications. For feedback or suggestions, please use the messenger application at the bottom right corner of the Playground or email us at [email protected].

Depending on your needs, you can generate either a single type of text or multiple types simultaneously with a single API call. Refer to the examples provided below for guidance.

Prerequisites

The examples in this guide assume the following:

  • You’re familiar with the concepts that are described on the Platform overview page.
  • You’ve already created an index and the Pegasus video understanding engine is enabled for this index..
  • You've uploaded a video, and the platform has finished indexing it . The unique identifier of your video is stored in a variable named VIDEO_ID. For details about uploading videos, see the Upload videos page.

Generate a title

The following example generates a title for the specified video:

GIST_URL = f"{API_URL}/gist"

data = {
  "video_id": VIDEO_ID,
  "types": ["title"]
}

response = requests.post(GIST_URL, headers=headers, json=data)
print(f"Status code: {response.status_code}")
pprint(response.json())
const GIST_URL = `${API_URL}/gist`

const data = {
    'video_id': VIDEO_ID,
    'types': ['title']
}

const config = {
    method: 'post',
    url: GIST_URL,
    headers: headers,
    data: data
}
const resp = await axios(config)
const response = await resp.data
console.log(`Status code: ${resp.status}`)
console.log(response)

The output should look similar to the following one:

Status code: 200
{
  "id": "5b3598d7-a925-4d22-9cb0-d97eca89f43e",
  "title": "A Day in My Life: Graduation, Moving Home, Shopping Hauls, Cooking, and Outdoor Adventures!"
}

Generate a title, topic, and hashtag

The following example generates a title, topic, and hashtag for the specified video:

GIST_URL = f"{API_URL}/gist"

data = {
  "video_id": VIDEO_ID,
  "types": ["title", "topic", "hashtag"]
}

response = requests.post(GIST_URL, headers=headers, json=data)
print(f"Status code: {response.status_code}")
pprint(response.json())
const GIST_URL = `${API_URL}/gist`

const data = {
    'video_id': VIDEO_ID,
    'types': ['title', 'topic', 'hashtag']
}

const config = {
    method: 'post',
    url: GIST_URL,
    headers: headers,
    data: data
}
const resp = await axios(config)
const response = await resp.data
console.log(`Status code: ${resp.status}`)
console.log(response)

The output should look similar to the following one:

Status code: 200
{
  "id": "f1adb10c-ebba-4534-8868-b3a1dcb0d148",
  "title": "A Day in My Life: Graduation, Moving Home, Shopping Hauls, Cooking, and Outdoor Adventures!",
  "topics": ["Lifestyle Vlog"],
  "hashtags": [
    "graduation",
    "moving",
    "home",
    "shopping",
    "hauls",
    "cooking",
    "outdoor",
    "adventures",
    "lifestyle",
    "vlog"
  ]
}