@aviaryhq/cloudglue-js 0.4.4 → 0.4.6

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.
@@ -5,8 +5,9 @@ type SearchResponse = {
5
5
  object: "search";
6
6
  query?: string | undefined;
7
7
  scope: "file" | "segment" | "face";
8
- search_target?: ("file" | "segment") | undefined;
9
- results: Array<FileSearchResult | SegmentSearchResult | FaceSearchResult>;
8
+ group_by_key?: "file" | undefined;
9
+ group_count?: number | undefined;
10
+ results: Array<FileSearchResult | SegmentSearchResult | FaceSearchResult | SegmentGroupResult | FaceGroupResult>;
10
11
  total: number;
11
12
  limit: number;
12
13
  };
@@ -66,6 +67,20 @@ type FaceSearchResult = {
66
67
  } | undefined;
67
68
  thumbnail_url?: string | undefined;
68
69
  };
70
+ type SegmentGroupResult = {
71
+ type: "segment_group";
72
+ matched_items: Array<SegmentSearchResult>;
73
+ file_id: string;
74
+ item_count: number;
75
+ best_score: number;
76
+ };
77
+ type FaceGroupResult = {
78
+ type: "face_group";
79
+ matched_items: Array<FaceSearchResult>;
80
+ file_id: string;
81
+ item_count: number;
82
+ best_score: number;
83
+ };
69
84
  type SearchFilter = Partial<{
70
85
  metadata: Array<SearchFilterCriteria>;
71
86
  video_info: Array<SearchFilterCriteria & Partial<{
@@ -86,6 +101,8 @@ declare const SearchFilter: z.ZodType<SearchFilter>;
86
101
  declare const FileSearchResult: z.ZodType<FileSearchResult>;
87
102
  declare const SegmentSearchResult: z.ZodType<SegmentSearchResult>;
88
103
  declare const FaceSearchResult: z.ZodType<FaceSearchResult>;
104
+ declare const SegmentGroupResult: z.ZodType<SegmentGroupResult>;
105
+ declare const FaceGroupResult: z.ZodType<FaceGroupResult>;
89
106
  declare const SearchResponse: z.ZodType<SearchResponse>;
90
107
  export declare const schemas: {
91
108
  SearchFilterCriteria: z.ZodType<SearchFilterCriteria, z.ZodTypeDef, SearchFilterCriteria>;
@@ -116,6 +133,9 @@ export declare const schemas: {
116
133
  }>;
117
134
  limit: number;
118
135
  filter: SearchFilter;
136
+ threshold: number;
137
+ group_by_key: "file";
138
+ sort_by: "score" | "item_count";
119
139
  }>, z.ZodTypeDef, Partial<{
120
140
  scope: "file" | "segment" | "face";
121
141
  collections: Array<string>;
@@ -126,10 +146,15 @@ export declare const schemas: {
126
146
  }>;
127
147
  limit: number;
128
148
  filter: SearchFilter;
149
+ threshold: number;
150
+ group_by_key: "file";
151
+ sort_by: "score" | "item_count";
129
152
  }>>;
130
153
  FileSearchResult: z.ZodType<FileSearchResult, z.ZodTypeDef, FileSearchResult>;
131
154
  SegmentSearchResult: z.ZodType<SegmentSearchResult, z.ZodTypeDef, SegmentSearchResult>;
132
155
  FaceSearchResult: z.ZodType<FaceSearchResult, z.ZodTypeDef, FaceSearchResult>;
156
+ SegmentGroupResult: z.ZodType<SegmentGroupResult, z.ZodTypeDef, SegmentGroupResult>;
157
+ FaceGroupResult: z.ZodType<FaceGroupResult, z.ZodTypeDef, FaceGroupResult>;
133
158
  SearchResponse: z.ZodType<SearchResponse, z.ZodTypeDef, SearchResponse>;
134
159
  };
135
160
  export declare const SearchApi: import("@zodios/core").ZodiosInstance<[{
@@ -152,6 +177,9 @@ export declare const SearchApi: import("@zodios/core").ZodiosInstance<[{
152
177
  }>;
153
178
  limit: number;
154
179
  filter: SearchFilter;
180
+ threshold: number;
181
+ group_by_key: "file";
182
+ sort_by: "score" | "item_count";
155
183
  }>, z.ZodTypeDef, Partial<{
156
184
  scope: "file" | "segment" | "face";
157
185
  collections: Array<string>;
@@ -162,6 +190,9 @@ export declare const SearchApi: import("@zodios/core").ZodiosInstance<[{
162
190
  }>;
163
191
  limit: number;
164
192
  filter: SearchFilter;
193
+ threshold: number;
194
+ group_by_key: "file";
195
+ sort_by: "score" | "item_count";
165
196
  }>>;
166
197
  }];
167
198
  response: z.ZodType<SearchResponse, z.ZodTypeDef, SearchResponse>;
@@ -217,6 +248,9 @@ export declare function createApiClient(baseUrl: string, options?: ZodiosOptions
217
248
  }>;
218
249
  limit: number;
219
250
  filter: SearchFilter;
251
+ threshold: number;
252
+ group_by_key: "file";
253
+ sort_by: "score" | "item_count";
220
254
  }>, z.ZodTypeDef, Partial<{
221
255
  scope: "file" | "segment" | "face";
222
256
  collections: Array<string>;
@@ -227,6 +261,9 @@ export declare function createApiClient(baseUrl: string, options?: ZodiosOptions
227
261
  }>;
228
262
  limit: number;
229
263
  filter: SearchFilter;
264
+ threshold: number;
265
+ group_by_key: "file";
266
+ sort_by: "score" | "item_count";
230
267
  }>>;
231
268
  }];
