twelvelabs-js 0.4.10 → 0.4.12
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +31 -8
- package/dist/README.md +31 -8
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -226,7 +226,19 @@ let searchResults = await client.search.query({
|
|
|
226
226
|
|
|
227
227
|
The response is similar to that received when using text queries.
|
|
228
228
|
|
|
229
|
-
###
|
|
229
|
+
### Analyze videos
|
|
230
|
+
|
|
231
|
+
>**NOTE**: The Generate API has been renamed to the Analyze API to more accurately reflect its purpose of analyzing videos to generate text. This update includes changes to specific SDK methods, outlined below. You can continue using the Generate API until July 30, 2025. After this date, the Generate API will be deprecated, and you must transition to the Analyze API.
|
|
232
|
+
>
|
|
233
|
+
>The `generate` prefix has been removed from method names, and the following methods have been renamed as follows:
|
|
234
|
+
>
|
|
235
|
+
>- `generate.gist` is now `gist`
|
|
236
|
+
>- `generate.summarize` is now `summarize`
|
|
237
|
+
>- `generate.text` is now `analyze`
|
|
238
|
+
>- `generate.textStream` is now `analyzeStream`
|
|
239
|
+
>
|
|
240
|
+
>To maintain compatibility, update your applications to use the new names before July 30, 2025.
|
|
241
|
+
|
|
230
242
|
|
|
231
243
|
The Twelve Labs Video Understanding Platform offers three distinct endpoints tailored to meet various requirements. Each endpoint has been designed with specific levels of flexibility and customization to accommodate different needs.
|
|
232
244
|
|
|
@@ -234,32 +246,43 @@ Note the following about using these endpoints:
|
|
|
234
246
|
|
|
235
247
|
- The Pegasus video understanding model must be enabled for the index to which your video has been uploaded.
|
|
236
248
|
- Your prompts must be instructive or descriptive, and you can also phrase them as questions.
|
|
237
|
-
- The maximum length of a prompt is
|
|
249
|
+
- The maximum length of a prompt is 2,000 tokens.
|
|
250
|
+
|
|
251
|
+
#### Titles, topics, and hashtags
|
|
252
|
+
|
|
253
|
+
To analyze videos and generate titles, topics, and hashtags use the example code below, replacing the following:
|
|
254
|
+
|
|
255
|
+
- **`<YOUR_VIDEO_ID>`**: with a string representing the unique identifier of your video.
|
|
256
|
+
|
|
257
|
+
```js
|
|
258
|
+
const res = await client.gist("<YOUR_VIDEO_ID>", ["title", "topic","hashtag"]);
|
|
259
|
+
console.log(`Title: ${res.title}\nTopics=${res.topics}\nHashtags=${res.hashtags}`);
|
|
260
|
+
```
|
|
238
261
|
|
|
239
262
|
#### Summaries, chapters, and highlights
|
|
240
263
|
|
|
241
|
-
To generate summaries, chapters, and highlights, use the example code below, replacing the following:
|
|
264
|
+
To analyze videos and generate summaries, chapters, and highlights, use the example code below, replacing the following:
|
|
242
265
|
|
|
243
266
|
- **`<YOUR_VIDEO_ID>`**: with a string representing the unique identifier of your video.
|
|
244
267
|
- **`<TYPE>`**: with a string representing the type of text the platform should generate. This parameter can take one of the following values: "summary", "chapter", or "highlight".
|
|
245
268
|
- _(Optional)_ **`<YOUR_PROMPT>`**: with a string that provides context for the summarization task, such as the target audience, style, tone of voice, and purpose. Example: "Generate a summary in no more than 5 bullet points."
|
|
246
269
|
|
|
247
270
|
```js
|
|
248
|
-
const summary = await client.
|
|
271
|
+
const summary = await client.summarize('<YOUR_VIDEO_ID>', '<TYPE>');
|
|
249
272
|
console.log(`Summary: ${summary.summary}`);
|
|
250
273
|
```
|
|
251
274
|
|
|
252
|
-
For a description of each field in the request and response, see the [Summaries, chapters, or highlights](https://docs.twelvelabs.io/v1.3/
|
|
275
|
+
For a description of each field in the request and response, see the [Summaries, chapters, or highlights](https://docs.twelvelabs.io/v1.3/api-reference/analyze-videos/summarize) page.
|
|
253
276
|
|
|
254
277
|
#### Open-ended analysis
|
|
255
278
|
|
|
256
|
-
To
|
|
279
|
+
To perform open-ended analysis and generate tailored text outputs based on your prompts, use the example code below, replacing the following:
|
|
257
280
|
|
|
258
281
|
- **`<YOUR_VIDEO_ID>`**: with a string representing the unique identifier of your video.
|
|
259
|
-
- **`<YOUR_PROMPT>`**: with a string that guides the model on the desired format or content. The maximum length of the prompt is
|
|
282
|
+
- **`<YOUR_PROMPT>`**: with a string that guides the model on the desired format or content. The maximum length of the prompt is 2,000 tokens. Example: "I want to generate a description for my video with the following format: Title of the video, followed by a summary in 2-3 sentences, highlighting the main topic, key events, and concluding remarks."
|
|
260
283
|
|
|
261
284
|
```js
|
|
262
|
-
const analysis = await client.
|
|
285
|
+
const analysis = await client.analyze('<YOUR_VIDEO_ID>', '<YOUR_PROMPT>');
|
|
263
286
|
console.log(`Open-ended analysis: ${analysis.data}`);
|
|
264
287
|
```
|
|
265
288
|
|
package/dist/README.md
CHANGED
|
@@ -226,7 +226,19 @@ let searchResults = await client.search.query({
|
|
|
226
226
|
|
|
227
227
|
The response is similar to that received when using text queries.
|
|
228
228
|
|
|
229
|
-
###
|
|
229
|
+
### Analyze videos
|
|
230
|
+
|
|
231
|
+
>**NOTE**: The Generate API has been renamed to the Analyze API to more accurately reflect its purpose of analyzing videos to generate text. This update includes changes to specific SDK methods, outlined below. You can continue using the Generate API until July 30, 2025. After this date, the Generate API will be deprecated, and you must transition to the Analyze API.
|
|
232
|
+
>
|
|
233
|
+
>The `generate` prefix has been removed from method names, and the following methods have been renamed as follows:
|
|
234
|
+
>
|
|
235
|
+
>- `generate.gist` is now `gist`
|
|
236
|
+
>- `generate.summarize` is now `summarize`
|
|
237
|
+
>- `generate.text` is now `analyze`
|
|
238
|
+
>- `generate.textStream` is now `analyzeStream`
|
|
239
|
+
>
|
|
240
|
+
>To maintain compatibility, update your applications to use the new names before July 30, 2025.
|
|
241
|
+
|
|
230
242
|
|
|
231
243
|
The Twelve Labs Video Understanding Platform offers three distinct endpoints tailored to meet various requirements. Each endpoint has been designed with specific levels of flexibility and customization to accommodate different needs.
|
|
232
244
|
|
|
@@ -234,32 +246,43 @@ Note the following about using these endpoints:
|
|
|
234
246
|
|
|
235
247
|
- The Pegasus video understanding model must be enabled for the index to which your video has been uploaded.
|
|
236
248
|
- Your prompts must be instructive or descriptive, and you can also phrase them as questions.
|
|
237
|
-
- The maximum length of a prompt is
|
|
249
|
+
- The maximum length of a prompt is 2,000 tokens.
|
|
250
|
+
|
|
251
|
+
#### Titles, topics, and hashtags
|
|
252
|
+
|
|
253
|
+
To analyze videos and generate titles, topics, and hashtags use the example code below, replacing the following:
|
|
254
|
+
|
|
255
|
+
- **`<YOUR_VIDEO_ID>`**: with a string representing the unique identifier of your video.
|
|
256
|
+
|
|
257
|
+
```js
|
|
258
|
+
const res = await client.gist("<YOUR_VIDEO_ID>", ["title", "topic","hashtag"]);
|
|
259
|
+
console.log(`Title: ${res.title}\nTopics=${res.topics}\nHashtags=${res.hashtags}`);
|
|
260
|
+
```
|
|
238
261
|
|
|
239
262
|
#### Summaries, chapters, and highlights
|
|
240
263
|
|
|
241
|
-
To generate summaries, chapters, and highlights, use the example code below, replacing the following:
|
|
264
|
+
To analyze videos and generate summaries, chapters, and highlights, use the example code below, replacing the following:
|
|
242
265
|
|
|
243
266
|
- **`<YOUR_VIDEO_ID>`**: with a string representing the unique identifier of your video.
|
|
244
267
|
- **`<TYPE>`**: with a string representing the type of text the platform should generate. This parameter can take one of the following values: "summary", "chapter", or "highlight".
|
|
245
268
|
- _(Optional)_ **`<YOUR_PROMPT>`**: with a string that provides context for the summarization task, such as the target audience, style, tone of voice, and purpose. Example: "Generate a summary in no more than 5 bullet points."
|
|
246
269
|
|
|
247
270
|
```js
|
|
248
|
-
const summary = await client.
|
|
271
|
+
const summary = await client.summarize('<YOUR_VIDEO_ID>', '<TYPE>');
|
|
249
272
|
console.log(`Summary: ${summary.summary}`);
|
|
250
273
|
```
|
|
251
274
|
|
|
252
|
-
For a description of each field in the request and response, see the [Summaries, chapters, or highlights](https://docs.twelvelabs.io/v1.3/
|
|
275
|
+
For a description of each field in the request and response, see the [Summaries, chapters, or highlights](https://docs.twelvelabs.io/v1.3/api-reference/analyze-videos/summarize) page.
|
|
253
276
|
|
|
254
277
|
#### Open-ended analysis
|
|
255
278
|
|
|
256
|
-
To
|
|
279
|
+
To perform open-ended analysis and generate tailored text outputs based on your prompts, use the example code below, replacing the following:
|
|
257
280
|
|
|
258
281
|
- **`<YOUR_VIDEO_ID>`**: with a string representing the unique identifier of your video.
|
|
259
|
-
- **`<YOUR_PROMPT>`**: with a string that guides the model on the desired format or content. The maximum length of the prompt is
|
|
282
|
+
- **`<YOUR_PROMPT>`**: with a string that guides the model on the desired format or content. The maximum length of the prompt is 2,000 tokens. Example: "I want to generate a description for my video with the following format: Title of the video, followed by a summary in 2-3 sentences, highlighting the main topic, key events, and concluding remarks."
|
|
260
283
|
|
|
261
284
|
```js
|
|
262
|
-
const analysis = await client.
|
|
285
|
+
const analysis = await client.analyze('<YOUR_VIDEO_ID>', '<YOUR_PROMPT>');
|
|
263
286
|
console.log(`Open-ended analysis: ${analysis.data}`);
|
|
264
287
|
```
|
|
265
288
|
|