@aviaryhq/cloudglue-js 0.0.9

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.
@@ -0,0 +1,416 @@
1
+ import { type ZodiosOptions } from "@zodios/core";
2
+ import { z } from "zod";
3
+ type ChatCompletionRequest = {
4
+ model: "nimbus-001";
5
+ messages: Array<ChatMessage>;
6
+ collections: Array<string>;
7
+ filter?: Partial<{
8
+ metadata: Array<{
9
+ path: string;
10
+ operator: "NotEqual" | "Equal" | "LessThan" | "GreaterThan" | "In" | "ContainsAny" | "ContainsAll";
11
+ valueText?: string | undefined;
12
+ valueTextArray?: Array<string> | undefined;
13
+ }>;
14
+ }> | undefined;
15
+ force_search?: boolean | undefined;
16
+ result_format?: ("text" | "markdown" | "json") | undefined;
17
+ include_citations?: boolean | undefined;
18
+ temperature?: number | undefined;
19
+ top_p?: number | undefined;
20
+ max_tokens?: number | undefined;
21
+ };
22
+ type ChatMessage = {
23
+ role: "system" | "user" | "assistant";
24
+ content: string;
25
+ name?: string | undefined;
26
+ };
27
+ declare const ChatMessage: z.ZodType<ChatMessage>;
28
+ declare const ChatCompletionRequest: z.ZodType<ChatCompletionRequest>;
29
+ export declare const schemas: {
30
+ ChatMessage: z.ZodType<ChatMessage, z.ZodTypeDef, ChatMessage>;
31
+ ChatCompletionRequest: z.ZodType<ChatCompletionRequest, z.ZodTypeDef, ChatCompletionRequest>;
32
+ ChatCompletionResponse: z.ZodType<Partial<{
33
+ id: string;
34
+ object: string;
35
+ created: number;
36
+ model: string;
37
+ choices: Array<Partial<{
38
+ index: number;
39
+ message: ChatMessage;
40
+ citations: Array<Partial<{
41
+ collection_id: string;
42
+ file_id: string;
43
+ segment_id: string;
44
+ start_time: string | number;
45
+ end_time: string | number;
46
+ text: string;
47
+ context: string;
48
+ relevant_sources: Array<Partial<{
49
+ text: string;
50
+ }>>;
51
+ visual_description: Array<Partial<{
52
+ text: string;
53
+ start_time: number;
54
+ end_time: number;
55
+ }>>;
56
+ scene_text: Array<Partial<{
57
+ text: string;
58
+ start_time: number;
59
+ end_time: number;
60
+ }>>;
61
+ speech: Array<Partial<{
62
+ speaker: string;
63
+ text: string;
64
+ start_time: number;
65
+ end_time: number;
66
+ }>>;
67
+ }>>;
68
+ }>>;
69
+ usage: Partial<{
70
+ prompt_tokens: number;
71
+ completion_tokens: number;
72
+ total_tokens: number;
73
+ }>;
74
+ }>, z.ZodTypeDef, Partial<{
75
+ id: string;
76
+ object: string;
77
+ created: number;
78
+ model: string;
79
+ choices: Array<Partial<{
80
+ index: number;
81
+ message: ChatMessage;
82
+ citations: Array<Partial<{
83
+ collection_id: string;
84
+ file_id: string;
85
+ segment_id: string;
86
+ start_time: string | number;
87
+ end_time: string | number;
88
+ text: string;
89
+ context: string;
90
+ relevant_sources: Array<Partial<{
91
+ text: string;
92
+ }>>;
93
+ visual_description: Array<Partial<{
94
+ text: string;
95
+ start_time: number;
96
+ end_time: number;
97
+ }>>;
98
+ scene_text: Array<Partial<{
99
+ text: string;
100
+ start_time: number;
101
+ end_time: number;
102
+ }>>;
103
+ speech: Array<Partial<{
104
+ speaker: string;
105
+ text: string;
106
+ start_time: number;
107
+ end_time: number;
108
+ }>>;
109
+ }>>;
110
+ }>>;
111
+ usage: Partial<{
112
+ prompt_tokens: number;
113
+ completion_tokens: number;
114
+ total_tokens: number;
115
+ }>;
116
+ }>>;
117
+ };
118
+ export declare const ChatApi: import("@zodios/core").ZodiosInstance<[{
119
+ method: "post";
120
+ path: "/chat/completions";
121
+ alias: "createCompletion";
122
+ description: "Generate a model response to a conversation that can include references to video content";
123
+ requestFormat: "json";
124
+ parameters: [{
125
+ name: "body";
126
+ description: string;
127
+ type: "Body";
128
+ schema: z.ZodType<ChatCompletionRequest, z.ZodTypeDef, ChatCompletionRequest>;
129
+ }];
130
+ response: z.ZodType<Partial<{
131
+ id: string;
132
+ object: string;
133
+ created: number;
134
+ model: string;
135
+ choices: Array<Partial<{
136
+ index: number;
137
+ message: ChatMessage;
138
+ citations: Array<Partial<{
139
+ collection_id: string;
140
+ file_id: string;
141
+ segment_id: string;
142
+ start_time: string | number;
143
+ end_time: string | number;
144
+ text: string;
145
+ context: string;
146
+ relevant_sources: Array<Partial<{
147
+ text: string;
148
+ }>>;
149
+ visual_description: Array<Partial<{
150
+ text: string;
151
+ start_time: number;
152
+ end_time: number;
153
+ }>>;
154
+ scene_text: Array<Partial<{
155
+ text: string;
156
+ start_time: number;
157
+ end_time: number;
158
+ }>>;
159
+ speech: Array<Partial<{
160
+ speaker: string;
161
+ text: string;
162
+ start_time: number;
163
+ end_time: number;
164
+ }>>;
165
+ }>>;
166
+ }>>;
167
+ usage: Partial<{
168
+ prompt_tokens: number;
169
+ completion_tokens: number;
170
+ total_tokens: number;
171
+ }>;
172
+ }>, z.ZodTypeDef, Partial<{
173
+ id: string;
174
+ object: string;
175
+ created: number;
176
+ model: string;
177
+ choices: Array<Partial<{
178
+ index: number;
179
+ message: ChatMessage;
180
+ citations: Array<Partial<{
181
+ collection_id: string;
182
+ file_id: string;
183
+ segment_id: string;
184
+ start_time: string | number;
185
+ end_time: string | number;
186
+ text: string;
187
+ context: string;
188
+ relevant_sources: Array<Partial<{
189
+ text: string;
190
+ }>>;
191
+ visual_description: Array<Partial<{
192
+ text: string;
193
+ start_time: number;
194
+ end_time: number;
195
+ }>>;
196
+ scene_text: Array<Partial<{
197
+ text: string;
198
+ start_time: number;
199
+ end_time: number;
200
+ }>>;
201
+ speech: Array<Partial<{
202
+ speaker: string;
203
+ text: string;
204
+ start_time: number;
205
+ end_time: number;
206
+ }>>;
207
+ }>>;
208
+ }>>;
209
+ usage: Partial<{
210
+ prompt_tokens: number;
211
+ completion_tokens: number;
212
+ total_tokens: number;
213
+ }>;
214
+ }>>;
215
+ errors: [{
216
+ status: 400;
217
+ description: string;
218
+ schema: z.ZodObject<{
219
+ error: z.ZodString;
220
+ }, "passthrough", z.ZodTypeAny, z.objectOutputType<{
221
+ error: z.ZodString;
222
+ }, z.ZodTypeAny, "passthrough">, z.objectInputType<{
223
+ error: z.ZodString;
224
+ }, z.ZodTypeAny, "passthrough">>;
225
+ }, {
226
+ status: 404;
227
+ description: string;
228
+ schema: z.ZodObject<{
229
+ error: z.ZodString;
230
+ }, "passthrough", z.ZodTypeAny, z.objectOutputType<{
231
+ error: z.ZodString;
232
+ }, z.ZodTypeAny, "passthrough">, z.objectInputType<{
233
+ error: z.ZodString;
234
+ }, z.ZodTypeAny, "passthrough">>;
235
+ }, {
236
+ status: 429;
237
+ description: string;
238
+ schema: z.ZodObject<{
239
+ error: z.ZodString;
240
+ }, "passthrough", z.ZodTypeAny, z.objectOutputType<{
241
+ error: z.ZodString;
242
+ }, z.ZodTypeAny, "passthrough">, z.objectInputType<{
243
+ error: z.ZodString;
244
+ }, z.ZodTypeAny, "passthrough">>;
245
+ }, {
246
+ status: 500;
247
+ description: string;
248
+ schema: z.ZodObject<{
249
+ error: z.ZodString;
250
+ }, "passthrough", z.ZodTypeAny, z.objectOutputType<{
251
+ error: z.ZodString;
252
+ }, z.ZodTypeAny, "passthrough">, z.objectInputType<{
253
+ error: z.ZodString;
254
+ }, z.ZodTypeAny, "passthrough">>;
255
+ }, {
256
+ status: 509;
257
+ description: string;
258
+ schema: z.ZodObject<{
259
+ error: z.ZodString;
260
+ }, "passthrough", z.ZodTypeAny, z.objectOutputType<{
261
+ error: z.ZodString;
262
+ }, z.ZodTypeAny, "passthrough">, z.objectInputType<{
263
+ error: z.ZodString;
264
+ }, z.ZodTypeAny, "passthrough">>;
265
+ }];
266
+ }]>;
267
+ export declare function createApiClient(baseUrl: string, options?: ZodiosOptions): import("@zodios/core").ZodiosInstance<[{
268
+ method: "post";
269
+ path: "/chat/completions";
270
+ alias: "createCompletion";
271
+ description: "Generate a model response to a conversation that can include references to video content";
272
+ requestFormat: "json";
273
+ parameters: [{
274
+ name: "body";
275
+ description: string;
276
+ type: "Body";
277
+ schema: z.ZodType<ChatCompletionRequest, z.ZodTypeDef, ChatCompletionRequest>;
278
+ }];
279
+ response: z.ZodType<Partial<{
280
+ id: string;
281
+ object: string;
282
+ created: number;
283
+ model: string;
284
+ choices: Array<Partial<{
285
+ index: number;
286
+ message: ChatMessage;
287
+ citations: Array<Partial<{
288
+ collection_id: string;
289
+ file_id: string;
290
+ segment_id: string;
291
+ start_time: string | number;
292
+ end_time: string | number;
293
+ text: string;
294
+ context: string;
295
+ relevant_sources: Array<Partial<{
296
+ text: string;
297
+ }>>;
298
+ visual_description: Array<Partial<{
299
+ text: string;
300
+ start_time: number;
301
+ end_time: number;
302
+ }>>;
303
+ scene_text: Array<Partial<{
304
+ text: string;
305
+ start_time: number;
306
+ end_time: number;
307
+ }>>;
308
+ speech: Array<Partial<{
309
+ speaker: string;
310
+ text: string;
311
+ start_time: number;
312
+ end_time: number;
313
+ }>>;
314
+ }>>;
315
+ }>>;
316
+ usage: Partial<{
317
+ prompt_tokens: number;
318
+ completion_tokens: number;
319
+ total_tokens: number;
320
+ }>;
321
+ }>, z.ZodTypeDef, Partial<{
322
+ id: string;
323
+ object: string;
324
+ created: number;
325
+ model: string;
326
+ choices: Array<Partial<{
327
+ index: number;
328
+ message: ChatMessage;
329
+ citations: Array<Partial<{
330
+ collection_id: string;
331
+ file_id: string;
332
+ segment_id: string;
333
+ start_time: string | number;
334
+ end_time: string | number;
335
+ text: string;
336
+ context: string;
337
+ relevant_sources: Array<Partial<{
338
+ text: string;
339
+ }>>;
340
+ visual_description: Array<Partial<{
341
+ text: string;
342
+ start_time: number;
343
+ end_time: number;
344
+ }>>;
345
+ scene_text: Array<Partial<{
346
+ text: string;
347
+ start_time: number;
348
+ end_time: number;
349
+ }>>;
350
+ speech: Array<Partial<{
351
+ speaker: string;
352
+ text: string;
353
+ start_time: number;
354
+ end_time: number;
355
+ }>>;
356
+ }>>;
357
+ }>>;
358
+ usage: Partial<{
359
+ prompt_tokens: number;
360
+ completion_tokens: number;
361
+ total_tokens: number;
362
+ }>;
363
+ }>>;
364
+ errors: [{
365
+ status: 400;
366
+ description: string;
367
+ schema: z.ZodObject<{
368
+ error: z.ZodString;
369
+ }, "passthrough", z.ZodTypeAny, z.objectOutputType<{
370
+ error: z.ZodString;
371
+ }, z.ZodTypeAny, "passthrough">, z.objectInputType<{
372
+ error: z.ZodString;
373
+ }, z.ZodTypeAny, "passthrough">>;
374
+ }, {
375
+ status: 404;
376
+ description: string;
377
+ schema: z.ZodObject<{
378
+ error: z.ZodString;
379
+ }, "passthrough", z.ZodTypeAny, z.objectOutputType<{
380
+ error: z.ZodString;
381
+ }, z.ZodTypeAny, "passthrough">, z.objectInputType<{
382
+ error: z.ZodString;
383
+ }, z.ZodTypeAny, "passthrough">>;
384
+ }, {
385
+ status: 429;
386
+ description: string;
387
+ schema: z.ZodObject<{
388
+ error: z.ZodString;
389
+ }, "passthrough", z.ZodTypeAny, z.objectOutputType<{
390
+ error: z.ZodString;
391
+ }, z.ZodTypeAny, "passthrough">, z.objectInputType<{
392
+ error: z.ZodString;
393
+ }, z.ZodTypeAny, "passthrough">>;
394
+ }, {
395
+ status: 500;
396
+ description: string;
397
+ schema: z.ZodObject<{
398
+ error: z.ZodString;
399
+ }, "passthrough", z.ZodTypeAny, z.objectOutputType<{
400
+ error: z.ZodString;
401
+ }, z.ZodTypeAny, "passthrough">, z.objectInputType<{
402
+ error: z.ZodString;
403
+ }, z.ZodTypeAny, "passthrough">>;
404
+ }, {
405
+ status: 509;
406
+ description: string;
407
+ schema: z.ZodObject<{
408
+ error: z.ZodString;
409
+ }, "passthrough", z.ZodTypeAny, z.objectOutputType<{
410
+ error: z.ZodString;
411
+ }, z.ZodTypeAny, "passthrough">, z.objectInputType<{
412
+ error: z.ZodString;
413
+ }, z.ZodTypeAny, "passthrough">>;
414
+ }];
415
+ }]>;
416
+ export {};
@@ -0,0 +1,182 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ChatApi = exports.schemas = void 0;
4
+ exports.createApiClient = createApiClient;
5
+ const core_1 = require("@zodios/core");
6
+ const zod_1 = require("zod");
7
+ const ChatMessage = zod_1.z
8
+ .object({
9
+ role: zod_1.z.enum(["system", "user", "assistant"]),
10
+ content: zod_1.z.string(),
11
+ name: zod_1.z.string().optional(),
12
+ })
13
+ .strict()
14
+ .passthrough();
15
+ const ChatCompletionRequest = zod_1.z
16
+ .object({
17
+ model: zod_1.z.literal("nimbus-001"),
18
+ messages: zod_1.z.array(ChatMessage),
19
+ collections: zod_1.z.array(zod_1.z.string()).min(1).max(1),
20
+ filter: zod_1.z
21
+ .object({
22
+ metadata: zod_1.z.array(zod_1.z
23
+ .object({
24
+ path: zod_1.z.string(),
25
+ operator: zod_1.z.enum([
26
+ "NotEqual",
27
+ "Equal",
28
+ "LessThan",
29
+ "GreaterThan",
30
+ "In",
31
+ "ContainsAny",
32
+ "ContainsAll",
33
+ ]),
34
+ valueText: zod_1.z.string().optional(),
35
+ valueTextArray: zod_1.z.array(zod_1.z.string()).optional(),
36
+ })
37
+ .strict()
38
+ .passthrough()),
39
+ })
40
+ .partial()
41
+ .strict()
42
+ .passthrough()
43
+ .optional(),
44
+ force_search: zod_1.z.boolean().optional().default(false),
45
+ result_format: zod_1.z
46
+ .enum(["text", "markdown", "json"])
47
+ .optional()
48
+ .default("text"),
49
+ include_citations: zod_1.z.boolean().optional().default(true),
50
+ temperature: zod_1.z.number().gte(0).lte(2).optional().default(0.7),
51
+ top_p: zod_1.z.number().gte(0).lte(1).optional().default(1),
52
+ max_tokens: zod_1.z.number().int().optional().default(1024),
53
+ })
54
+ .strict()
55
+ .passthrough();
56
+ const ChatCompletionResponse = zod_1.z
57
+ .object({
58
+ id: zod_1.z.string(),
59
+ object: zod_1.z.string(),
60
+ created: zod_1.z.number().int(),
61
+ model: zod_1.z.string(),
62
+ choices: zod_1.z.array(zod_1.z
63
+ .object({
64
+ index: zod_1.z.number().int(),
65
+ message: ChatMessage,
66
+ citations: zod_1.z.array(zod_1.z
67
+ .object({
68
+ collection_id: zod_1.z.string(),
69
+ file_id: zod_1.z.string(),
70
+ segment_id: zod_1.z.string(),
71
+ start_time: zod_1.z.union([zod_1.z.string(), zod_1.z.number()]),
72
+ end_time: zod_1.z.union([zod_1.z.string(), zod_1.z.number()]),
73
+ text: zod_1.z.string(),
74
+ context: zod_1.z.string(),
75
+ relevant_sources: zod_1.z.array(zod_1.z
76
+ .object({ text: zod_1.z.string() })
77
+ .partial()
78
+ .strict()
79
+ .passthrough()),
80
+ visual_description: zod_1.z.array(zod_1.z
81
+ .object({
82
+ text: zod_1.z.string(),
83
+ start_time: zod_1.z.number(),
84
+ end_time: zod_1.z.number(),
85
+ })
86
+ .partial()
87
+ .strict()
88
+ .passthrough()),
89
+ scene_text: zod_1.z.array(zod_1.z
90
+ .object({
91
+ text: zod_1.z.string(),
92
+ start_time: zod_1.z.number(),
93
+ end_time: zod_1.z.number(),
94
+ })
95
+ .partial()
96
+ .strict()
97
+ .passthrough()),
98
+ speech: zod_1.z.array(zod_1.z
99
+ .object({
100
+ speaker: zod_1.z.string(),
101
+ text: zod_1.z.string(),
102
+ start_time: zod_1.z.number(),
103
+ end_time: zod_1.z.number(),
104
+ })
105
+ .partial()
106
+ .strict()
107
+ .passthrough()),
108
+ })
109
+ .partial()
110
+ .strict()
111
+ .passthrough()),
112
+ })
113
+ .partial()
114
+ .strict()
115
+ .passthrough()),
116
+ usage: zod_1.z
117
+ .object({
118
+ prompt_tokens: zod_1.z.number().int(),
119
+ completion_tokens: zod_1.z.number().int(),
120
+ total_tokens: zod_1.z.number().int(),
121
+ })
122
+ .partial()
123
+ .strict()
124
+ .passthrough(),
125
+ })
126
+ .partial()
127
+ .strict()
128
+ .passthrough();
129
+ exports.schemas = {
130
+ ChatMessage,
131
+ ChatCompletionRequest,
132
+ ChatCompletionResponse,
133
+ };
134
+ const endpoints = (0, core_1.makeApi)([
135
+ {
136
+ method: "post",
137
+ path: "/chat/completions",
138
+ alias: "createCompletion",
139
+ description: `Generate a model response to a conversation that can include references to video content`,
140
+ requestFormat: "json",
141
+ parameters: [
142
+ {
143
+ name: "body",
144
+ description: `Chat completion parameters`,
145
+ type: "Body",
146
+ schema: ChatCompletionRequest,
147
+ },
148
+ ],
149
+ response: ChatCompletionResponse,
150
+ errors: [
151
+ {
152
+ status: 400,
153
+ description: `Invalid request`,
154
+ schema: zod_1.z.object({ error: zod_1.z.string() }).strict().passthrough(),
155
+ },
156
+ {
157
+ status: 404,
158
+ description: `Collections not found`,
159
+ schema: zod_1.z.object({ error: zod_1.z.string() }).strict().passthrough(),
160
+ },
161
+ {
162
+ status: 429,
163
+ description: `Too many requests`,
164
+ schema: zod_1.z.object({ error: zod_1.z.string() }).strict().passthrough(),
165
+ },
166
+ {
167
+ status: 500,
168
+ description: `An unexpected error occurred on the server`,
169
+ schema: zod_1.z.object({ error: zod_1.z.string() }).strict().passthrough(),
170
+ },
171
+ {
172
+ status: 509,
173
+ description: `Chat completion limits reached (monthly or daily)`,
174
+ schema: zod_1.z.object({ error: zod_1.z.string() }).strict().passthrough(),
175
+ },
176
+ ],
177
+ },
178
+ ]);
179
+ exports.ChatApi = new core_1.Zodios("https://api.cloudglue.dev/v1", endpoints);
180
+ function createApiClient(baseUrl, options) {
181
+ return new core_1.Zodios(baseUrl, endpoints, options);
182
+ }