232
269
  response: z.ZodType<SearchResponse, z.ZodTypeDef, SearchResponse>;
@@ -51,8 +51,11 @@ const SearchRequest = zod_1.z
51
51
  .partial()
52
52
  .strict()
53
53
  .passthrough(),
54
- limit: zod_1.z.number().int().gte(1).lte(100).default(10),
54
+ limit: zod_1.z.number().int().gte(1).default(10),
55
55
  filter: SearchFilter,
56
+ threshold: zod_1.z.number(),
57
+ group_by_key: zod_1.z.literal("file"),
58
+ sort_by: zod_1.z.enum(["score", "item_count"]).default("score"),
56
59
  })
57
60
  .partial()
58
61
  .strict()
@@ -128,7 +131,7 @@ const FaceSearchResult = zod_1.z
128
131
  collection_id: zod_1.z.string().uuid(),
129
132
  face_id: zod_1.z.string().uuid(),
130
133
  frame_id: zod_1.z.string().uuid(),
131
- score: zod_1.z.number().gte(0).lte(100),
134
+ score: zod_1.z.number(),
132
135
  timestamp: zod_1.z.number().gte(0),
133
136
  face_bounding_box: zod_1.z
134
137
  .object({
@@ -144,14 +147,41 @@ const FaceSearchResult = zod_1.z
144
147
  })
145
148
  .strict()
146
149
  .passthrough();
150
+ const SegmentGroupResult = zod_1.z
151
+ .object({
152
+ type: zod_1.z.literal("segment_group"),
153
+ matched_items: zod_1.z.array(SegmentSearchResult),
154
+ file_id: zod_1.z.string().uuid(),
155
+ item_count: zod_1.z.number().int(),
156
+ best_score: zod_1.z.number(),
157
+ })
158
+ .strict()
159
+ .passthrough();
160
+ const FaceGroupResult = zod_1.z
161
+ .object({
162
+ type: zod_1.z.literal("face_group"),
163
+ matched_items: zod_1.z.array(FaceSearchResult),
164
+ file_id: zod_1.z.string().uuid(),
165
+ item_count: zod_1.z.number().int(),
166
+ best_score: zod_1.z.number(),
167
+ })
168
+ .strict()
169
+ .passthrough();
147
170
  const SearchResponse = zod_1.z
148
171
  .object({
149
172
  id: zod_1.z.string().uuid(),
150
173
  object: zod_1.z.literal("search"),
151
174
  query: zod_1.z.string().optional(),
152
175
  scope: zod_1.z.enum(["file", "segment", "face"]),
153
- search_target: zod_1.z.enum(["file", "segment"]).optional(),
154
- results: zod_1.z.array(zod_1.z.union([FileSearchResult, SegmentSearchResult, FaceSearchResult])),
176
+ group_by_key: zod_1.z.literal("file").optional(),
177
+ group_count: zod_1.z.number().int().optional(),
178
+ results: zod_1.z.array(zod_1.z.union([
179
+ FileSearchResult,
180
+ SegmentSearchResult,
181
+ FaceSearchResult,
182
+ SegmentGroupResult,
183
+ FaceGroupResult,
184
+ ])),
155
185
  total: zod_1.z.number().int(),
156
186
  limit: zod_1.z.number().int(),
157
187
  })
