twelvelabs-js 1.2.3 → 1.2.4

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.
Files changed (192) hide show
  1. package/Client.d.ts +14 -38
  2. package/Client.js +22 -42
  3. package/api/client/requests/AnalyzeRequest.d.ts +42 -29
  4. package/api/client/requests/AnalyzeStreamRequest.d.ts +42 -29
  5. package/api/resources/analyzeAsync/resources/tasks/client/Client.d.ts +61 -4
  6. package/api/resources/analyzeAsync/resources/tasks/client/Client.js +73 -13
  7. package/api/resources/analyzeAsync/resources/tasks/client/requests/CreateAsyncAnalyzeRequest.d.ts +111 -9
  8. package/api/resources/analyzeAsync/resources/tasks/client/requests/TasksListRequest.d.ts +8 -2
  9. package/api/resources/analyzeAsync/resources/tasks/types/CreateAsyncAnalyzeRequestAnalysisMode.d.ts +7 -2
  10. package/api/resources/analyzeAsync/resources/tasks/types/CreateAsyncAnalyzeRequestAnalysisMode.js +1 -0
  11. package/api/resources/analyzeAsync/resources/tasks/types/CreateAsyncAnalyzeRequestModelName.d.ts +4 -2
  12. package/api/resources/analyzeAsync/resources/tasks/types/TasksListRequestAnalysisMode.d.ts +2 -1
  13. package/api/resources/analyzeAsync/resources/tasks/types/TasksListRequestAnalysisMode.js +1 -0
  14. package/api/resources/assets/client/Client.d.ts +4 -1
  15. package/api/resources/assets/client/Client.js +12 -9
  16. package/api/resources/assets/client/requests/AssetsCreateRequest.d.ts +1 -1
  17. package/api/resources/embed/client/Client.js +2 -2
  18. package/api/resources/embed/resources/tasks/client/Client.js +8 -8
  19. package/api/resources/embed/resources/v2/client/Client.js +2 -2
  20. package/api/resources/embed/resources/v2/resources/tasks/client/Client.d.ts +1 -1
  21. package/api/resources/embed/resources/v2/resources/tasks/client/Client.js +7 -7
  22. package/api/resources/entityCollections/client/Client.js +10 -10
  23. package/api/resources/entityCollections/resources/entities/client/Client.js +18 -18
  24. package/api/resources/indexes/client/Client.js +10 -10
  25. package/api/resources/indexes/resources/indexedAssets/client/Client.js +12 -12
  26. package/api/resources/indexes/resources/videos/client/Client.js +8 -8
  27. package/api/resources/multipartUpload/client/Client.d.ts +2 -2
  28. package/api/resources/multipartUpload/client/Client.js +12 -12
  29. package/api/resources/search/client/Client.js +4 -4
  30. package/api/resources/tasks/client/Client.js +8 -8
  31. package/api/resources/tasks/resources/transfers/client/Client.js +6 -6
  32. package/api/types/AnalyzePromptV2.d.ts +13 -0
  33. package/api/types/AnalyzePromptV2.js +5 -0
  34. package/api/types/AnalyzeRequestModelName.d.ts +15 -0
  35. package/api/types/AnalyzeRequestModelName.js +10 -0
  36. package/api/types/AnalyzeStreamRequestModelName.d.ts +15 -0
  37. package/api/types/AnalyzeStreamRequestModelName.js +10 -0
  38. package/api/types/AnalyzeTaskResponse.d.ts +3 -1
  39. package/api/types/AnalyzeTaskResponseRequestParams.d.ts +20 -2
  40. package/api/types/AnalyzeTaskResponseRequestParamsPromptV2.d.ts +16 -0
  41. package/api/types/AnalyzeTaskResponseRequestParamsPromptV2.js +5 -0
  42. package/api/types/AnalyzeTaskResponseRequestParamsPromptV2MediaSourcesItem.d.ts +11 -0
  43. package/api/types/AnalyzeTaskResponseRequestParamsPromptV2MediaSourcesItem.js +5 -0
  44. package/api/types/AnalyzeTaskResponseRequestParamsResponseFormat.d.ts +14 -1
  45. package/api/types/AnalyzeTaskResponseRequestParamsResponseFormatSegmentDefinitionsItem.d.ts +2 -0
  46. package/api/types/AnalyzeTaskResponseVideoSource.d.ts +2 -0
  47. package/api/types/AnalyzeTaskResultUsage.d.ts +1 -1
  48. package/api/types/AnalyzeTimeRange.d.ts +12 -0
  49. package/api/types/AnalyzeTimeRange.js +5 -0
  50. package/api/types/AsyncResponseFormat.d.ts +34 -6
  51. package/api/types/SegmentDefinition.d.ts +11 -0
  52. package/api/types/SyncResponseFormat.d.ts +25 -6
  53. package/api/types/TokenUsage.d.ts +3 -1
  54. package/api/types/index.d.ts +6 -0
  55. package/api/types/index.js +6 -0
  56. package/dist/Client.d.ts +14 -38
  57. package/dist/Client.js +22 -42
  58. package/dist/api/client/requests/AnalyzeRequest.d.ts +42 -29
  59. package/dist/api/client/requests/AnalyzeStreamRequest.d.ts +42 -29
  60. package/dist/api/resources/analyzeAsync/resources/tasks/client/Client.d.ts +61 -4
  61. package/dist/api/resources/analyzeAsync/resources/tasks/client/Client.js +73 -13
  62. package/dist/api/resources/analyzeAsync/resources/tasks/client/requests/CreateAsyncAnalyzeRequest.d.ts +111 -9
  63. package/dist/api/resources/analyzeAsync/resources/tasks/client/requests/TasksListRequest.d.ts +8 -2
  64. package/dist/api/resources/analyzeAsync/resources/tasks/types/CreateAsyncAnalyzeRequestAnalysisMode.d.ts +7 -2
  65. package/dist/api/resources/analyzeAsync/resources/tasks/types/CreateAsyncAnalyzeRequestAnalysisMode.js +1 -0
  66. package/dist/api/resources/analyzeAsync/resources/tasks/types/CreateAsyncAnalyzeRequestModelName.d.ts +4 -2
  67. package/dist/api/resources/analyzeAsync/resources/tasks/types/TasksListRequestAnalysisMode.d.ts +2 -1
  68. package/dist/api/resources/analyzeAsync/resources/tasks/types/TasksListRequestAnalysisMode.js +1 -0
  69. package/dist/api/resources/assets/client/Client.d.ts +4 -1
  70. package/dist/api/resources/assets/client/Client.js +12 -9
  71. package/dist/api/resources/assets/client/requests/AssetsCreateRequest.d.ts +1 -1
  72. package/dist/api/resources/embed/client/Client.js +2 -2
  73. package/dist/api/resources/embed/resources/tasks/client/Client.js +8 -8
  74. package/dist/api/resources/embed/resources/v2/client/Client.js +2 -2
  75. package/dist/api/resources/embed/resources/v2/resources/tasks/client/Client.d.ts +1 -1
  76. package/dist/api/resources/embed/resources/v2/resources/tasks/client/Client.js +7 -7
  77. package/dist/api/resources/entityCollections/client/Client.js +10 -10
  78. package/dist/api/resources/entityCollections/resources/entities/client/Client.js +18 -18
  79. package/dist/api/resources/indexes/client/Client.js +10 -10
  80. package/dist/api/resources/indexes/resources/indexedAssets/client/Client.js +12 -12
  81. package/dist/api/resources/indexes/resources/videos/client/Client.js +8 -8
  82. package/dist/api/resources/multipartUpload/client/Client.d.ts +2 -2
  83. package/dist/api/resources/multipartUpload/client/Client.js +12 -12
  84. package/dist/api/resources/search/client/Client.js +4 -4
  85. package/dist/api/resources/tasks/client/Client.js +8 -8
  86. package/dist/api/resources/tasks/resources/transfers/client/Client.js +6 -6
  87. package/dist/api/types/AnalyzePromptV2.d.ts +13 -0
  88. package/dist/api/types/AnalyzePromptV2.js +5 -0
  89. package/dist/api/types/AnalyzeRequestModelName.d.ts +15 -0
  90. package/dist/api/types/AnalyzeRequestModelName.js +10 -0
  91. package/dist/api/types/AnalyzeStreamRequestModelName.d.ts +15 -0
  92. package/dist/api/types/AnalyzeStreamRequestModelName.js +10 -0
  93. package/dist/api/types/AnalyzeTaskResponse.d.ts +3 -1
  94. package/dist/api/types/AnalyzeTaskResponseRequestParams.d.ts +20 -2
  95. package/dist/api/types/AnalyzeTaskResponseRequestParamsPromptV2.d.ts +16 -0
  96. package/dist/api/types/AnalyzeTaskResponseRequestParamsPromptV2.js +5 -0
  97. package/dist/api/types/AnalyzeTaskResponseRequestParamsPromptV2MediaSourcesItem.d.ts +11 -0
  98. package/dist/api/types/AnalyzeTaskResponseRequestParamsPromptV2MediaSourcesItem.js +5 -0
  99. package/dist/api/types/AnalyzeTaskResponseRequestParamsResponseFormat.d.ts +14 -1
  100. package/dist/api/types/AnalyzeTaskResponseRequestParamsResponseFormatSegmentDefinitionsItem.d.ts +2 -0
  101. package/dist/api/types/AnalyzeTaskResponseVideoSource.d.ts +2 -0
  102. package/dist/api/types/AnalyzeTaskResultUsage.d.ts +1 -1
  103. package/dist/api/types/AnalyzeTimeRange.d.ts +12 -0
  104. package/dist/api/types/AnalyzeTimeRange.js +5 -0
  105. package/dist/api/types/AsyncResponseFormat.d.ts +34 -6
  106. package/dist/api/types/SegmentDefinition.d.ts +11 -0
  107. package/dist/api/types/SyncResponseFormat.d.ts +25 -6
  108. package/dist/api/types/TokenUsage.d.ts +3 -1
  109. package/dist/api/types/index.d.ts +6 -0
  110. package/dist/api/types/index.js +6 -0
  111. package/dist/serialization/client/requests/AnalyzeRequest.d.ts +8 -3
  112. package/dist/serialization/client/requests/AnalyzeRequest.js +8 -3
  113. package/dist/serialization/client/requests/AnalyzeStreamRequest.d.ts +8 -3
  114. package/dist/serialization/client/requests/AnalyzeStreamRequest.js +8 -3
  115. package/dist/serialization/resources/analyzeAsync/resources/tasks/client/requests/CreateAsyncAnalyzeRequest.d.ts +5 -0
  116. package/dist/serialization/resources/analyzeAsync/resources/tasks/client/requests/CreateAsyncAnalyzeRequest.js +5 -0
  117. package/dist/serialization/resources/analyzeAsync/resources/tasks/types/CreateAsyncAnalyzeRequestAnalysisMode.d.ts +1 -1
  118. package/dist/serialization/resources/analyzeAsync/resources/tasks/types/CreateAsyncAnalyzeRequestAnalysisMode.js +1 -1
  119. package/dist/serialization/resources/analyzeAsync/resources/tasks/types/TasksListRequestAnalysisMode.d.ts +1 -1
  120. package/dist/serialization/resources/analyzeAsync/resources/tasks/types/TasksListRequestAnalysisMode.js +1 -1
  121. package/dist/serialization/types/AnalyzePromptV2.d.ts +14 -0
  122. package/dist/serialization/types/AnalyzePromptV2.js +45 -0
  123. package/dist/serialization/types/AnalyzeRequestModelName.d.ts +10 -0
  124. package/dist/serialization/types/AnalyzeRequestModelName.js +41 -0
  125. package/dist/serialization/types/AnalyzeStreamRequestModelName.d.ts +10 -0
  126. package/dist/serialization/types/AnalyzeStreamRequestModelName.js +41 -0
  127. package/dist/serialization/types/AnalyzeTaskResponse.d.ts +1 -0
  128. package/dist/serialization/types/AnalyzeTaskResponse.js +1 -0
  129. package/dist/serialization/types/AnalyzeTaskResponseRequestParams.d.ts +5 -0
  130. package/dist/serialization/types/AnalyzeTaskResponseRequestParams.js +5 -0
  131. package/dist/serialization/types/AnalyzeTaskResponseRequestParamsPromptV2.d.ts +14 -0
  132. package/dist/serialization/types/AnalyzeTaskResponseRequestParamsPromptV2.js +45 -0
  133. package/dist/serialization/types/AnalyzeTaskResponseRequestParamsPromptV2MediaSourcesItem.d.ts +15 -0
  134. package/dist/serialization/types/AnalyzeTaskResponseRequestParamsPromptV2MediaSourcesItem.js +46 -0
  135. package/dist/serialization/types/AnalyzeTaskResponseRequestParamsResponseFormat.d.ts +1 -0
  136. package/dist/serialization/types/AnalyzeTaskResponseRequestParamsResponseFormat.js +1 -0
  137. package/dist/serialization/types/AnalyzeTaskResponseRequestParamsResponseFormatSegmentDefinitionsItem.d.ts +2 -0
  138. package/dist/serialization/types/AnalyzeTaskResponseRequestParamsResponseFormatSegmentDefinitionsItem.js +2 -0
  139. package/dist/serialization/types/AnalyzeTaskResponseVideoSource.d.ts +1 -0
  140. package/dist/serialization/types/AnalyzeTaskResponseVideoSource.js +1 -0
  141. package/dist/serialization/types/AnalyzeTimeRange.d.ts +13 -0
  142. package/dist/serialization/types/AnalyzeTimeRange.js +44 -0
  143. package/dist/serialization/types/SegmentDefinition.d.ts +2 -0
  144. package/dist/serialization/types/SegmentDefinition.js +2 -0
  145. package/dist/serialization/types/TokenUsage.d.ts +2 -1
  146. package/dist/serialization/types/TokenUsage.js +2 -1
  147. package/dist/serialization/types/index.d.ts +6 -0
  148. package/dist/serialization/types/index.js +6 -0
  149. package/dist/version.d.ts +1 -1
  150. package/dist/version.js +1 -1
  151. package/package.json +1 -1
  152. package/reference.md +21 -40
  153. package/serialization/client/requests/AnalyzeRequest.d.ts +8 -3
  154. package/serialization/client/requests/AnalyzeRequest.js +8 -3
  155. package/serialization/client/requests/AnalyzeStreamRequest.d.ts +8 -3
  156. package/serialization/client/requests/AnalyzeStreamRequest.js +8 -3
  157. package/serialization/resources/analyzeAsync/resources/tasks/client/requests/CreateAsyncAnalyzeRequest.d.ts +5 -0
  158. package/serialization/resources/analyzeAsync/resources/tasks/client/requests/CreateAsyncAnalyzeRequest.js +5 -0
  159. package/serialization/resources/analyzeAsync/resources/tasks/types/CreateAsyncAnalyzeRequestAnalysisMode.d.ts +1 -1
  160. package/serialization/resources/analyzeAsync/resources/tasks/types/CreateAsyncAnalyzeRequestAnalysisMode.js +1 -1
  161. package/serialization/resources/analyzeAsync/resources/tasks/types/TasksListRequestAnalysisMode.d.ts +1 -1
  162. package/serialization/resources/analyzeAsync/resources/tasks/types/TasksListRequestAnalysisMode.js +1 -1
  163. package/serialization/types/AnalyzePromptV2.d.ts +14 -0
  164. package/serialization/types/AnalyzePromptV2.js +45 -0
  165. package/serialization/types/AnalyzeRequestModelName.d.ts +10 -0
  166. package/serialization/types/AnalyzeRequestModelName.js +41 -0
  167. package/serialization/types/AnalyzeStreamRequestModelName.d.ts +10 -0
  168. package/serialization/types/AnalyzeStreamRequestModelName.js +41 -0
  169. package/serialization/types/AnalyzeTaskResponse.d.ts +1 -0
  170. package/serialization/types/AnalyzeTaskResponse.js +1 -0
  171. package/serialization/types/AnalyzeTaskResponseRequestParams.d.ts +5 -0
  172. package/serialization/types/AnalyzeTaskResponseRequestParams.js +5 -0
  173. package/serialization/types/AnalyzeTaskResponseRequestParamsPromptV2.d.ts +14 -0
  174. package/serialization/types/AnalyzeTaskResponseRequestParamsPromptV2.js +45 -0
  175. package/serialization/types/AnalyzeTaskResponseRequestParamsPromptV2MediaSourcesItem.d.ts +15 -0
  176. package/serialization/types/AnalyzeTaskResponseRequestParamsPromptV2MediaSourcesItem.js +46 -0
  177. package/serialization/types/AnalyzeTaskResponseRequestParamsResponseFormat.d.ts +1 -0
  178. package/serialization/types/AnalyzeTaskResponseRequestParamsResponseFormat.js +1 -0
  179. package/serialization/types/AnalyzeTaskResponseRequestParamsResponseFormatSegmentDefinitionsItem.d.ts +2 -0
  180. package/serialization/types/AnalyzeTaskResponseRequestParamsResponseFormatSegmentDefinitionsItem.js +2 -0
  181. package/serialization/types/AnalyzeTaskResponseVideoSource.d.ts +1 -0
  182. package/serialization/types/AnalyzeTaskResponseVideoSource.js +1 -0
  183. package/serialization/types/AnalyzeTimeRange.d.ts +13 -0
  184. package/serialization/types/AnalyzeTimeRange.js +44 -0
  185. package/serialization/types/SegmentDefinition.d.ts +2 -0
  186. package/serialization/types/SegmentDefinition.js +2 -0
  187. package/serialization/types/TokenUsage.d.ts +2 -1
  188. package/serialization/types/TokenUsage.js +2 -1
  189. package/serialization/types/index.d.ts +6 -0
  190. package/serialization/types/index.js +6 -0
  191. package/version.d.ts +1 -1
  192. package/version.js +1 -1
