@mixedbread/sdk 0.31.1 → 0.33.0

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 (41) hide show
  1. package/CHANGELOG.md +29 -0
  2. package/bin/cli +10 -4
  3. package/internal/to-file.d.mts +1 -1
  4. package/internal/to-file.d.ts +1 -1
  5. package/internal/to-file.js +1 -1
  6. package/internal/to-file.mjs +1 -1
  7. package/package.json +1 -1
  8. package/resources/stores/files.d.mts +301 -32
  9. package/resources/stores/files.d.mts.map +1 -1
  10. package/resources/stores/files.d.ts +301 -32
  11. package/resources/stores/files.d.ts.map +1 -1
  12. package/resources/stores/files.js +67 -58
  13. package/resources/stores/files.js.map +1 -1
  14. package/resources/stores/files.mjs +67 -58
  15. package/resources/stores/files.mjs.map +1 -1
  16. package/resources/stores/index.d.mts +1 -1
  17. package/resources/stores/index.d.mts.map +1 -1
  18. package/resources/stores/index.d.ts +1 -1
  19. package/resources/stores/index.d.ts.map +1 -1
  20. package/resources/stores/index.js.map +1 -1
  21. package/resources/stores/index.mjs.map +1 -1
  22. package/resources/vector-stores/files.d.mts +436 -24
  23. package/resources/vector-stores/files.d.mts.map +1 -1
  24. package/resources/vector-stores/files.d.ts +436 -24
  25. package/resources/vector-stores/files.d.ts.map +1 -1
  26. package/resources/vector-stores/vector-stores.d.mts +654 -36
  27. package/resources/vector-stores/vector-stores.d.mts.map +1 -1
  28. package/resources/vector-stores/vector-stores.d.ts +654 -36
  29. package/resources/vector-stores/vector-stores.d.ts.map +1 -1
  30. package/resources/vector-stores/vector-stores.js.map +1 -1
  31. package/resources/vector-stores/vector-stores.mjs.map +1 -1
  32. package/src/internal/to-file.ts +1 -1
  33. package/src/resources/stores/files.ts +579 -40
  34. package/src/resources/stores/index.ts +4 -0
  35. package/src/resources/vector-stores/files.ts +780 -8
  36. package/src/resources/vector-stores/vector-stores.ts +1193 -35
  37. package/src/version.ts +1 -1
  38. package/version.d.mts +1 -1
  39. package/version.d.ts +1 -1
  40. package/version.js +1 -1
  41. package/version.mjs +1 -1
@@ -78,15 +78,18 @@ export class Files extends APIResource {
78
78
  return this._client.post('/v1/stores/files/search', { body, ...options });
79
79
  }
80
80
 
81
-
82
81
  /**
83
82
  * Poll for a file's processing status until it reaches a terminal state.
84
83
  *
85
- * @param storeIdentifier - The identifier of the store
86
- * @param fileId - The ID of the file to poll
87
- * @param pollIntervalMs - The interval between polls in milliseconds (default: 500)
88
- * @param pollTimeoutMs - The maximum time to poll for in milliseconds (default: no timeout)
89
- * @param options - Additional request options
84
+ * Supports both positional arguments (`poll(storeIdentifier, fileId, pollIntervalMs, pollTimeoutMs, options)`) and
85
+ * a named-parameter object (`poll({ storeIdentifier, fileId, pollIntervalMs, pollTimeoutMs, options })`).
86
+ *
87
+ * @param storeIdentifier - The identifier of the store when using positional arguments
88
+ * @param fileId - The ID of the file to poll when using positional arguments
89
+ * @param pollIntervalMs - Interval between polls in milliseconds (default: 500) when using positional arguments
90
+ * @param pollTimeoutMs - Maximum time to poll in milliseconds (default: no timeout) when using positional arguments
91
+ * @param options - Additional request options when using positional arguments
92
+ * @param params - Poll configuration when using named parameters
90
93
  * @returns The file object once it reaches a terminal state
91
94
  */