@@ -164,6 +194,8 @@ exports.schemas = {
164
194
  FileSearchResult,
165
195
  SegmentSearchResult,
166
196
  FaceSearchResult,
197
+ SegmentGroupResult,
198
+ FaceGroupResult,
167
199
  SearchResponse,
168
200
  };
169
201
  const endpoints = (0, core_1.makeApi)([
@@ -25,7 +25,7 @@ type ShotConfig = Partial<{
25
25
  }>;
26
26
  type NarrativeConfig = Partial<{
27
27
  prompt: string;
28
- strategy: "direct" | "long" | "balanced";
28
+ strategy: "comprehensive" | "balanced";
29
29
  number_of_chapters: number;
30
30
  }>;
31
31
  type Segment = {
@@ -70,11 +70,11 @@ export declare const schemas: {
70
70
  }>>;
71
71
  NarrativeConfig: z.ZodType<Partial<{
72
72
  prompt: string;
73
- strategy: "direct" | "long" | "balanced";
73
+ strategy: "comprehensive" | "balanced";
74
74
  number_of_chapters: number;
75
75
  }>, z.ZodTypeDef, Partial<{
76
76
  prompt: string;
77
- strategy: "direct" | "long" | "balanced";
77
+ strategy: "comprehensive" | "balanced";
78
78
  number_of_chapters: number;
79
79
  }>>;
80
80
  NewSegments: z.ZodType<NewSegments, z.ZodTypeDef, NewSegments>;
@@ -87,7 +87,7 @@ export declare const SegmentsApi: import("@zodios/core").ZodiosInstance<[{
87
87
  method: "post";
88
88
  path: "/segments";
89
89
  alias: "createSegments";
90
- description: "Create intelligent video segments based on shot detection or narrative analysis.\n\n**⚠️ Note: YouTube URLs are supported for narrative-based segmentation only.** Shot-based segmentation requires direct video file access. Use Cloudglue Files, HTTP URLs, or files from data connectors for shot-based segmentation.\n\n**Narrative Segmentation Strategies:**\n\n• **balanced** (default): Uses multimodal describe job for comprehensive analysis.\n Recommended for most videos. Supports YouTube URLs.\n\n• **direct**: Directly analyzes the full video URL with AI.\n Ideal for videos less than 10 minutes long. Provides finer grain control and expressibility with direct integration of your prompt with the Video AI model.\n\n• **long**: Optimized for longer videos beyond 10 minutes.\n Provides finer grain control and expressibility with direct integration of your prompt with the Video AI model.\n\n**YouTube URLs**: Automatically use the &#x27;balanced&#x27; strategy. The strategy field is ignored for YouTube URLs, and other strategies will be rejected with an error.";
90
+ description: "Create intelligent video segments based on shot detection or narrative analysis.\n\n**⚠️ Note: YouTube URLs are supported for narrative-based segmentation only.** Shot-based segmentation requires direct video file access. Use Cloudglue Files, HTTP URLs, or files from data connectors for shot-based segmentation.\n\n**Narrative Segmentation Strategies:**\n\n• **balanced** (default): Balanced analysis approach using multiple modalities.\n Recommended for most videos. Supports YouTube URLs.\n\n• **comprehensive**: Uses a VLM to deeply analyze logical segments of video.\n Only available for non-YouTube videos.\n\n**YouTube URLs**: Automatically use the &#x27;balanced&#x27; strategy. The strategy field is ignored for YouTube URLs, and other strategies will be rejected with an error.";
91
91
  requestFormat: "json";
92
92
  parameters: [{
93
93
  name: "body";
@@ -271,7 +271,7 @@ export declare function createApiClient(baseUrl: string, options?: ZodiosOptions
271
271
  method: "post";
272
272
  path: "/segments";
273
273
  alias: "createSegments";
274
- description: "Create intelligent video segments based on shot detection or narrative analysis.\n\n**⚠️ Note: YouTube URLs are supported for narrative-based segmentation only.** Shot-based segmentation requires direct video file access. Use Cloudglue Files, HTTP URLs, or files from data connectors for shot-based segmentation.\n\n**Narrative Segmentation Strategies:**\n\n• **balanced** (default): Uses multimodal describe job for comprehensive analysis.\n Recommended for most videos. Supports YouTube URLs.\n\n• **direct**: Directly analyzes the full video URL with AI.\n Ideal for videos less than 10 minutes long. Provides finer grain control and expressibility with direct integration of your prompt with the Video AI model.\n\n• **long**: Optimized for longer videos beyond 10 minutes.\n Provides finer grain control and expressibility with direct integration of your prompt with the Video AI model.\n\n**YouTube URLs**: Automatically use the &#x27;balanced&#x27; strategy. The strategy field is ignored for YouTube URLs, and other strategies will be rejected with an error.";
274
+ description: "Create intelligent video segments based on shot detection or narrative analysis.\n\n**⚠️ Note: YouTube URLs are supported for narrative-based segmentation only.** Shot-based segmentation requires direct video file access. Use Cloudglue Files, HTTP URLs, or files from data connectors for shot-based segmentation.\n\n**Narrative Segmentation Strategies:**\n\n• **balanced** (default): Balanced analysis approach using multiple modalities.\n Recommended for most videos. Supports YouTube URLs.\n\n• **comprehensive**: Uses a VLM to deeply analyze logical segments of video.\n Only available for non-YouTube videos.\n\n**YouTube URLs**: Automatically use the &#x27;balanced&#x27; strategy. The strategy field is ignored for YouTube URLs, and other strategies will be rejected with an error.";
275
275
  requestFormat: "json";
276
276
  parameters: [{
277
277
  name: "body";
@@ -16,7 +16,7 @@ const ShotConfig = zod_1.z
16
16
  const NarrativeConfig = zod_1.z
17
17
  .object({
18
18
  prompt: zod_1.z.string(),
19
- strategy: zod_1.z.enum(["direct", "long", "balanced"]).default("balanced"),
19
+ strategy: zod_1.z.enum(["comprehensive", "balanced"]).default("balanced"),
20
20
  number_of_chapters: zod_1.z.number().int().gte(1),
21
21
  })
22
22
  .partial()
@@ -98,14 +98,11 @@ const endpoints = (0, core_1.makeApi)([
98
98
 
99
99
  **Narrative Segmentation Strategies:**
100
100
 
101
- • **balanced** (default): Uses multimodal describe job for comprehensive analysis.
101
+ • **balanced** (default): Balanced analysis approach using multiple modalities.
102
102
  Recommended for most videos. Supports YouTube URLs.
103
103
 
104
- • **direct**: Directly analyzes the full video URL with AI.
105
- Ideal for videos less than 10 minutes long. Provides finer grain control and expressibility with direct integration of your prompt with the Video AI model.
106
-
107
- • **long**: Optimized for longer videos beyond 10 minutes.
108
- Provides finer grain control and expressibility with direct integration of your prompt with the Video AI model.
104
+ • **comprehensive**: Uses a VLM to deeply analyze logical segments of video.
105
+ Only available for non-YouTube videos.
109
106
 
110
107
  **YouTube URLs**: Automatically use the &#x27;balanced&#x27; strategy. The strategy field is ignored for YouTube URLs, and other strategies will be rejected with an error.`,
111
108
  requestFormat: "json",
@@ -182,6 +182,9 @@ interface SearchParams {
182
182
  };
183
183
  limit?: number;
184
184
  filter?: Filter;
185
+ threshold?: number;
186
+ group_by_key?: "file";
187
+ sort_by?: "score" | "item_count";
185
188
  }
186
189
  interface WaitForReadyOptions {
187
190
  /** Interval in milliseconds between polling attempts. Defaults to 5000ms (5 seconds). */
@@ -2028,7 +2031,8 @@ declare class EnhancedSearchApi {
2028
2031
  object: "search";
2029
2032
  query?: string | undefined;
2030
2033
  scope: "file" | "segment" | "face";
2031
- search_target?: ("file" | "segment") | undefined;
2034
+ group_by_key?: "file" | undefined;
2035
+ group_count?: number | undefined;
2032
2036
  results: Array<{
2033
2037
  type: "file";
2034
2038
  file_id: string;
@@ -2082,6 +2086,61 @@ declare class EnhancedSearchApi {
2082
2086
  left: number;
2083
2087
  } | undefined;
2084
2088
  thumbnail_url?: string | undefined;
2089
+ } | {
2090
+ type: "segment_group";
2091
+ matched_items: Array<{
2092
+ type: "segment";
2093
+ file_id: string;
2094
+ collection_id: string;
2095
+ segment_id: string;
2096
+ id: string;
2097
+ score: number;
2098
+ start_time: number;
2099
+ end_time: number;
2100
+ title?: (string | null) | undefined;
2101
+ filename?: (string | null) | undefined;
2102
+ visual_description?: Array<Partial<{
2103
+ text: string;
2104
+ start_time: number;
2105
+ end_time: number;
2106
+ }>> | undefined;
2107
+ scene_text?: Array<Partial<{
2108
+ text: string;
2109
+ start_time: number;
2110
+ end_time: number;
2111
+ }>> | undefined;
2112
+ speech?: Array<Partial<{
2113
+ speaker: string;
2114
+ text: string;
2115
+ start_time: number;
2116
+ end_time: number;
2117
+ }>> | undefined;
2118
+ thumbnail_url?: string | undefined;
2119
+ }>;
2120
+ file_id: string;
2121
+ item_count: number;
2122
+ best_score: number;
2123
+ } | {
2124
+ type: "face_group";
2125
+ matched_items: Array<{
2126
+ type: "face";
2127
+ file_id: string;
2128
+ collection_id: string;
2129
+ face_id: string;
2130
+ frame_id: string;
2131
+ score: number;
2132
+ timestamp: number;
2133
+ face_bounding_box?: {
2134
+ height: number;
2135
+ width: number;
2136
+ top: number;
2137
+ left: number;
2138
+ } | undefined;
2139
+ thumbnail_url?: string | undefined;
2140
+ }>;
2141
+ file_id: string;
2142
+ item_count: number;
2143
+ best_score: number;
2085
2144
  }>;
2086
2145
  total: number;
2087
2146
  limit: number;
@@ -2261,7 +2320,7 @@ declare class EnhancedSegmentsApi {
2261
2320
  }> | undefined;
2262
2321
  narrative_config?: Partial<{
2263
2322
  prompt: string;
2264
- strategy: "direct" | "long" | "balanced";
2323
+ strategy: "comprehensive" | "balanced";
2265
2324
  number_of_chapters: number;
2266
2325
  }> | undefined;
2267
2326
  }>;
@@ -2283,7 +2342,7 @@ declare class EnhancedSegmentsApi {
2283
2342
  }> | undefined;
2284
2343
  narrative_config?: Partial<{
2285
2344
  prompt: string;
2286
- strategy: "direct" | "long" | "balanced";
2345
+ strategy: "comprehensive" | "balanced";
2287
2346
  number_of_chapters: number;
2288
2347
  }> | undefined;
2289
2348
  total_segments?: number | undefined;
@@ -2313,7 +2372,7 @@ declare class EnhancedSegmentsApi {
2313
2372
  }> | undefined;
2314
2373
  narrative_config?: Partial<{
2315
2374
  prompt: string;
2316
- strategy: "direct" | "long" | "balanced";
2375
+ strategy: "comprehensive" | "balanced";
2317
2376
  number_of_chapters: number;
2318
2377
  }> | undefined;
2319
2378
  total_segments?: number | undefined;
@@ -2341,7 +2400,7 @@ declare class EnhancedSegmentsApi {
2341
2400
  }> | undefined;
2342
2401
  narrative_config?: Partial<{
2343
2402
  prompt: string;
2344
- strategy: "direct" | "long" | "balanced";
2403
+ strategy: "comprehensive" | "balanced";
2345
2404
  number_of_chapters: number;
2346
2405
  }> | undefined;
2347
2406
  total_segments?: number | undefined;
@@ -645,7 +645,7 @@ class CloudGlue {
645
645
  headers: {
646
646
  Authorization: `Bearer ${this.apiKey}`,
647
647
  'x-sdk-client': 'cloudglue-js',
648
- 'x-sdk-version': '0.4.4',
648
+ 'x-sdk-version': '0.4.6',
649
649
  },
650
650
  baseURL: this.baseUrl,
651
651
  timeout: this.timeout,
@@ -129,6 +129,14 @@ export type SegmentSearchResult = z.infer<typeof searchSchemas.SegmentSearchResu
129
129
  * Represents a face-level search result
130
130
  */
131
131
  export type FaceSearchResult = z.infer<typeof searchSchemas.FaceSearchResult>;
132
+ /**
133
+ * Represents a grouped segment search result
134
+ */
135
+ export type SegmentGroupResult = z.infer<typeof searchSchemas.SegmentGroupResult>;
136
+ /**
137
+ * Represents a grouped face search result
138
+ */
139
+ export type FaceGroupResult = z.infer<typeof searchSchemas.FaceGroupResult>;
132
140
  /**
133
141
  * Represents search filter criteria for filtering results
134
142
  */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aviaryhq/cloudglue-js",
3
- "version": "0.4.4",
3
+ "version": "0.4.6",
4
4
  "description": "Cloudglue API client for Node.js",
5
5
  "main": "dist/src/index.js",
6
6
  "types": "dist/src/index.d.ts",