package/Client.d.ts CHANGED
@@ -50,7 +50,7 @@ export declare class TwelvelabsApiClient {
50
50
  get search(): Search;
51
51
  get analyzeAsync(): AnalyzeAsync;
52
52
  /**
53
- * This method synchronously analyzes your videos and generates fully customizable text based on your prompts.
53
+ * This method analyzes your videos and returns the results directly in the response. It generates text based on your prompts and supports both Pegasus 1.2 and Pegasus 1.5 for general analysis (prompt-based text generation).
54
54
  *
55
55
  * <Accordion title="Input requirements">
56
56
  * - Minimum duration: 4 seconds
@@ -62,21 +62,21 @@ export declare class TwelvelabsApiClient {
62
62
  *
63
63
  * **When to use this method**:
64
64
  * - Analyze videos up to 1 hour
65
- * - Retrieve immediate results without waiting for asynchronous processing
66
- * - Stream text fragments in real-time for immediate processing and feedback
65
+ * - Retrieve immediate results without polling for task completion
66
+ * - Stream text fragments in real time for immediate processing and feedback
67
67
  *
68
68
  * **Do not use this method for**:
69
69
  * - Videos longer than 1 hour. Use the [`POST`](/v1.3/api-reference/analyze-videos/create-async-analysis-task) method of the `/analyze/tasks` endpoint instead.
70
- * - Video segmentation. Use the [`POST`](/v1.3/api-reference/analyze-videos/create-async-analysis-task) method of the `/analyze/tasks` endpoint with `model_name` set to `pegasus1.5` instead.
70
+ * - Video segmentation with custom segment definitions. Use the [`POST`](/v1.3/api-reference/analyze-videos/create-async-analysis-task) method of the `/analyze/tasks` endpoint with the `model_name` parameter set to `pegasus1.5` instead.
71
71
  *
72
- * <Note title="Notes">
73
- * - This endpoint is rate-limited. For details, see the [Rate limits](/v1.3/docs/get-started/rate-limits) page.
72
+ * <Note title="Note">
73
+ * This endpoint is rate-limited. For details, see the [Rate limits](/v1.3/docs/get-started/rate-limits) page.
74
74
  * </Note>
75
75
  */
76
76
  analyzeStream(request: TwelvelabsApi.AnalyzeStreamRequest, requestOptions?: TwelvelabsApiClient.RequestOptions): core.HttpResponsePromise<core.Stream<TwelvelabsApi.StreamAnalyzeResponse>>;
77
77
  private __analyzeStream;
78
78
  /**
79
- * This method synchronously analyzes your videos and generates fully customizable text based on your prompts.
79
+ * This method analyzes your videos and returns the results directly in the response. It generates text based on your prompts and supports both Pegasus 1.2 and Pegasus 1.5 for general analysis (prompt-based text generation).
80
80
  *
81
81
  * <Accordion title="Input requirements">
82
82
  * - Minimum duration: 4 seconds
@@ -88,50 +88,26 @@ export declare class TwelvelabsApiClient {
88
88
  *
89
89
  * **When to use this method**:
90
90
  * - Analyze videos up to 1 hour
91
- * - Retrieve immediate results without waiting for asynchronous processing
92
- * - Stream text fragments in real-time for immediate processing and feedback
91
+ * - Retrieve immediate results without polling for task completion
92
+ * - Stream text fragments in real time for immediate processing and feedback
93
93
  *
94
94
  * **Do not use this method for**:
95
95
  * - Videos longer than 1 hour. Use the [`POST`](/v1.3/api-reference/analyze-videos/create-async-analysis-task) method of the `/analyze/tasks` endpoint instead.
96
- * - Video segmentation. Use the [`POST`](/v1.3/api-reference/analyze-videos/create-async-analysis-task) method of the `/analyze/tasks` endpoint with `model_name` set to `pegasus1.5` instead.
96
+ * - Video segmentation with custom segment definitions. Use the [`POST`](/v1.3/api-reference/analyze-videos/create-async-analysis-task) method of the `/analyze/tasks` endpoint with the `model_name` parameter set to `pegasus1.5` instead.
97
97
  *
98
- * <Note title="Notes">
99
- * - This endpoint is rate-limited. For details, see the [Rate limits](/v1.3/docs/get-started/rate-limits) page.
98
+ * <Note title="Note">
99
+ * This endpoint is rate-limited. For details, see the [Rate limits](/v1.3/docs/get-started/rate-limits) page.
100
100
  * </Note>
101
101
  *
102
102
  * @param {TwelvelabsApi.AnalyzeRequest} request
103
103
  * @param {TwelvelabsApiClient.RequestOptions} requestOptions - Request-specific configuration.
104
104
  *
105
105
  * @throws {@link TwelvelabsApi.BadRequestError}
106
+ * @throws {@link TwelvelabsApi.NotFoundError}
106
107
  * @throws {@link TwelvelabsApi.TooManyRequestsError}
107
108
  *
108
109
  * @example
109
- * await client.analyze({
110
- * videoId: "6298d673f1090f1100476d4c",
111
- * prompt: "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.",
112
- * temperature: 0.2,
113
- * responseFormat: {
114
- * type: "json_schema",
115
- * jsonSchema: {
116
- * "type": "object",
117
- * "properties": {
118
- * "title": {
119
- * "type": "string"
120
- * },
121
- * "summary": {
122
- * "type": "string"
123
- * },
124
- * "keywords": {
125
- * "type": "array",
126
- * "items": {
127
- * "type": "string"
128
- * }
129
- * }
130
- * }
131
- * }
132
- * },
133
- * maxTokens: 2000
134
- * })
110
+ * await client.analyze({})
135
111
  */
136
112
  analyze(request: TwelvelabsApi.AnalyzeRequest, requestOptions?: TwelvelabsApiClient.RequestOptions): core.HttpResponsePromise<TwelvelabsApi.NonStreamAnalyzeResponse>;
137
113
  private __analyze;
package/Client.js CHANGED
@@ -100,7 +100,7 @@ class TwelvelabsApiClient {
100
100
  return ((_a = this._analyzeAsync) !== null && _a !== void 0 ? _a : (this._analyzeAsync = new Client_8.AnalyzeAsync(this._options)));
101
101
  }
102
102
  /**
103
- * This method synchronously analyzes your videos and generates fully customizable text based on your prompts.
103
+ * This method analyzes your videos and returns the results directly in the response. It generates text based on your prompts and supports both Pegasus 1.2 and Pegasus 1.5 for general analysis (prompt-based text generation).
104
104
  *
105
105
  * <Accordion title="Input requirements">
106
106
  * - Minimum duration: 4 seconds
@@ -112,15 +112,15 @@ class TwelvelabsApiClient {
112
112
  *
113
113
  * **When to use this method**:
114
114
  * - Analyze videos up to 1 hour
115
- * - Retrieve immediate results without waiting for asynchronous processing
116
- * - Stream text fragments in real-time for immediate processing and feedback
115
+ * - Retrieve immediate results without polling for task completion
116
+ * - Stream text fragments in real time for immediate processing and feedback
117
117
  *
118
118
  * **Do not use this method for**:
119
119
  * - Videos longer than 1 hour. Use the [`POST`](/v1.3/api-reference/analyze-videos/create-async-analysis-task) method of the `/analyze/tasks` endpoint instead.
120
- * - Video segmentation. Use the [`POST`](/v1.3/api-reference/analyze-videos/create-async-analysis-task) method of the `/analyze/tasks` endpoint with `model_name` set to `pegasus1.5` instead.
120
+ * - Video segmentation with custom segment definitions. Use the [`POST`](/v1.3/api-reference/analyze-videos/create-async-analysis-task) method of the `/analyze/tasks` endpoint with the `model_name` parameter set to `pegasus1.5` instead.
121
121
  *
122
- * <Note title="Notes">
123
- * - This endpoint is rate-limited. For details, see the [Rate limits](/v1.3/docs/get-started/rate-limits) page.
122
+ * <Note title="Note">
123
+ * This endpoint is rate-limited. For details, see the [Rate limits](/v1.3/docs/get-started/rate-limits) page.
124
124
  * </Note>
125
125
  */
126
126
  analyzeStream(request, requestOptions) {
@@ -132,12 +132,12 @@ class TwelvelabsApiClient {
132
132
  const _response = yield core.fetcher({
133
133
  url: (0, url_join_1.default)((_b = (_a = (yield core.Supplier.get(this._options.baseUrl))) !== null && _a !== void 0 ? _a : (yield core.Supplier.get(this._options.environment))) !== null && _b !== void 0 ? _b : environments.TwelvelabsApiEnvironment.Default, "analyze"),
134
134
  method: "POST",
135
- headers: Object.assign(Object.assign({ "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "twelvelabs-js", "X-Fern-SDK-Version": "1.2.3", "User-Agent": "twelvelabs-js/1.2.3", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, (yield this._getCustomAuthorizationHeaders())), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
135
+ headers: Object.assign(Object.assign({ "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "twelvelabs-js", "X-Fern-SDK-Version": "1.2.4", "User-Agent": "twelvelabs-js/1.2.4", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, (yield this._getCustomAuthorizationHeaders())), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
136
136
  contentType: "application/json",
137
137
  requestType: "json",
138
138
  body: Object.assign(Object.assign({}, serializers.AnalyzeStreamRequest.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" })), { stream: true }),
139
139
  responseType: "sse",
140
- timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
140
+ timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 600000,
141
141
  maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
142
142
  abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
143
143
  });
@@ -166,6 +166,8 @@ class TwelvelabsApiClient {
166
166
  switch (_response.error.statusCode) {
167
167
  case 400:
168
168
  throw new TwelvelabsApi.BadRequestError(_response.error.body, _response.rawResponse);
169
+ case 404:
170
+ throw new TwelvelabsApi.NotFoundError(_response.error.body, _response.rawResponse);
169
171
  case 429:
170
172
  throw new TwelvelabsApi.TooManyRequestsError(_response.error.body, _response.rawResponse);
171
173
  default:
@@ -194,7 +196,7 @@ class TwelvelabsApiClient {
194
196
  });
195
197
  }
196
198
  /**
197
- * This method synchronously analyzes your videos and generates fully customizable text based on your prompts.
199
+ * This method analyzes your videos and returns the results directly in the response. It generates text based on your prompts and supports both Pegasus 1.2 and Pegasus 1.5 for general analysis (prompt-based text generation).
198
200
  *
199
201
  * <Accordion title="Input requirements">
200
202
  * - Minimum duration: 4 seconds
@@ -206,50 +208,26 @@ class TwelvelabsApiClient {
206
208
  *
207
209
  * **When to use this method**:
208
210
  * - Analyze videos up to 1 hour
209
- * - Retrieve immediate results without waiting for asynchronous processing
210
- * - Stream text fragments in real-time for immediate processing and feedback
211
+ * - Retrieve immediate results without polling for task completion
212
+ * - Stream text fragments in real time for immediate processing and feedback
211
213
  *
212
214
  * **Do not use this method for**:
213
215
  * - Videos longer than 1 hour. Use the [`POST`](/v1.3/api-reference/analyze-videos/create-async-analysis-task) method of the `/analyze/tasks` endpoint instead.
214
- * - Video segmentation. Use the [`POST`](/v1.3/api-reference/analyze-videos/create-async-analysis-task) method of the `/analyze/tasks` endpoint with `model_name` set to `pegasus1.5` instead.
216
+ * - Video segmentation with custom segment definitions. Use the [`POST`](/v1.3/api-reference/analyze-videos/create-async-analysis-task) method of the `/analyze/tasks` endpoint with the `model_name` parameter set to `pegasus1.5` instead.
215
217
  *
216
- * <Note title="Notes">
217
- * - This endpoint is rate-limited. For details, see the [Rate limits](/v1.3/docs/get-started/rate-limits) page.
218
+ * <Note title="Note">
219
+ * This endpoint is rate-limited. For details, see the [Rate limits](/v1.3/docs/get-started/rate-limits) page.
218
220
  * </Note>
219
221
  *
220
222
  * @param {TwelvelabsApi.AnalyzeRequest} request
221
223
  * @param {TwelvelabsApiClient.RequestOptions} requestOptions - Request-specific configuration.
222
224
  *
223
225
  * @throws {@link TwelvelabsApi.BadRequestError}
226
+ * @throws {@link TwelvelabsApi.NotFoundError}
224
227
  * @throws {@link TwelvelabsApi.TooManyRequestsError}
225
228
  *
226
229
  * @example
227
- * await client.analyze({
228
- * videoId: "6298d673f1090f1100476d4c",
229
- * prompt: "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.",
230
- * temperature: 0.2,
231
- * responseFormat: {
232
- * type: "json_schema",
233
- * jsonSchema: {
234
- * "type": "object",
235
- * "properties": {
236
- * "title": {
237
- * "type": "string"
238
- * },
239
- * "summary": {
240
- * "type": "string"
241
- * },
242
- * "keywords": {
243
- * "type": "array",
244
- * "items": {
245
- * "type": "string"
246
- * }
247
- * }
248
- * }
249
- * }
250
- * },
251
- * maxTokens: 2000
252
- * })
230
+ * await client.analyze({})
253
231
  */
254
232
  analyze(request, requestOptions) {
255
233
  return core.HttpResponsePromise.fromPromise(this.__analyze(request, requestOptions));
@@ -260,11 +238,11 @@ class TwelvelabsApiClient {
260
238
  const _response = yield core.fetcher({
261
239
  url: (0, url_join_1.default)((_b = (_a = (yield core.Supplier.get(this._options.baseUrl))) !== null && _a !== void 0 ? _a : (yield core.Supplier.get(this._options.environment))) !== null && _b !== void 0 ? _b : environments.TwelvelabsApiEnvironment.Default, "analyze"),
262
240
  method: "POST",
263
- headers: Object.assign(Object.assign({ "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "twelvelabs-js", "X-Fern-SDK-Version": "1.2.3", "User-Agent": "twelvelabs-js/1.2.3", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, (yield this._getCustomAuthorizationHeaders())), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
241
+ headers: Object.assign(Object.assign({ "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "twelvelabs-js", "X-Fern-SDK-Version": "1.2.4", "User-Agent": "twelvelabs-js/1.2.4", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, (yield this._getCustomAuthorizationHeaders())), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
264
242
  contentType: "application/json",
265
243
  requestType: "json",
266
244
  body: Object.assign(Object.assign({}, serializers.AnalyzeRequest.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" })), { stream: false }),
267
- timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
245
+ timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 600000,
268
246
  maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
269
247
  abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
270
248
  });
@@ -283,6 +261,8 @@ class TwelvelabsApiClient {
283
261
  switch (_response.error.statusCode) {
284
262
  case 400:
285
263
  throw new TwelvelabsApi.BadRequestError(_response.error.body, _response.rawResponse);
264
+ case 404:
265
+ throw new TwelvelabsApi.NotFoundError(_response.error.body, _response.rawResponse);
286
266
  case 429:
287
267
  throw new TwelvelabsApi.TooManyRequestsError(_response.error.body, _response.rawResponse);
288
268
  default:
@@ -4,43 +4,56 @@
4
4
  import * as TwelvelabsApi from "../../index";
5
5
  /**
6
6
  * @example
7
- * {
8
- * videoId: "6298d673f1090f1100476d4c",
9
- * prompt: "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.",
10
- * temperature: 0.2,
11
- * responseFormat: {
12
- * type: "json_schema",
13
- * jsonSchema: {
14
- * "type": "object",
15
- * "properties": {
16
- * "title": {
17
- * "type": "string"
18
- * },
19
- * "summary": {
20
- * "type": "string"
21
- * },
22
- * "keywords": {
23
- * "type": "array",
24
- * "items": {
25
- * "type": "string"
26
- * }
27
- * }
28
- * }
29
- * }
30
- * },
31
- * maxTokens: 2000
32
- * }
7
+ * {}
33
8
  */
34
9
  export interface AnalyzeRequest {
35
10
  /**
36
- * The unique identifier of the video to analyze.
11
+ * The video understanding model to use for analysis.
12
+ * - `pegasus1.2`: General analysis (prompt-based text generation).
13
+ * - `pegasus1.5`: General analysis (prompt-based text generation) with video clipping, structured prompts with reference images, extended token limits, and video segmentation (async only). Does not support `analysis_mode=time_based_metadata` or `response_format.type=segment_definitions` — use the [`POST`](/v1.3/api-reference/analyze-videos/create-async-analysis-task) method of the `/analyze/tasks` endpoint instead.
14
+ *
15
+ * **Default:** `pegasus1.2`
16
+ */
17
+ modelName?: TwelvelabsApi.AnalyzeRequestModelName;
18
+ /**
19
+ * The unique identifier of the video to analyze. Use this parameter when the `model_name` parameter is `pegasus1.2`. Not supported with `pegasus1.5`.
37
20
  *
38
21
  * <Info> This parameter will be deprecated and removed in a future version. Use the [`video`](/v1.3/api-reference/analyze-videos/sync-analysis#request.body.video) parameter instead.</Info>
39
22
  */
40
23
  videoId?: string;
41
24
  video?: TwelvelabsApi.VideoContext;
42
- prompt: TwelvelabsApi.AnalyzeTextPrompt;
25
+ /** A text prompt that guides the model on the desired format or content. Works with both Pegasus 1.2 and Pegasus 1.5. To include reference images in your prompt, use the `prompt_v2` parameter instead (Pegasus 1.5 only). Mutually exclusive with the `prompt_v2` parameter. */
26
+ prompt?: TwelvelabsApi.AnalyzeTextPrompt;
27
+ /** A structured prompt with `<@name>` placeholders for referencing images. Requires the `model_name` parameter set to `pegasus1.5`. Mutually exclusive with the `prompt` parameter. */
28
+ promptV2?: TwelvelabsApi.AnalyzePromptV2;
43
29
  temperature?: TwelvelabsApi.AnalyzeTemperature;
30
+ /** Specifies the format of the response. When you omit this parameter, the platform returns unstructured text. Only the `json_schema` type is supported for synchronous analysis. */
44
31
  responseFormat?: TwelvelabsApi.SyncResponseFormat;
45
- maxTokens?: TwelvelabsApi.AnalyzeMaxTokens;
32
+ /**
33
+ * The maximum number of tokens to generate. The allowed range depends on the model:
34
+ *
35
+ * | Model | Min | Max | Default |
36
+ * |-------|-----|-----|---------|
37
+ * | Pegasus 1.2 | 1 | 4,096 | 4,096 |
38
+ * | Pegasus 1.5 | 512 | 65,536 | 4,096 |
39
+ */
40
+ maxTokens?: number;
41
+ /**
42
+ * Start of the analysis window, in seconds. Use with `end_time` to analyze only a portion of the video. Requires `model_name` set to `pegasus1.5`.
43
+ *
44
+ * <Note title="Notes">
45
+ * - If omitted, defaults to `0`.
46
+ * - Must be less than `end_time` and less than the video duration. The clip (`end_time - start_time`) must be at least `4` seconds.
47
+ * </Note>
48
+ */
49
+ startTime?: number;
50
+ /**
51
+ * End of the analysis window, in seconds. Use with `start_time` to analyze only a portion of the video. Requires `model_name` set to `pegasus1.5`.
52
+ *
53
+ * <Note title="Notes">
54
+ * - If omitted, defaults to the video duration.
55
+ * - Must be greater than `start_time` and less than or equal to the video duration. The clip (`end_time - start_time`) must be at least `4` seconds.
56
+ * </Note>
57
+ */
58
+ endTime?: number;
46
59
  }
@@ -4,43 +4,56 @@
4
4
  import * as TwelvelabsApi from "../../index";
5
5
  /**
6
6
  * @example
7
- * {
8
- * videoId: "6298d673f1090f1100476d4c",
9
- * prompt: "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.",
10
- * temperature: 0.2,
11
- * responseFormat: {
12
- * type: "json_schema",
13
- * jsonSchema: {
14
- * "type": "object",
15
- * "properties": {
16
- * "title": {
17
- * "type": "string"
18
- * },
19
- * "summary": {
20
- * "type": "string"
21
- * },
22
- * "keywords": {
23
- * "type": "array",
24
- * "items": {
25
- * "type": "string"
26
- * }
27
- * }
28
- * }
29
- * }
30
- * },
31
- * maxTokens: 2000
32
- * }
7
+ * {}
33
8
  */
34
9
  export interface AnalyzeStreamRequest {
35
10
  /**
36
- * The unique identifier of the video to analyze.
11
+ * The video understanding model to use for analysis.
12
+ * - `pegasus1.2`: General analysis (prompt-based text generation).
13
+ * - `pegasus1.5`: General analysis (prompt-based text generation) with video clipping, structured prompts with reference images, extended token limits, and video segmentation (async only). Does not support `analysis_mode=time_based_metadata` or `response_format.type=segment_definitions` — use the [`POST`](/v1.3/api-reference/analyze-videos/create-async-analysis-task) method of the `/analyze/tasks` endpoint instead.
14
+ *
15
+ * **Default:** `pegasus1.2`
16
+ */
17
+ modelName?: TwelvelabsApi.AnalyzeStreamRequestModelName;
18
+ /**
19
+ * The unique identifier of the video to analyze. Use this parameter when the `model_name` parameter is `pegasus1.2`. Not supported with `pegasus1.5`.
37
20
  *
38
21
  * <Info> This parameter will be deprecated and removed in a future version. Use the [`video`](/v1.3/api-reference/analyze-videos/sync-analysis#request.body.video) parameter instead.</Info>
39
22
  */
40
23
  videoId?: string;
41
24
  video?: TwelvelabsApi.VideoContext;
42
- prompt: TwelvelabsApi.AnalyzeTextPrompt;
25
+ /** A text prompt that guides the model on the desired format or content. Works with both Pegasus 1.2 and Pegasus 1.5. To include reference images in your prompt, use the `prompt_v2` parameter instead (Pegasus 1.5 only). Mutually exclusive with the `prompt_v2` parameter. */
26
+ prompt?: TwelvelabsApi.AnalyzeTextPrompt;
27
+ /** A structured prompt with `<@name>` placeholders for referencing images. Requires the `model_name` parameter set to `pegasus1.5`. Mutually exclusive with the `prompt` parameter. */
28
+ promptV2?: TwelvelabsApi.AnalyzePromptV2;
43
29
  temperature?: TwelvelabsApi.AnalyzeTemperature;
30
+ /** Specifies the format of the response. When you omit this parameter, the platform returns unstructured text. Only the `json_schema` type is supported for synchronous analysis. */
44
31
  responseFormat?: TwelvelabsApi.SyncResponseFormat;
45
- maxTokens?: TwelvelabsApi.AnalyzeMaxTokens;
32
+ /**
33
+ * The maximum number of tokens to generate. The allowed range depends on the model:
34
+ *
35
+ * | Model | Min | Max | Default |
36
+ * |-------|-----|-----|---------|
37
+ * | Pegasus 1.2 | 1 | 4,096 | 4,096 |
38
+ * | Pegasus 1.5 | 512 | 65,536 | 4,096 |
39
+ */
40
+ maxTokens?: number;
41
+ /**
42
+ * Start of the analysis window, in seconds. Use with `end_time` to analyze only a portion of the video. Requires `model_name` set to `pegasus1.5`.
43
+ *
44
+ * <Note title="Notes">
45
+ * - If omitted, defaults to `0`.
46
+ * - Must be less than `end_time` and less than the video duration. The clip (`end_time - start_time`) must be at least `4` seconds.
47
+ * </Note>
48
+ */
49
+ startTime?: number;
50
+ /**
51
+ * End of the analysis window, in seconds. Use with `start_time` to analyze only a portion of the video. Requires `model_name` set to `pegasus1.5`.
52
+ *
53
+ * <Note title="Notes">
54
+ * - If omitted, defaults to the video duration.
55
+ * - Must be greater than `start_time` and less than or equal to the video duration. The clip (`end_time - start_time`) must be at least `4` seconds.
56
+ * </Note>
57
+ */
58
+ endTime?: number;
46
59
  }
@@ -40,13 +40,14 @@ export declare class Tasks {
40
40
  * status: "queued",
41
41
  * videoUrl: "https://example.com/video.mp4",
42
42
  * assetId: "69abc123def456789012abcd",
43
- * analysisMode: "time_based_metadata"
43
+ * videoId: "6298d673f1090f1100476d4c",
44
+ * analysisMode: "general"
44
45
  * })
45
46
  */
46
47
  list(request?: TwelvelabsApi.analyzeAsync.TasksListRequest, requestOptions?: Tasks.RequestOptions): core.HttpResponsePromise<TwelvelabsApi.analyzeAsync.TasksListResponse>;
47
48
  private __list;
48
49
  /**
49
- * This method asynchronously analyzes your videos. It supports two modes: general analysis (prompt-based text generation) with Pegasus 1.2 and video segmentation with Pegasus 1.5.
50
+ * This method asynchronously analyzes your videos. It supports two analysis modes: general analysis (prompt-based text generation) and video segmentation with custom segment definitions. Video segmentation requires Pegasus 1.5.
50
51
  *
51
52
  * <Accordion title="Input requirements">
52
53
  * - Minimum duration: 4 seconds
@@ -57,8 +58,8 @@ export declare class Tasks {
57
58
  * </Accordion>
58
59
  *
59
60
  * **When to use this method**:
60
- * - Generate custom text from your video using a prompt (Pegasus 1.2 only)
61
- * - Extract timestamped metadata with custom fields from your video (Pegasus 1.5 only)
61
+ * - Generate custom text from your video using a prompt (general analysis)
62
+ * - Extract timestamped metadata with custom segment definitions from your video (Pegasus 1.5 only)
62
63
  * - Analyze videos longer than 1 hour
63
64
  * - Process videos asynchronously without blocking your application
64
65
  *
@@ -83,6 +84,7 @@ export declare class Tasks {
83
84
  *
84
85
  * @example
85
86
  * await client.analyzeAsync.tasks.create({
87
+ * customId: "prod-segment-analysis-42",
86
88
  * video: {
87
89
  * type: "url",
88
90
  * url: "https://example.com/video.mp4"
@@ -123,6 +125,61 @@ export declare class Tasks {
123
125
  * minSegmentDuration: 5,
124
126
  * maxSegmentDuration: 30
125
127
  * })
128
+ *
129
+ * @example
130
+ * await client.analyzeAsync.tasks.create({
131
+ * modelName: "pegasus1.5",
132
+ * video: {
133
+ * type: "url",
134
+ * url: "https://example.com/video.mp4"
135
+ * },
136
+ * prompt: "Summarize the key events in this clip.",
137
+ * maxTokens: 4096,
138
+ * startTime: 10,
139
+ * endTime: 60
140
+ * })
141
+ *
142
+ * @example
143
+ * await client.analyzeAsync.tasks.create({
144
+ * modelName: "pegasus1.5",
145
+ * video: {
146
+ * type: "url",
147
+ * url: "https://example.com/video.mp4"
148
+ * },
149
+ * analysisMode: "time_based_metadata",
150
+ * responseFormat: {
151
+ * type: "segment_definitions",
152
+ * segmentDefinitions: [{
153
+ * id: "scenes",
154
+ * description: "Scene changes.",
155
+ * timeRanges: [{
156
+ * startTime: 0,
157
+ * endTime: 4
158
+ * }, {
159
+ * startTime: 10,
160
+ * endTime: 14
161
+ * }]
162
+ * }]
163
+ * }
164
+ * })
165
+ *
166
+ * @example
167
+ * await client.analyzeAsync.tasks.create({
168
+ * modelName: "pegasus1.5",
169
+ * video: {
170
+ * type: "url",
171
+ * url: "https://example.com/video.mp4"
172
+ * },
173
+ * promptV2: {
174
+ * inputText: "Is there a <@tiger-1> in the video?",
175
+ * mediaSources: [{
176
+ * name: "tiger-1",
177
+ * mediaType: "image",
178
+ * url: "https://example.com/tiger.jpg"
179
+ * }]
180
+ * },
181
+ * maxTokens: 4096
182
+ * })
126
183
  */
127
184
  create(request: TwelvelabsApi.analyzeAsync.CreateAsyncAnalyzeRequest, requestOptions?: Tasks.RequestOptions): core.HttpResponsePromise<TwelvelabsApi.CreateAnalyzeTaskResponse>;
128
185
  private __create;