92
95
  async poll(
@@ -95,27 +98,53 @@ export class Files extends APIResource {
95
98
  pollIntervalMs?: number,
96
99
  pollTimeoutMs?: number,
97
100
  options?: RequestOptions,
101
+ ): Promise<StoreFile>;
102
+ async poll(params: FilePollHelperParams): Promise<StoreFile>;
103
+ async poll(
104
+ storeIdentifierOrParams: string | FilePollHelperParams,
105
+ fileId?: string,
106
+ pollIntervalMs?: number,
107
+ pollTimeoutMs?: number,
108
+ options?: RequestOptions,
98
109
  ): Promise<StoreFile> {
99
- const pollingIntervalMs = pollIntervalMs || 500;
100
- const pollingTimeoutMs = pollTimeoutMs;
110
+ const params: FilePollHelperParams =
111
+ typeof storeIdentifierOrParams === 'string' ?
112
+ {
113
+ storeIdentifier: storeIdentifierOrParams,
114
+ fileId: fileId as string,
115
+ pollIntervalMs,
116
+ pollTimeoutMs,
117
+ options,
118
+ }
119
+ : storeIdentifierOrParams;
120
+
121
+ const pollingIntervalMs = params.pollIntervalMs ?? 500;
122
+ const retrieveParams: FileRetrieveParams = {
123
+ store_identifier: params.storeIdentifier,
124
+ ...(params.returnChunks !== undefined && { return_chunks: params.returnChunks }),
125
+ };
101
126
 
102
127
  return polling.poll({
103
- fn: () => this.retrieve(fileId, { store_identifier: storeIdentifier, ...options }),
128
+ fn: () => this.retrieve(params.fileId, retrieveParams, params.options),
104
129
  condition: (result) =>
105
130
  result.status === 'completed' || result.status === 'failed' || result.status === 'cancelled',
106
131
  intervalSeconds: pollingIntervalMs / 1000,
107
- ...(pollingTimeoutMs && { timeoutSeconds: pollingTimeoutMs / 1000 }),
132
+ ...(params.pollTimeoutMs && { timeoutSeconds: params.pollTimeoutMs / 1000 }),
108
133
  });
109
134
  }
110
135
 
111
136
  /**
112
137
  * Create a file in a vector store and wait for it to be processed.
113
138
  *
114
- * @param storeIdentifier - The identifier of the store to upload to
115
- * @param body - The file creation parameters
116
- * @param pollIntervalMs - The interval between polls in milliseconds (default: 500)
117
- * @param pollTimeoutMs - The maximum time to poll for in milliseconds (default: no timeout)
118
- * @param options - Additional request options
139
+ * Supports both positional arguments (`createAndPoll(storeIdentifier, body, pollIntervalMs, pollTimeoutMs, options)`) and
140
+ * a named-parameter object (`createAndPoll({ storeIdentifier, body, pollIntervalMs, pollTimeoutMs, options })`).
141
+ *
142
+ * @param storeIdentifier - The identifier of the store to upload to when using positional arguments
143
+ * @param body - The file creation parameters when using positional arguments
144
+ * @param pollIntervalMs - Interval between polls in milliseconds (default: 500) when using positional arguments
145
+ * @param pollTimeoutMs - Maximum time to poll in milliseconds (default: no timeout) when using positional arguments
146
+ * @param options - Additional request options when using positional arguments
147
+ * @param params - Create configuration when using named parameters
119
148
  * @returns The file object once it reaches a terminal state
120
149
  */
121
150
  async createAndPoll(
@@ -124,19 +153,49 @@ export class Files extends APIResource {
124
153
  pollIntervalMs?: number,
125
154
  pollTimeoutMs?: number,
126
155
  options?: RequestOptions,
156
+ ): Promise<StoreFile>;
157
+ async createAndPoll(params: FileCreateAndPollHelperParams): Promise<StoreFile>;
158
+ async createAndPoll(
159
+ storeIdentifierOrParams: string | FileCreateAndPollHelperParams,
160
+ body?: FileCreateParams,
161
+ pollIntervalMs?: number,
162
+ pollTimeoutMs?: number,
163
+ options?: RequestOptions,
127
164
  ): Promise<StoreFile> {
128
- const file = await this.create(storeIdentifier, body, options);
129
- return this.poll(storeIdentifier, file.id, pollIntervalMs, pollTimeoutMs, options);
165
+ const params: FileCreateAndPollHelperParams =
166
+ typeof storeIdentifierOrParams === 'string' ?
167
+ {
168
+ storeIdentifier: storeIdentifierOrParams,
169
+ body: body as FileCreateParams,
170
+ pollIntervalMs,
171
+ pollTimeoutMs,
172
+ options,
173
+ }
174
+ : storeIdentifierOrParams;
175
+
176
+ const file = await this.create(params.storeIdentifier, params.body, params.options);
177
+ return this.poll({
178
+ storeIdentifier: params.storeIdentifier,
179
+ fileId: file.id,
180
+ pollIntervalMs: params.pollIntervalMs,
181
+ pollTimeoutMs: params.pollTimeoutMs,
182
+ options: params.options,
183
+ returnChunks: params.returnChunks,
184
+ });
130
185
  }
131
186
 
132
187
  /**
133
188
  * Upload a file to the files API and then create a file in a vector store.
134
189
  * Note the file will be asynchronously processed.
135
190
  *
136
- * @param storeIdentifier - The identifier of the store to add the file to
137
- * @param file - The file to upload
138
- * @param body - Additional parameters for the vector store file
139
- * @param options - Additional request options
191
+ * Supports both positional arguments (`upload(storeIdentifier, file, body, options)`) and a named-parameter object
192
+ * (`upload({ storeIdentifier, file, body, options })`).
193
+ *
194
+ * @param storeIdentifier - The identifier of the store to add the file to when using positional arguments
195
+ * @param file - The file to upload when using positional arguments
196
+ * @param body - Additional parameters for the vector store file when using positional arguments
197
+ * @param options - Additional request options when using positional arguments
198
+ * @param params - Upload configuration when using named parameters
140
199
  * @returns The created vector store file
141
200
  */
142
201
  async upload(
@@ -144,28 +203,41 @@ export class Files extends APIResource {
144
203
  file: Uploadable,
145
204
  body?: Omit<FileCreateParams, 'file_id'>,
146
205
  options?: RequestOptions,
206
+ ): Promise<StoreFile>;
207
+ async upload(params: FileUploadHelperParams): Promise<StoreFile>;
208
+ async upload(
209
+ storeIdentifierOrParams: string | FileUploadHelperParams,
210
+ file?: Uploadable,
211
+ body?: Omit<FileCreateParams, 'file_id'>,
212
+ options?: RequestOptions,
147
213
  ): Promise<StoreFile> {
148
- const fileUploadResponse = await this._client.files.create({ file }, options);
214
+ const params: FileUploadHelperParams =
215
+ typeof storeIdentifierOrParams === 'string' ?
216
+ { storeIdentifier: storeIdentifierOrParams, file: file as Uploadable, body, options }
217
+ : storeIdentifierOrParams;
218
+
219
+ const fileUploadResponse = await this._client.files.create({ file: params.file }, params.options);
149
220
 
150
221
  return this.create(
151
- storeIdentifier,
152
- {
153
- file_id: fileUploadResponse.id,
154
- ...body,
155
- },
156
- options,
222
+ params.storeIdentifier,
223
+ { file_id: fileUploadResponse.id, ...params.body },
224
+ params.options,
157
225
  );
158
226
  }
159
227
 
160
228
  /**
161
229
  * Upload a file to files API, create a file in a vector store, and poll until processing is complete.
162
230
  *
163
- * @param storeIdentifier - The identifier of the store to add the file to
164
- * @param file - The file to upload
165
- * @param body - Additional parameters for the vector store file
166
- * @param pollIntervalMs - The interval between polls in milliseconds (default: 500)
167
- * @param pollTimeoutMs - The maximum time to poll for in milliseconds (default: no timeout)
168
- * @param options - Additional request options
231
+ * Supports both positional arguments (`uploadAndPoll(storeIdentifier, file, body, pollIntervalMs, pollTimeoutMs, options)`) and
232
+ * a named-parameter object (`uploadAndPoll({ storeIdentifier, file, body, pollIntervalMs, pollTimeoutMs, options })`).
233
+ *
234
+ * @param storeIdentifier - The identifier of the store to add the file to when using positional arguments
235
+ * @param file - The file to upload when using positional arguments
236
+ * @param body - Additional parameters for the vector store file when using positional arguments
237
+ * @param pollIntervalMs - Interval between polls in milliseconds (default: 500) when using positional arguments
238
+ * @param pollTimeoutMs - Maximum time to poll in milliseconds (default: no timeout) when using positional arguments
239
+ * @param options - Additional request options when using positional arguments
240
+ * @param params - Upload and poll configuration when using named parameters
169
241
  * @returns The vector store file object once it reaches a terminal state
170
242
  */
171
243
  async uploadAndPoll(
@@ -175,12 +247,93 @@ export class Files extends APIResource {
175
247
  pollIntervalMs?: number,
176
248
  pollTimeoutMs?: number,
177
249
  options?: RequestOptions,
250
+ ): Promise<StoreFile>;
251
+ async uploadAndPoll(params: FileUploadAndPollHelperParams): Promise<StoreFile>;
252
+ async uploadAndPoll(
253
+ storeIdentifierOrParams: string | FileUploadAndPollHelperParams,
254
+ file?: Uploadable,
255
+ body?: Omit<FileCreateParams, 'file_id'>,
256
+ pollIntervalMs?: number,
257
+ pollTimeoutMs?: number,
258
+ options?: RequestOptions,
178
259
  ): Promise<StoreFile> {
179
- const vectorStoreFile = await this.upload(storeIdentifier, file, body, options);
180
- return this.poll(storeIdentifier, vectorStoreFile.id, pollIntervalMs, pollTimeoutMs, options);
260
+ const params: FileUploadAndPollHelperParams =
261
+ typeof storeIdentifierOrParams === 'string' ?
262
+ {
263
+ storeIdentifier: storeIdentifierOrParams,
264
+ file: file as Uploadable,
265
+ body,
266
+ pollIntervalMs,
267
+ pollTimeoutMs,
268
+ options,
269
+ }
270
+ : storeIdentifierOrParams;
271
+
272
+ const vectorStoreFile = await this.upload({
273
+ storeIdentifier: params.storeIdentifier,
274
+ file: params.file,
275
+ body: params.body,
276
+ options: params.options,
277
+ });
278
+
279
+ return this.poll({
280
+ storeIdentifier: params.storeIdentifier,
281
+ fileId: vectorStoreFile.id,
282
+ pollIntervalMs: params.pollIntervalMs,
283
+ pollTimeoutMs: params.pollTimeoutMs,
284
+ options: params.options,
285
+ returnChunks: params.returnChunks,
286
+ });
181
287
  }
182
288
  }
183
289
 
290
+ /**
291
+ * Parameters for polling store file status.
292
+ */
293
+ export interface FilePollHelperParams {
294
+ storeIdentifier: string;
295
+ fileId: string;
296
+ pollIntervalMs?: number | undefined;
297
+ pollTimeoutMs?: number | undefined;
298
+ options?: RequestOptions | undefined;
299
+ returnChunks?: boolean | undefined;
300
+ }
301
+
302
+ /**
303
+ * Parameters for creating and polling a store file.
304
+ */
305
+ export interface FileCreateAndPollHelperParams {
306
+ storeIdentifier: string;
307
+ body: FileCreateParams;
308
+ pollIntervalMs?: number | undefined;
309
+ pollTimeoutMs?: number | undefined;
310
+ options?: RequestOptions | undefined;
311
+ returnChunks?: boolean | undefined;
312
+ }
313
+
314
+ /**
315
+ * Parameters for uploading a file to a store.
316
+ */
317
+ export interface FileUploadHelperParams {
318
+ storeIdentifier: string;
319
+ file: Uploadable;
320
+ body?: Omit<FileCreateParams, 'file_id'> | undefined;
321
+ options?: RequestOptions | undefined;
322
+ }
323
+
324
+ /**
325
+ * Parameters for uploading and polling a store file.
326
+ */
327
+ export interface FileUploadAndPollHelperParams {
328
+ storeIdentifier: string;
329
+ file: Uploadable;
330
+ body?: Omit<FileCreateParams, 'file_id'> | undefined;
331
+ pollIntervalMs?: number | undefined;
332
+ pollTimeoutMs?: number | undefined;
333
+ options?: RequestOptions | undefined;
334
+ returnChunks?: boolean | undefined;
335
+ }
336
+
184
337
  /**
185
338
  * Represents a scored store file.
186
339
  */
@@ -333,7 +486,13 @@ export namespace StoreFile {
333
486
  /**
334
487
  * metadata of the chunk
335
488
  */
336
- generated_metadata?: { [key: string]: unknown } | null;
489
+ generated_metadata?:
490
+ | TextInputChunk.MarkdownChunkGeneratedMetadata
491
+ | TextInputChunk.TextChunkGeneratedMetadata
492
+ | TextInputChunk.PdfChunkGeneratedMetadata
493
+ | TextInputChunk.CodeChunkGeneratedMetadata
494
+ | TextInputChunk.AudioChunkGeneratedMetadata
495
+ | null;
337
496
 
338
497
  /**
339
498
  * model used for this chunk
@@ -356,6 +515,98 @@ export namespace StoreFile {
356
515
  text: string;
357
516
  }
358
517
 
518
+ export namespace TextInputChunk {
519
+ export interface MarkdownChunkGeneratedMetadata {
520
+ type?: 'markdown';
521
+
522
+ file_type?: 'text/markdown';
523
+
524
+ language: string;
525
+
526
+ word_count: number;
527
+
528
+ file_size: number;
529
+
530
+ chunk_headings?: Array<MarkdownChunkGeneratedMetadata.ChunkHeading>;
531
+
532
+ heading_context?: Array<MarkdownChunkGeneratedMetadata.HeadingContext>;
533
+
534
+ [k: string]: unknown;
535
+ }
536
+
537
+ export namespace MarkdownChunkGeneratedMetadata {
538
+ export interface ChunkHeading {
539
+ level: number;
540
+
541
+ text: string;
542
+ }
543
+
544
+ export interface HeadingContext {
545
+ level: number;
546
+
547
+ text: string;
548
+ }
549
+ }
550
+
551
+ export interface TextChunkGeneratedMetadata {
552
+ type?: 'text';
553
+
554
+ file_type?: 'text/plain';
555
+
556
+ language: string;
557
+
558
+ word_count: number;
559
+
560
+ file_size: number;
561
+
562
+ [k: string]: unknown;
563
+ }
564
+
565
+ export interface PdfChunkGeneratedMetadata {
566
+ type?: 'pdf';
567
+
568
+ file_type?: 'application/pdf';
569
+
570
+ total_pages: number;
571
+
572
+ total_size: number;
573
+
574
+ [k: string]: unknown;
575
+ }
576
+
577
+ export interface CodeChunkGeneratedMetadata {
578
+ type?: 'code';
579
+
580
+ file_type: string;
581
+
582
+ language: string;
583
+
584
+ word_count: number;
585
+
586
+ file_size: number;
587
+
588
+ [k: string]: unknown;
589
+ }
590
+
591
+ export interface AudioChunkGeneratedMetadata {
592
+ type?: 'audio';
593
+
594
+ file_type: string;
595
+
596
+ file_size: number;
597
+
598
+ total_duration_seconds: number;
599
+
600
+ sample_rate: number;
601
+
602
+ channels: number;
603
+
604
+ audio_format: number;
605
+
606
+ [k: string]: unknown;
607
+ }
608
+ }
609
+
359
610
  export interface ImageURLInputChunk {
360
611
  /**
361
612
  * position of the chunk in a file
@@ -370,7 +621,13 @@ export namespace StoreFile {
370
621
  /**
371
622
  * metadata of the chunk
372
623
  */
373
- generated_metadata?: { [key: string]: unknown } | null;
624
+ generated_metadata?:
625
+ | ImageURLInputChunk.MarkdownChunkGeneratedMetadata
626
+ | ImageURLInputChunk.TextChunkGeneratedMetadata
627
+ | ImageURLInputChunk.PdfChunkGeneratedMetadata
628
+ | ImageURLInputChunk.CodeChunkGeneratedMetadata
629
+ | ImageURLInputChunk.AudioChunkGeneratedMetadata
630
+ | null;
374
631
 
375
632
  /**
376
633
  * model used for this chunk
@@ -399,6 +656,96 @@ export namespace StoreFile {
399
656
  }
400
657
 
401
658
  export namespace ImageURLInputChunk {
659
+ export interface MarkdownChunkGeneratedMetadata {
660
+ type?: 'markdown';
661
+
662
+ file_type?: 'text/markdown';
663
+
664
+ language: string;
665
+
666
+ word_count: number;
667
+
668
+ file_size: number;
669
+
670
+ chunk_headings?: Array<MarkdownChunkGeneratedMetadata.ChunkHeading>;
671
+
672
+ heading_context?: Array<MarkdownChunkGeneratedMetadata.HeadingContext>;
673
+
674
+ [k: string]: unknown;
675
+ }
676
+
677
+ export namespace MarkdownChunkGeneratedMetadata {
678
+ export interface ChunkHeading {
679
+ level: number;
680
+
681
+ text: string;
682
+ }
683
+
684
+ export interface HeadingContext {
685
+ level: number;
686
+
687
+ text: string;
688
+ }
689
+ }
690
+
691
+ export interface TextChunkGeneratedMetadata {
692
+ type?: 'text';
693
+
694
+ file_type?: 'text/plain';
695
+
696
+ language: string;
697
+
698
+ word_count: number;
699
+
700
+ file_size: number;
701
+
702
+ [k: string]: unknown;
703
+ }
704
+
705
+ export interface PdfChunkGeneratedMetadata {
706
+ type?: 'pdf';
707
+
708
+ file_type?: 'application/pdf';
709
+
710
+ total_pages: number;
711
+
712
+ total_size: number;
713
+
714
+ [k: string]: unknown;
715
+ }
716
+
717
+ export interface CodeChunkGeneratedMetadata {
718
+ type?: 'code';
719
+
720
+ file_type: string;
721
+
722
+ language: string;
723
+
724
+ word_count: number;
725
+
726
+ file_size: number;
727
+
728
+ [k: string]: unknown;
729
+ }
730
+
731
+ export interface AudioChunkGeneratedMetadata {
732
+ type?: 'audio';
733
+
734
+ file_type: string;
735
+
736
+ file_size: number;
737
+
738
+ total_duration_seconds: number;
739
+
740
+ sample_rate: number;
741
+
742
+ channels: number;
743
+
744
+ audio_format: number;
745
+
746
+ [k: string]: unknown;
747
+ }
748
+
402
749
  /**
403
750
  * The image input specification.
404
751
  */
@@ -429,7 +776,13 @@ export namespace StoreFile {
429
776
  /**
430
777
  * metadata of the chunk
431
778
  */
432
- generated_metadata?: { [key: string]: unknown } | null;
779
+ generated_metadata?:
780
+ | AudioURLInputChunk.MarkdownChunkGeneratedMetadata
781
+ | AudioURLInputChunk.TextChunkGeneratedMetadata
782
+ | AudioURLInputChunk.PdfChunkGeneratedMetadata
783
+ | AudioURLInputChunk.CodeChunkGeneratedMetadata
784
+ | AudioURLInputChunk.AudioChunkGeneratedMetadata
785
+ | null;
433
786
 
434
787
  /**
435
788
  * model used for this chunk
@@ -463,6 +816,96 @@ export namespace StoreFile {
463
816
  }
464
817
 
465
818
  export namespace AudioURLInputChunk {
819
+ export interface MarkdownChunkGeneratedMetadata {
820
+ type?: 'markdown';
821
+
822
+ file_type?: 'text/markdown';
823
+
824
+ language: string;
825
+
826
+ word_count: number;
827
+
828
+ file_size: number;
829
+
830
+ chunk_headings?: Array<MarkdownChunkGeneratedMetadata.ChunkHeading>;
831
+
832
+ heading_context?: Array<MarkdownChunkGeneratedMetadata.HeadingContext>;
833
+
834
+ [k: string]: unknown;
835
+ }
836
+
837
+ export namespace MarkdownChunkGeneratedMetadata {
838
+ export interface ChunkHeading {
839
+ level: number;
840
+
841
+ text: string;
842
+ }
843
+
844
+ export interface HeadingContext {
845
+ level: number;
846
+
847
+ text: string;
848
+ }
849
+ }
850
+
851
+ export interface TextChunkGeneratedMetadata {
852
+ type?: 'text';
853
+
854
+ file_type?: 'text/plain';
855
+
856
+ language: string;
857
+
858
+ word_count: number;
859
+
860
+ file_size: number;
861
+
862
+ [k: string]: unknown;
863
+ }
864
+
865
+ export interface PdfChunkGeneratedMetadata {
866
+ type?: 'pdf';
867
+
868
+ file_type?: 'application/pdf';
869
+
870
+ total_pages: number;
871
+
872
+ total_size: number;
873
+
874
+ [k: string]: unknown;
875
+ }
876
+
877
+ export interface CodeChunkGeneratedMetadata {
878
+ type?: 'code';
879
+
880
+ file_type: string;
881
+
882
+ language: string;
883
+
884
+ word_count: number;
885
+
886
+ file_size: number;
887
+
888
+ [k: string]: unknown;
889
+ }
890
+
891
+ export interface AudioChunkGeneratedMetadata {
892
+ type?: 'audio';
893
+
894
+ file_type: string;
895
+
896
+ file_size: number;
897
+
898
+ total_duration_seconds: number;
899
+
900
+ sample_rate: number;
901
+
902
+ channels: number;
903
+
904
+ audio_format: number;
905
+
906
+ [k: string]: unknown;
907
+ }
908
+
466
909
  /**
467
910
  * The audio input specification.
468
911
  */
@@ -488,7 +931,13 @@ export namespace StoreFile {
488
931
  /**
489
932
  * metadata of the chunk
490
933
  */
491
- generated_metadata?: { [key: string]: unknown } | null;
934
+ generated_metadata?:
935
+ | VideoURLInputChunk.MarkdownChunkGeneratedMetadata
936
+ | VideoURLInputChunk.TextChunkGeneratedMetadata
937
+ | VideoURLInputChunk.PdfChunkGeneratedMetadata
938
+ | VideoURLInputChunk.CodeChunkGeneratedMetadata
939
+ | VideoURLInputChunk.AudioChunkGeneratedMetadata
940
+ | null;
492
941
 
493
942
  /**
494
943
  * model used for this chunk
@@ -517,6 +966,96 @@ export namespace StoreFile {
517
966
  }
518
967
 
519
968
  export namespace VideoURLInputChunk {
969
+ export interface MarkdownChunkGeneratedMetadata {
970
+ type?: 'markdown';
971
+
972
+ file_type?: 'text/markdown';
973
+
974
+ language: string;
975
+
976
+ word_count: number;
977
+
978
+ file_size: number;
979
+
980
+ chunk_headings?: Array<MarkdownChunkGeneratedMetadata.ChunkHeading>;
981
+
982
+ heading_context?: Array<MarkdownChunkGeneratedMetadata.HeadingContext>;
983
+
984
+ [k: string]: unknown;
985
+ }
986
+
987
+ export namespace MarkdownChunkGeneratedMetadata {
988
+ export interface ChunkHeading {
989
+ level: number;
990
+
991
+ text: string;
992
+ }
993
+
994
+ export interface HeadingContext {
995
+ level: number;
996
+
997
+ text: string;
998
+ }
999
+ }
1000
+
1001
+ export interface TextChunkGeneratedMetadata {
1002
+ type?: 'text';
1003
+
1004
+ file_type?: 'text/plain';
1005
+
1006
+ language: string;
1007
+
1008
+ word_count: number;
1009
+
1010
+ file_size: number;
1011
+
1012
+ [k: string]: unknown;
1013
+ }
1014
+
1015
+ export interface PdfChunkGeneratedMetadata {
1016
+ type?: 'pdf';
1017
+
1018
+ file_type?: 'application/pdf';
1019
+
1020
+ total_pages: number;
1021
+
1022
+ total_size: number;
1023
+
1024
+ [k: string]: unknown;
1025
+ }
1026
+
1027
+ export interface CodeChunkGeneratedMetadata {
1028
+ type?: 'code';
1029
+
1030
+ file_type: string;
1031
+
1032
+ language: string;
1033
+
1034
+ word_count: number;
1035
+
1036
+ file_size: number;
1037
+
1038
+ [k: string]: unknown;
1039
+ }
1040
+
1041
+ export interface AudioChunkGeneratedMetadata {
1042
+ type?: 'audio';
1043
+
1044
+ file_type: string;
1045
+
1046
+ file_size: number;
1047
+
1048
+ total_duration_seconds: number;
1049
+
1050
+ sample_rate: number;
1051
+
1052
+ channels: number;
1053
+
1054
+ audio_format: number;
1055
+
1056
+ [k: string]: unknown;
1057
+ }
1058
+
520
1059
  /**
521
1060
  * The video input specification.
522
1061
  */