ruby/resources/vector_stores/index.md +0 −2888 deleted
File Deleted View Diff
1# Vector Stores
2
3## List vector stores
4
5`vector_stores.list(**kwargs) -> CursorPage<VectorStore>`
6
7**get** `/vector_stores`
8
9Returns a list of vector stores.
10
11### Parameters
12
13- `after: String`
14
15 A cursor for use in pagination. `after` is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, ending with obj_foo, your subsequent call can include after=obj_foo in order to fetch the next page of the list.
16
17- `before: String`
18
19 A cursor for use in pagination. `before` is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, starting with obj_foo, your subsequent call can include before=obj_foo in order to fetch the previous page of the list.
20
21- `limit: Integer`
22
23 A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 20.
24
25- `order: :asc | :desc`
26
27 Sort order by the `created_at` timestamp of the objects. `asc` for ascending order and `desc` for descending order.
28
29 - `:asc`
30
31 - `:desc`
32
33### Returns
34
35- `class VectorStore`
36
37 A vector store is a collection of processed files can be used by the `file_search` tool.
38
39 - `id: String`
40
41 The identifier, which can be referenced in API endpoints.
42
43 - `created_at: Integer`
44
45 The Unix timestamp (in seconds) for when the vector store was created.
46
47 - `file_counts: FileCounts{ cancelled, completed, failed, 2 more}`
48
49 - `cancelled: Integer`
50
51 The number of files that were cancelled.
52
53 - `completed: Integer`
54
55 The number of files that have been successfully processed.
56
57 - `failed: Integer`
58
59 The number of files that have failed to process.
60
61 - `in_progress: Integer`
62
63 The number of files that are currently being processed.
64
65 - `total: Integer`
66
67 The total number of files.
68
69 - `last_active_at: Integer`
70
71 The Unix timestamp (in seconds) for when the vector store was last active.
72
73 - `metadata: Metadata`
74
75 Set of 16 key-value pairs that can be attached to an object. This can be
76 useful for storing additional information about the object in a structured
77 format, and querying for objects via API or the dashboard.
78
79 Keys are strings with a maximum length of 64 characters. Values are strings
80 with a maximum length of 512 characters.
81
82 - `name: String`
83
84 The name of the vector store.
85
86 - `object: :vector_store`
87
88 The object type, which is always `vector_store`.
89
90 - `:vector_store`
91
92 - `status: :expired | :in_progress | :completed`
93
94 The status of the vector store, which can be either `expired`, `in_progress`, or `completed`. A status of `completed` indicates that the vector store is ready for use.
95
96 - `:expired`
97
98 - `:in_progress`
99
100 - `:completed`
101
102 - `usage_bytes: Integer`
103
104 The total number of bytes used by the files in the vector store.
105
106 - `expires_after: ExpiresAfter{ anchor, days}`
107
108 The expiration policy for a vector store.
109
110 - `anchor: :last_active_at`
111
112 Anchor timestamp after which the expiration policy applies. Supported anchors: `last_active_at`.
113
114 - `:last_active_at`
115
116 - `days: Integer`
117
118 The number of days after the anchor time that the vector store will expire.
119
120 - `expires_at: Integer`
121
122 The Unix timestamp (in seconds) for when the vector store will expire.
123
124### Example
125
126```ruby
127require "openai"
128
129openai = OpenAI::Client.new(api_key: "My API Key")
130
131page = openai.vector_stores.list
132
133puts(page)
134```
135
136#### Response
137
138```json
139{
140 "data": [
141 {
142 "id": "id",
143 "created_at": 0,
144 "file_counts": {
145 "cancelled": 0,
146 "completed": 0,
147 "failed": 0,
148 "in_progress": 0,
149 "total": 0
150 },
151 "last_active_at": 0,
152 "metadata": {
153 "foo": "string"
154 },
155 "name": "name",
156 "object": "vector_store",
157 "status": "expired",
158 "usage_bytes": 0,
159 "expires_after": {
160 "anchor": "last_active_at",
161 "days": 1
162 },
163 "expires_at": 0
164 }
165 ],
166 "first_id": "vs_abc123",
167 "has_more": false,
168 "last_id": "vs_abc456",
169 "object": "list"
170}
171```
172
173## Create vector store
174
175`vector_stores.create(**kwargs) -> VectorStore`
176
177**post** `/vector_stores`
178
179Create a vector store.
180
181### Parameters
182
183- `chunking_strategy: FileChunkingStrategyParam`
184
185 The chunking strategy used to chunk the file(s). If not set, will use the `auto` strategy. Only applicable if `file_ids` is non-empty.
186
187 - `class AutoFileChunkingStrategyParam`
188
189 The default strategy. This strategy currently uses a `max_chunk_size_tokens` of `800` and `chunk_overlap_tokens` of `400`.
190
191 - `type: :auto`
192
193 Always `auto`.
194
195 - `:auto`
196
197 - `class StaticFileChunkingStrategyObjectParam`
198
199 Customize your own chunking strategy by setting chunk size and chunk overlap.
200
201 - `static: StaticFileChunkingStrategy`
202
203 - `chunk_overlap_tokens: Integer`
204
205 The number of tokens that overlap between chunks. The default value is `400`.
206
207 Note that the overlap must not exceed half of `max_chunk_size_tokens`.
208
209 - `max_chunk_size_tokens: Integer`
210
211 The maximum number of tokens in each chunk. The default value is `800`. The minimum value is `100` and the maximum value is `4096`.
212
213 - `type: :static`
214
215 Always `static`.
216
217 - `:static`
218
219- `description: String`
220
221 A description for the vector store. Can be used to describe the vector store's purpose.
222
223- `expires_after: ExpiresAfter{ anchor, days}`
224
225 The expiration policy for a vector store.
226
227 - `anchor: :last_active_at`
228
229 Anchor timestamp after which the expiration policy applies. Supported anchors: `last_active_at`.
230
231 - `:last_active_at`
232
233 - `days: Integer`
234
235 The number of days after the anchor time that the vector store will expire.
236
237- `file_ids: Array[String]`
238
239 A list of [File](https://platform.openai.com/docs/api-reference/files) IDs that the vector store should use. Useful for tools like `file_search` that can access files.
240
241- `metadata: Metadata`
242
243 Set of 16 key-value pairs that can be attached to an object. This can be
244 useful for storing additional information about the object in a structured
245 format, and querying for objects via API or the dashboard.
246
247 Keys are strings with a maximum length of 64 characters. Values are strings
248 with a maximum length of 512 characters.
249
250- `name: String`
251
252 The name of the vector store.
253
254### Returns
255
256- `class VectorStore`
257
258 A vector store is a collection of processed files can be used by the `file_search` tool.
259
260 - `id: String`
261
262 The identifier, which can be referenced in API endpoints.
263
264 - `created_at: Integer`
265
266 The Unix timestamp (in seconds) for when the vector store was created.
267
268 - `file_counts: FileCounts{ cancelled, completed, failed, 2 more}`
269
270 - `cancelled: Integer`
271
272 The number of files that were cancelled.
273
274 - `completed: Integer`
275
276 The number of files that have been successfully processed.
277
278 - `failed: Integer`
279
280 The number of files that have failed to process.
281
282 - `in_progress: Integer`
283
284 The number of files that are currently being processed.
285
286 - `total: Integer`
287
288 The total number of files.
289
290 - `last_active_at: Integer`
291
292 The Unix timestamp (in seconds) for when the vector store was last active.
293
294 - `metadata: Metadata`
295
296 Set of 16 key-value pairs that can be attached to an object. This can be
297 useful for storing additional information about the object in a structured
298 format, and querying for objects via API or the dashboard.
299
300 Keys are strings with a maximum length of 64 characters. Values are strings
301 with a maximum length of 512 characters.
302
303 - `name: String`
304
305 The name of the vector store.
306
307 - `object: :vector_store`
308
309 The object type, which is always `vector_store`.
310
311 - `:vector_store`
312
313 - `status: :expired | :in_progress | :completed`
314
315 The status of the vector store, which can be either `expired`, `in_progress`, or `completed`. A status of `completed` indicates that the vector store is ready for use.
316
317 - `:expired`
318
319 - `:in_progress`
320
321 - `:completed`
322
323 - `usage_bytes: Integer`
324
325 The total number of bytes used by the files in the vector store.
326
327 - `expires_after: ExpiresAfter{ anchor, days}`
328
329 The expiration policy for a vector store.
330
331 - `anchor: :last_active_at`
332
333 Anchor timestamp after which the expiration policy applies. Supported anchors: `last_active_at`.
334
335 - `:last_active_at`
336
337 - `days: Integer`
338
339 The number of days after the anchor time that the vector store will expire.
340
341 - `expires_at: Integer`
342
343 The Unix timestamp (in seconds) for when the vector store will expire.
344
345### Example
346
347```ruby
348require "openai"
349
350openai = OpenAI::Client.new(api_key: "My API Key")
351
352vector_store = openai.vector_stores.create
353
354puts(vector_store)
355```
356
357#### Response
358
359```json
360{
361 "id": "id",
362 "created_at": 0,
363 "file_counts": {
364 "cancelled": 0,
365 "completed": 0,
366 "failed": 0,
367 "in_progress": 0,
368 "total": 0
369 },
370 "last_active_at": 0,
371 "metadata": {
372 "foo": "string"
373 },
374 "name": "name",
375 "object": "vector_store",
376 "status": "expired",
377 "usage_bytes": 0,
378 "expires_after": {
379 "anchor": "last_active_at",
380 "days": 1
381 },
382 "expires_at": 0
383}
384```
385
386## Retrieve vector store
387
388`vector_stores.retrieve(vector_store_id) -> VectorStore`
389
390**get** `/vector_stores/{vector_store_id}`
391
392Retrieves a vector store.
393
394### Parameters
395
396- `vector_store_id: String`
397
398### Returns
399
400- `class VectorStore`
401
402 A vector store is a collection of processed files can be used by the `file_search` tool.
403
404 - `id: String`
405
406 The identifier, which can be referenced in API endpoints.
407
408 - `created_at: Integer`
409
410 The Unix timestamp (in seconds) for when the vector store was created.
411
412 - `file_counts: FileCounts{ cancelled, completed, failed, 2 more}`
413
414 - `cancelled: Integer`
415
416 The number of files that were cancelled.
417
418 - `completed: Integer`
419
420 The number of files that have been successfully processed.
421
422 - `failed: Integer`
423
424 The number of files that have failed to process.
425
426 - `in_progress: Integer`
427
428 The number of files that are currently being processed.
429
430 - `total: Integer`
431
432 The total number of files.
433
434 - `last_active_at: Integer`
435
436 The Unix timestamp (in seconds) for when the vector store was last active.
437
438 - `metadata: Metadata`
439
440 Set of 16 key-value pairs that can be attached to an object. This can be
441 useful for storing additional information about the object in a structured
442 format, and querying for objects via API or the dashboard.
443
444 Keys are strings with a maximum length of 64 characters. Values are strings
445 with a maximum length of 512 characters.
446
447 - `name: String`
448
449 The name of the vector store.
450
451 - `object: :vector_store`
452
453 The object type, which is always `vector_store`.
454
455 - `:vector_store`
456
457 - `status: :expired | :in_progress | :completed`
458
459 The status of the vector store, which can be either `expired`, `in_progress`, or `completed`. A status of `completed` indicates that the vector store is ready for use.
460
461 - `:expired`
462
463 - `:in_progress`
464
465 - `:completed`
466
467 - `usage_bytes: Integer`
468
469 The total number of bytes used by the files in the vector store.
470
471 - `expires_after: ExpiresAfter{ anchor, days}`
472
473 The expiration policy for a vector store.
474
475 - `anchor: :last_active_at`
476
477 Anchor timestamp after which the expiration policy applies. Supported anchors: `last_active_at`.
478
479 - `:last_active_at`
480
481 - `days: Integer`
482
483 The number of days after the anchor time that the vector store will expire.
484
485 - `expires_at: Integer`
486
487 The Unix timestamp (in seconds) for when the vector store will expire.
488
489### Example
490
491```ruby
492require "openai"
493
494openai = OpenAI::Client.new(api_key: "My API Key")
495
496vector_store = openai.vector_stores.retrieve("vector_store_id")
497
498puts(vector_store)
499```
500
501#### Response
502
503```json
504{
505 "id": "id",
506 "created_at": 0,
507 "file_counts": {
508 "cancelled": 0,
509 "completed": 0,
510 "failed": 0,
511 "in_progress": 0,
512 "total": 0
513 },
514 "last_active_at": 0,
515 "metadata": {
516 "foo": "string"
517 },
518 "name": "name",
519 "object": "vector_store",
520 "status": "expired",
521 "usage_bytes": 0,
522 "expires_after": {
523 "anchor": "last_active_at",
524 "days": 1
525 },
526 "expires_at": 0
527}
528```
529
530## Modify vector store
531
532`vector_stores.update(vector_store_id, **kwargs) -> VectorStore`
533
534**post** `/vector_stores/{vector_store_id}`
535
536Modifies a vector store.
537
538### Parameters
539
540- `vector_store_id: String`
541
542- `expires_after: ExpiresAfter{ anchor, days}`
543
544 The expiration policy for a vector store.
545
546 - `anchor: :last_active_at`
547
548 Anchor timestamp after which the expiration policy applies. Supported anchors: `last_active_at`.
549
550 - `:last_active_at`
551
552 - `days: Integer`
553
554 The number of days after the anchor time that the vector store will expire.
555
556- `metadata: Metadata`
557
558 Set of 16 key-value pairs that can be attached to an object. This can be
559 useful for storing additional information about the object in a structured
560 format, and querying for objects via API or the dashboard.
561
562 Keys are strings with a maximum length of 64 characters. Values are strings
563 with a maximum length of 512 characters.
564
565- `name: String`
566
567 The name of the vector store.
568
569### Returns
570
571- `class VectorStore`
572
573 A vector store is a collection of processed files can be used by the `file_search` tool.
574
575 - `id: String`
576
577 The identifier, which can be referenced in API endpoints.
578
579 - `created_at: Integer`
580
581 The Unix timestamp (in seconds) for when the vector store was created.
582
583 - `file_counts: FileCounts{ cancelled, completed, failed, 2 more}`
584
585 - `cancelled: Integer`
586
587 The number of files that were cancelled.
588
589 - `completed: Integer`
590
591 The number of files that have been successfully processed.
592
593 - `failed: Integer`
594
595 The number of files that have failed to process.
596
597 - `in_progress: Integer`
598
599 The number of files that are currently being processed.
600
601 - `total: Integer`
602
603 The total number of files.
604
605 - `last_active_at: Integer`
606
607 The Unix timestamp (in seconds) for when the vector store was last active.
608
609 - `metadata: Metadata`
610
611 Set of 16 key-value pairs that can be attached to an object. This can be
612 useful for storing additional information about the object in a structured
613 format, and querying for objects via API or the dashboard.
614
615 Keys are strings with a maximum length of 64 characters. Values are strings
616 with a maximum length of 512 characters.
617
618 - `name: String`
619
620 The name of the vector store.
621
622 - `object: :vector_store`
623
624 The object type, which is always `vector_store`.
625
626 - `:vector_store`
627
628 - `status: :expired | :in_progress | :completed`
629
630 The status of the vector store, which can be either `expired`, `in_progress`, or `completed`. A status of `completed` indicates that the vector store is ready for use.
631
632 - `:expired`
633
634 - `:in_progress`
635
636 - `:completed`
637
638 - `usage_bytes: Integer`
639
640 The total number of bytes used by the files in the vector store.
641
642 - `expires_after: ExpiresAfter{ anchor, days}`
643
644 The expiration policy for a vector store.
645
646 - `anchor: :last_active_at`
647
648 Anchor timestamp after which the expiration policy applies. Supported anchors: `last_active_at`.
649
650 - `:last_active_at`
651
652 - `days: Integer`
653
654 The number of days after the anchor time that the vector store will expire.
655
656 - `expires_at: Integer`
657
658 The Unix timestamp (in seconds) for when the vector store will expire.
659
660### Example
661
662```ruby
663require "openai"
664
665openai = OpenAI::Client.new(api_key: "My API Key")
666
667vector_store = openai.vector_stores.update("vector_store_id")
668
669puts(vector_store)
670```
671
672#### Response
673
674```json
675{
676 "id": "id",
677 "created_at": 0,
678 "file_counts": {
679 "cancelled": 0,
680 "completed": 0,
681 "failed": 0,
682 "in_progress": 0,
683 "total": 0
684 },
685 "last_active_at": 0,
686 "metadata": {
687 "foo": "string"
688 },
689 "name": "name",
690 "object": "vector_store",
691 "status": "expired",
692 "usage_bytes": 0,
693 "expires_after": {
694 "anchor": "last_active_at",
695 "days": 1
696 },
697 "expires_at": 0
698}
699```
700
701## Delete vector store
702
703`vector_stores.delete(vector_store_id) -> VectorStoreDeleted`
704
705**delete** `/vector_stores/{vector_store_id}`
706
707Delete a vector store.
708
709### Parameters
710
711- `vector_store_id: String`
712
713### Returns
714
715- `class VectorStoreDeleted`
716
717 - `id: String`
718
719 - `deleted: bool`
720
721 - `object: :"vector_store.deleted"`
722
723 - `:"vector_store.deleted"`
724
725### Example
726
727```ruby
728require "openai"
729
730openai = OpenAI::Client.new(api_key: "My API Key")
731
732vector_store_deleted = openai.vector_stores.delete("vector_store_id")
733
734puts(vector_store_deleted)
735```
736
737#### Response
738
739```json
740{
741 "id": "id",
742 "deleted": true,
743 "object": "vector_store.deleted"
744}
745```
746
747## Search vector store
748
749`vector_stores.search(vector_store_id, **kwargs) -> Page<VectorStoreSearchResponse>`
750
751**post** `/vector_stores/{vector_store_id}/search`
752
753Search a vector store for relevant chunks based on a query and file attributes filter.
754
755### Parameters
756
757- `vector_store_id: String`
758
759- `query: String | Array[String]`
760
761 A query string for a search
762
763 - `String = String`
764
765 - `UnionMember1 = Array[String]`
766
767- `filters: ComparisonFilter | CompoundFilter`
768
769 A filter to apply based on file attributes.
770
771 - `class ComparisonFilter`
772
773 A filter used to compare a specified attribute key to a given value using a defined comparison operation.
774
775 - `key: String`
776
777 The key to compare against the value.
778
779 - `type: :eq | :ne | :gt | 5 more`
780
781 Specifies the comparison operator: `eq`, `ne`, `gt`, `gte`, `lt`, `lte`, `in`, `nin`.
782
783 - `eq`: equals
784 - `ne`: not equal
785 - `gt`: greater than
786 - `gte`: greater than or equal
787 - `lt`: less than
788 - `lte`: less than or equal
789 - `in`: in
790 - `nin`: not in
791
792 - `:eq`
793
794 - `:ne`
795
796 - `:gt`
797
798 - `:gte`
799
800 - `:lt`
801
802 - `:lte`
803
804 - `:in`
805
806 - `:nin`
807
808 - `value: String | Float | bool | Array[String | Float]`
809
810 The value to compare against the attribute key; supports string, number, or boolean types.
811
812 - `String = String`
813
814 - `Float = Float`
815
816 - `UnionMember2 = bool`
817
818 - `UnionMember3 = Array[String | Float]`
819
820 - `String = String`
821
822 - `Float = Float`
823
824 - `class CompoundFilter`
825
826 Combine multiple filters using `and` or `or`.
827
828 - `filters: Array[ComparisonFilter | untyped]`
829
830 Array of filters to combine. Items can be `ComparisonFilter` or `CompoundFilter`.
831
832 - `class ComparisonFilter`
833
834 A filter used to compare a specified attribute key to a given value using a defined comparison operation.
835
836 - `UnionMember1 = untyped`
837
838 - `type: :and | :or`
839
840 Type of operation: `and` or `or`.
841
842 - `:and`
843
844 - `:or`
845
846- `max_num_results: Integer`
847
848 The maximum number of results to return. This number should be between 1 and 50 inclusive.
849
850- `ranking_options: RankingOptions{ ranker, score_threshold}`
851
852 Ranking options for search.
853
854 - `ranker: :none | :auto | :"default-2024-11-15"`
855
856 Enable re-ranking; set to `none` to disable, which can help reduce latency.
857
858 - `:none`
859
860 - `:auto`
861
862 - `:"default-2024-11-15"`
863
864 - `score_threshold: Float`
865
866- `rewrite_query: bool`
867
868 Whether to rewrite the natural language query for vector search.
869
870### Returns
871
872- `class VectorStoreSearchResponse`
873
874 - `attributes: Hash[Symbol, String | Float | bool]`
875
876 Set of 16 key-value pairs that can be attached to an object. This can be
877 useful for storing additional information about the object in a structured
878 format, and querying for objects via API or the dashboard. Keys are strings
879 with a maximum length of 64 characters. Values are strings with a maximum
880 length of 512 characters, booleans, or numbers.
881
882 - `String = String`
883
884 - `Float = Float`
885
886 - `UnionMember2 = bool`
887
888 - `content: Array[Content{ text, type}]`
889
890 Content chunks from the file.
891
892 - `text: String`
893
894 The text content returned from search.
895
896 - `type: :text`
897
898 The type of content.
899
900 - `:text`
901
902 - `file_id: String`
903
904 The ID of the vector store file.
905
906 - `filename: String`
907
908 The name of the vector store file.
909
910 - `score: Float`
911
912 The similarity score for the result.
913
914### Example
915
916```ruby
917require "openai"
918
919openai = OpenAI::Client.new(api_key: "My API Key")
920
921page = openai.vector_stores.search("vs_abc123", query: "string")
922
923puts(page)
924```
925
926#### Response
927
928```json
929{
930 "data": [
931 {
932 "attributes": {
933 "foo": "string"
934 },
935 "content": [
936 {
937 "text": "text",
938 "type": "text"
939 }
940 ],
941 "file_id": "file_id",
942 "filename": "filename",
943 "score": 0
944 }
945 ],
946 "has_more": true,
947 "next_page": "next_page",
948 "object": "vector_store.search_results.page",
949 "search_query": [
950 "string"
951 ]
952}
953```
954
955## Domain Types
956
957### Auto File Chunking Strategy Param
958
959- `class AutoFileChunkingStrategyParam`
960
961 The default strategy. This strategy currently uses a `max_chunk_size_tokens` of `800` and `chunk_overlap_tokens` of `400`.
962
963 - `type: :auto`
964
965 Always `auto`.
966
967 - `:auto`
968
969### File Chunking Strategy
970
971- `FileChunkingStrategy = StaticFileChunkingStrategyObject | OtherFileChunkingStrategyObject`
972
973 The strategy used to chunk the file.
974
975 - `class StaticFileChunkingStrategyObject`
976
977 - `static: StaticFileChunkingStrategy`
978
979 - `chunk_overlap_tokens: Integer`
980
981 The number of tokens that overlap between chunks. The default value is `400`.
982
983 Note that the overlap must not exceed half of `max_chunk_size_tokens`.
984
985 - `max_chunk_size_tokens: Integer`
986
987 The maximum number of tokens in each chunk. The default value is `800`. The minimum value is `100` and the maximum value is `4096`.
988
989 - `type: :static`
990
991 Always `static`.
992
993 - `:static`
994
995 - `class OtherFileChunkingStrategyObject`
996
997 This is returned when the chunking strategy is unknown. Typically, this is because the file was indexed before the `chunking_strategy` concept was introduced in the API.
998
999 - `type: :other`
1000
1001 Always `other`.
1002
1003 - `:other`
1004
1005### File Chunking Strategy Param
1006
1007- `FileChunkingStrategyParam = AutoFileChunkingStrategyParam | StaticFileChunkingStrategyObjectParam`
1008
1009 The chunking strategy used to chunk the file(s). If not set, will use the `auto` strategy. Only applicable if `file_ids` is non-empty.
1010
1011 - `class AutoFileChunkingStrategyParam`
1012
1013 The default strategy. This strategy currently uses a `max_chunk_size_tokens` of `800` and `chunk_overlap_tokens` of `400`.
1014
1015 - `type: :auto`
1016
1017 Always `auto`.
1018
1019 - `:auto`
1020
1021 - `class StaticFileChunkingStrategyObjectParam`
1022
1023 Customize your own chunking strategy by setting chunk size and chunk overlap.
1024
1025 - `static: StaticFileChunkingStrategy`
1026
1027 - `chunk_overlap_tokens: Integer`
1028
1029 The number of tokens that overlap between chunks. The default value is `400`.
1030
1031 Note that the overlap must not exceed half of `max_chunk_size_tokens`.
1032
1033 - `max_chunk_size_tokens: Integer`
1034
1035 The maximum number of tokens in each chunk. The default value is `800`. The minimum value is `100` and the maximum value is `4096`.
1036
1037 - `type: :static`
1038
1039 Always `static`.
1040
1041 - `:static`
1042
1043### Other File Chunking Strategy Object
1044
1045- `class OtherFileChunkingStrategyObject`
1046
1047 This is returned when the chunking strategy is unknown. Typically, this is because the file was indexed before the `chunking_strategy` concept was introduced in the API.
1048
1049 - `type: :other`
1050
1051 Always `other`.
1052
1053 - `:other`
1054
1055### Static File Chunking Strategy
1056
1057- `class StaticFileChunkingStrategy`
1058
1059 - `chunk_overlap_tokens: Integer`
1060
1061 The number of tokens that overlap between chunks. The default value is `400`.
1062
1063 Note that the overlap must not exceed half of `max_chunk_size_tokens`.
1064
1065 - `max_chunk_size_tokens: Integer`
1066
1067 The maximum number of tokens in each chunk. The default value is `800`. The minimum value is `100` and the maximum value is `4096`.
1068
1069### Static File Chunking Strategy Object
1070
1071- `class StaticFileChunkingStrategyObject`
1072
1073 - `static: StaticFileChunkingStrategy`
1074
1075 - `chunk_overlap_tokens: Integer`
1076
1077 The number of tokens that overlap between chunks. The default value is `400`.
1078
1079 Note that the overlap must not exceed half of `max_chunk_size_tokens`.
1080
1081 - `max_chunk_size_tokens: Integer`
1082
1083 The maximum number of tokens in each chunk. The default value is `800`. The minimum value is `100` and the maximum value is `4096`.
1084
1085 - `type: :static`
1086
1087 Always `static`.
1088
1089 - `:static`
1090
1091### Static File Chunking Strategy Object Param
1092
1093- `class StaticFileChunkingStrategyObjectParam`
1094
1095 Customize your own chunking strategy by setting chunk size and chunk overlap.
1096
1097 - `static: StaticFileChunkingStrategy`
1098
1099 - `chunk_overlap_tokens: Integer`
1100
1101 The number of tokens that overlap between chunks. The default value is `400`.
1102
1103 Note that the overlap must not exceed half of `max_chunk_size_tokens`.
1104
1105 - `max_chunk_size_tokens: Integer`
1106
1107 The maximum number of tokens in each chunk. The default value is `800`. The minimum value is `100` and the maximum value is `4096`.
1108
1109 - `type: :static`
1110
1111 Always `static`.
1112
1113 - `:static`
1114
1115### Vector Store
1116
1117- `class VectorStore`
1118
1119 A vector store is a collection of processed files can be used by the `file_search` tool.
1120
1121 - `id: String`
1122
1123 The identifier, which can be referenced in API endpoints.
1124
1125 - `created_at: Integer`
1126
1127 The Unix timestamp (in seconds) for when the vector store was created.
1128
1129 - `file_counts: FileCounts{ cancelled, completed, failed, 2 more}`
1130
1131 - `cancelled: Integer`
1132
1133 The number of files that were cancelled.
1134
1135 - `completed: Integer`
1136
1137 The number of files that have been successfully processed.
1138
1139 - `failed: Integer`
1140
1141 The number of files that have failed to process.
1142
1143 - `in_progress: Integer`
1144
1145 The number of files that are currently being processed.
1146
1147 - `total: Integer`
1148
1149 The total number of files.
1150
1151 - `last_active_at: Integer`
1152
1153 The Unix timestamp (in seconds) for when the vector store was last active.
1154
1155 - `metadata: Metadata`
1156
1157 Set of 16 key-value pairs that can be attached to an object. This can be
1158 useful for storing additional information about the object in a structured
1159 format, and querying for objects via API or the dashboard.
1160
1161 Keys are strings with a maximum length of 64 characters. Values are strings
1162 with a maximum length of 512 characters.
1163
1164 - `name: String`
1165
1166 The name of the vector store.
1167
1168 - `object: :vector_store`
1169
1170 The object type, which is always `vector_store`.
1171
1172 - `:vector_store`
1173
1174 - `status: :expired | :in_progress | :completed`
1175
1176 The status of the vector store, which can be either `expired`, `in_progress`, or `completed`. A status of `completed` indicates that the vector store is ready for use.
1177
1178 - `:expired`
1179
1180 - `:in_progress`
1181
1182 - `:completed`
1183
1184 - `usage_bytes: Integer`
1185
1186 The total number of bytes used by the files in the vector store.
1187
1188 - `expires_after: ExpiresAfter{ anchor, days}`
1189
1190 The expiration policy for a vector store.
1191
1192 - `anchor: :last_active_at`
1193
1194 Anchor timestamp after which the expiration policy applies. Supported anchors: `last_active_at`.
1195
1196 - `:last_active_at`
1197
1198 - `days: Integer`
1199
1200 The number of days after the anchor time that the vector store will expire.
1201
1202 - `expires_at: Integer`
1203
1204 The Unix timestamp (in seconds) for when the vector store will expire.
1205
1206### Vector Store Deleted
1207
1208- `class VectorStoreDeleted`
1209
1210 - `id: String`
1211
1212 - `deleted: bool`
1213
1214 - `object: :"vector_store.deleted"`
1215
1216 - `:"vector_store.deleted"`
1217
1218### Vector Store Search Response
1219
1220- `class VectorStoreSearchResponse`
1221
1222 - `attributes: Hash[Symbol, String | Float | bool]`
1223
1224 Set of 16 key-value pairs that can be attached to an object. This can be
1225 useful for storing additional information about the object in a structured
1226 format, and querying for objects via API or the dashboard. Keys are strings
1227 with a maximum length of 64 characters. Values are strings with a maximum
1228 length of 512 characters, booleans, or numbers.
1229
1230 - `String = String`
1231
1232 - `Float = Float`
1233
1234 - `UnionMember2 = bool`
1235
1236 - `content: Array[Content{ text, type}]`
1237
1238 Content chunks from the file.
1239
1240 - `text: String`
1241
1242 The text content returned from search.
1243
1244 - `type: :text`
1245
1246 The type of content.
1247
1248 - `:text`
1249
1250 - `file_id: String`
1251
1252 The ID of the vector store file.
1253
1254 - `filename: String`
1255
1256 The name of the vector store file.
1257
1258 - `score: Float`
1259
1260 The similarity score for the result.
1261
1262# Files
1263
1264## List vector store files
1265
1266`vector_stores.files.list(vector_store_id, **kwargs) -> CursorPage<VectorStoreFile>`
1267
1268**get** `/vector_stores/{vector_store_id}/files`
1269
1270Returns a list of vector store files.
1271
1272### Parameters
1273
1274- `vector_store_id: String`
1275
1276- `after: String`
1277
1278 A cursor for use in pagination. `after` is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, ending with obj_foo, your subsequent call can include after=obj_foo in order to fetch the next page of the list.
1279
1280- `before: String`
1281
1282 A cursor for use in pagination. `before` is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, starting with obj_foo, your subsequent call can include before=obj_foo in order to fetch the previous page of the list.
1283
1284- `filter: :in_progress | :completed | :failed | :cancelled`
1285
1286 Filter by file status. One of `in_progress`, `completed`, `failed`, `cancelled`.
1287
1288 - `:in_progress`
1289
1290 - `:completed`
1291
1292 - `:failed`
1293
1294 - `:cancelled`
1295
1296- `limit: Integer`
1297
1298 A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 20.
1299
1300- `order: :asc | :desc`
1301
1302 Sort order by the `created_at` timestamp of the objects. `asc` for ascending order and `desc` for descending order.
1303
1304 - `:asc`
1305
1306 - `:desc`
1307
1308### Returns
1309
1310- `class VectorStoreFile`
1311
1312 A list of files attached to a vector store.
1313
1314 - `id: String`
1315
1316 The identifier, which can be referenced in API endpoints.
1317
1318 - `created_at: Integer`
1319
1320 The Unix timestamp (in seconds) for when the vector store file was created.
1321
1322 - `last_error: LastError{ code, message}`
1323
1324 The last error associated with this vector store file. Will be `null` if there are no errors.
1325
1326 - `code: :server_error | :unsupported_file | :invalid_file`
1327
1328 One of `server_error`, `unsupported_file`, or `invalid_file`.
1329
1330 - `:server_error`
1331
1332 - `:unsupported_file`
1333
1334 - `:invalid_file`
1335
1336 - `message: String`
1337
1338 A human-readable description of the error.
1339
1340 - `object: :"vector_store.file"`
1341
1342 The object type, which is always `vector_store.file`.
1343
1344 - `:"vector_store.file"`
1345
1346 - `status: :in_progress | :completed | :cancelled | :failed`
1347
1348 The status of the vector store file, which can be either `in_progress`, `completed`, `cancelled`, or `failed`. The status `completed` indicates that the vector store file is ready for use.
1349
1350 - `:in_progress`
1351
1352 - `:completed`
1353
1354 - `:cancelled`
1355
1356 - `:failed`
1357
1358 - `usage_bytes: Integer`
1359
1360 The total vector store usage in bytes. Note that this may be different from the original file size.
1361
1362 - `vector_store_id: String`
1363
1364 The ID of the [vector store](https://platform.openai.com/docs/api-reference/vector-stores/object) that the [File](https://platform.openai.com/docs/api-reference/files) is attached to.
1365
1366 - `attributes: Hash[Symbol, String | Float | bool]`
1367
1368 Set of 16 key-value pairs that can be attached to an object. This can be
1369 useful for storing additional information about the object in a structured
1370 format, and querying for objects via API or the dashboard. Keys are strings
1371 with a maximum length of 64 characters. Values are strings with a maximum
1372 length of 512 characters, booleans, or numbers.
1373
1374 - `String = String`
1375
1376 - `Float = Float`
1377
1378 - `UnionMember2 = bool`
1379
1380 - `chunking_strategy: FileChunkingStrategy`
1381
1382 The strategy used to chunk the file.
1383
1384 - `class StaticFileChunkingStrategyObject`
1385
1386 - `static: StaticFileChunkingStrategy`
1387
1388 - `chunk_overlap_tokens: Integer`
1389
1390 The number of tokens that overlap between chunks. The default value is `400`.
1391
1392 Note that the overlap must not exceed half of `max_chunk_size_tokens`.
1393
1394 - `max_chunk_size_tokens: Integer`
1395
1396 The maximum number of tokens in each chunk. The default value is `800`. The minimum value is `100` and the maximum value is `4096`.
1397
1398 - `type: :static`
1399
1400 Always `static`.
1401
1402 - `:static`
1403
1404 - `class OtherFileChunkingStrategyObject`
1405
1406 This is returned when the chunking strategy is unknown. Typically, this is because the file was indexed before the `chunking_strategy` concept was introduced in the API.
1407
1408 - `type: :other`
1409
1410 Always `other`.
1411
1412 - `:other`
1413
1414### Example
1415
1416```ruby
1417require "openai"
1418
1419openai = OpenAI::Client.new(api_key: "My API Key")
1420
1421page = openai.vector_stores.files.list("vector_store_id")
1422
1423puts(page)
1424```
1425
1426#### Response
1427
1428```json
1429{
1430 "data": [
1431 {
1432 "id": "id",
1433 "created_at": 0,
1434 "last_error": {
1435 "code": "server_error",
1436 "message": "message"
1437 },
1438 "object": "vector_store.file",
1439 "status": "in_progress",
1440 "usage_bytes": 0,
1441 "vector_store_id": "vector_store_id",
1442 "attributes": {
1443 "foo": "string"
1444 },
1445 "chunking_strategy": {
1446 "static": {
1447 "chunk_overlap_tokens": 0,
1448 "max_chunk_size_tokens": 100
1449 },
1450 "type": "static"
1451 }
1452 }
1453 ],
1454 "first_id": "file-abc123",
1455 "has_more": false,
1456 "last_id": "file-abc456",
1457 "object": "list"
1458}
1459```
1460
1461## Create vector store file
1462
1463`vector_stores.files.create(vector_store_id, **kwargs) -> VectorStoreFile`
1464
1465**post** `/vector_stores/{vector_store_id}/files`
1466
1467Create a vector store file by attaching a [File](https://platform.openai.com/docs/api-reference/files) to a [vector store](https://platform.openai.com/docs/api-reference/vector-stores/object).
1468
1469### Parameters
1470
1471- `vector_store_id: String`
1472
1473- `file_id: String`
1474
1475 A [File](https://platform.openai.com/docs/api-reference/files) ID that the vector store should use. Useful for tools like `file_search` that can access files. For multi-file ingestion, we recommend [`file_batches`](https://platform.openai.com/docs/api-reference/vector-stores-file-batches/createBatch) to minimize per-vector-store write requests.
1476
1477- `attributes: Hash[Symbol, String | Float | bool]`
1478
1479 Set of 16 key-value pairs that can be attached to an object. This can be
1480 useful for storing additional information about the object in a structured
1481 format, and querying for objects via API or the dashboard. Keys are strings
1482 with a maximum length of 64 characters. Values are strings with a maximum
1483 length of 512 characters, booleans, or numbers.
1484
1485 - `String = String`
1486
1487 - `Float = Float`
1488
1489 - `UnionMember2 = bool`
1490
1491- `chunking_strategy: FileChunkingStrategyParam`
1492
1493 The chunking strategy used to chunk the file(s). If not set, will use the `auto` strategy. Only applicable if `file_ids` is non-empty.
1494
1495 - `class AutoFileChunkingStrategyParam`
1496
1497 The default strategy. This strategy currently uses a `max_chunk_size_tokens` of `800` and `chunk_overlap_tokens` of `400`.
1498
1499 - `type: :auto`
1500
1501 Always `auto`.
1502
1503 - `:auto`
1504
1505 - `class StaticFileChunkingStrategyObjectParam`
1506
1507 Customize your own chunking strategy by setting chunk size and chunk overlap.
1508
1509 - `static: StaticFileChunkingStrategy`
1510
1511 - `chunk_overlap_tokens: Integer`
1512
1513 The number of tokens that overlap between chunks. The default value is `400`.
1514
1515 Note that the overlap must not exceed half of `max_chunk_size_tokens`.
1516
1517 - `max_chunk_size_tokens: Integer`
1518
1519 The maximum number of tokens in each chunk. The default value is `800`. The minimum value is `100` and the maximum value is `4096`.
1520
1521 - `type: :static`
1522
1523 Always `static`.
1524
1525 - `:static`
1526
1527### Returns
1528
1529- `class VectorStoreFile`
1530
1531 A list of files attached to a vector store.
1532
1533 - `id: String`
1534
1535 The identifier, which can be referenced in API endpoints.
1536
1537 - `created_at: Integer`
1538
1539 The Unix timestamp (in seconds) for when the vector store file was created.
1540
1541 - `last_error: LastError{ code, message}`
1542
1543 The last error associated with this vector store file. Will be `null` if there are no errors.
1544
1545 - `code: :server_error | :unsupported_file | :invalid_file`
1546
1547 One of `server_error`, `unsupported_file`, or `invalid_file`.
1548
1549 - `:server_error`
1550
1551 - `:unsupported_file`
1552
1553 - `:invalid_file`
1554
1555 - `message: String`
1556
1557 A human-readable description of the error.
1558
1559 - `object: :"vector_store.file"`
1560
1561 The object type, which is always `vector_store.file`.
1562
1563 - `:"vector_store.file"`
1564
1565 - `status: :in_progress | :completed | :cancelled | :failed`
1566
1567 The status of the vector store file, which can be either `in_progress`, `completed`, `cancelled`, or `failed`. The status `completed` indicates that the vector store file is ready for use.
1568
1569 - `:in_progress`
1570
1571 - `:completed`
1572
1573 - `:cancelled`
1574
1575 - `:failed`
1576
1577 - `usage_bytes: Integer`
1578
1579 The total vector store usage in bytes. Note that this may be different from the original file size.
1580
1581 - `vector_store_id: String`
1582
1583 The ID of the [vector store](https://platform.openai.com/docs/api-reference/vector-stores/object) that the [File](https://platform.openai.com/docs/api-reference/files) is attached to.
1584
1585 - `attributes: Hash[Symbol, String | Float | bool]`
1586
1587 Set of 16 key-value pairs that can be attached to an object. This can be
1588 useful for storing additional information about the object in a structured
1589 format, and querying for objects via API or the dashboard. Keys are strings
1590 with a maximum length of 64 characters. Values are strings with a maximum
1591 length of 512 characters, booleans, or numbers.
1592
1593 - `String = String`
1594
1595 - `Float = Float`
1596
1597 - `UnionMember2 = bool`
1598
1599 - `chunking_strategy: FileChunkingStrategy`
1600
1601 The strategy used to chunk the file.
1602
1603 - `class StaticFileChunkingStrategyObject`
1604
1605 - `static: StaticFileChunkingStrategy`
1606
1607 - `chunk_overlap_tokens: Integer`
1608
1609 The number of tokens that overlap between chunks. The default value is `400`.
1610
1611 Note that the overlap must not exceed half of `max_chunk_size_tokens`.
1612
1613 - `max_chunk_size_tokens: Integer`
1614
1615 The maximum number of tokens in each chunk. The default value is `800`. The minimum value is `100` and the maximum value is `4096`.
1616
1617 - `type: :static`
1618
1619 Always `static`.
1620
1621 - `:static`
1622
1623 - `class OtherFileChunkingStrategyObject`
1624
1625 This is returned when the chunking strategy is unknown. Typically, this is because the file was indexed before the `chunking_strategy` concept was introduced in the API.
1626
1627 - `type: :other`
1628
1629 Always `other`.
1630
1631 - `:other`
1632
1633### Example
1634
1635```ruby
1636require "openai"
1637
1638openai = OpenAI::Client.new(api_key: "My API Key")
1639
1640vector_store_file = openai.vector_stores.files.create("vs_abc123", file_id: "file_id")
1641
1642puts(vector_store_file)
1643```
1644
1645#### Response
1646
1647```json
1648{
1649 "id": "id",
1650 "created_at": 0,
1651 "last_error": {
1652 "code": "server_error",
1653 "message": "message"
1654 },
1655 "object": "vector_store.file",
1656 "status": "in_progress",
1657 "usage_bytes": 0,
1658 "vector_store_id": "vector_store_id",
1659 "attributes": {
1660 "foo": "string"
1661 },
1662 "chunking_strategy": {
1663 "static": {
1664 "chunk_overlap_tokens": 0,
1665 "max_chunk_size_tokens": 100
1666 },
1667 "type": "static"
1668 }
1669}
1670```
1671
1672## Update vector store file attributes
1673
1674`vector_stores.files.update(file_id, **kwargs) -> VectorStoreFile`
1675
1676**post** `/vector_stores/{vector_store_id}/files/{file_id}`
1677
1678Update attributes on a vector store file.
1679
1680### Parameters
1681
1682- `vector_store_id: String`
1683
1684- `file_id: String`
1685
1686- `attributes: Hash[Symbol, String | Float | bool]`
1687
1688 Set of 16 key-value pairs that can be attached to an object. This can be
1689 useful for storing additional information about the object in a structured
1690 format, and querying for objects via API or the dashboard. Keys are strings
1691 with a maximum length of 64 characters. Values are strings with a maximum
1692 length of 512 characters, booleans, or numbers.
1693
1694 - `String = String`
1695
1696 - `Float = Float`
1697
1698 - `UnionMember2 = bool`
1699
1700### Returns
1701
1702- `class VectorStoreFile`
1703
1704 A list of files attached to a vector store.
1705
1706 - `id: String`
1707
1708 The identifier, which can be referenced in API endpoints.
1709
1710 - `created_at: Integer`
1711
1712 The Unix timestamp (in seconds) for when the vector store file was created.
1713
1714 - `last_error: LastError{ code, message}`
1715
1716 The last error associated with this vector store file. Will be `null` if there are no errors.
1717
1718 - `code: :server_error | :unsupported_file | :invalid_file`
1719
1720 One of `server_error`, `unsupported_file`, or `invalid_file`.
1721
1722 - `:server_error`
1723
1724 - `:unsupported_file`
1725
1726 - `:invalid_file`
1727
1728 - `message: String`
1729
1730 A human-readable description of the error.
1731
1732 - `object: :"vector_store.file"`
1733
1734 The object type, which is always `vector_store.file`.
1735
1736 - `:"vector_store.file"`
1737
1738 - `status: :in_progress | :completed | :cancelled | :failed`
1739
1740 The status of the vector store file, which can be either `in_progress`, `completed`, `cancelled`, or `failed`. The status `completed` indicates that the vector store file is ready for use.
1741
1742 - `:in_progress`
1743
1744 - `:completed`
1745
1746 - `:cancelled`
1747
1748 - `:failed`
1749
1750 - `usage_bytes: Integer`
1751
1752 The total vector store usage in bytes. Note that this may be different from the original file size.
1753
1754 - `vector_store_id: String`
1755
1756 The ID of the [vector store](https://platform.openai.com/docs/api-reference/vector-stores/object) that the [File](https://platform.openai.com/docs/api-reference/files) is attached to.
1757
1758 - `attributes: Hash[Symbol, String | Float | bool]`
1759
1760 Set of 16 key-value pairs that can be attached to an object. This can be
1761 useful for storing additional information about the object in a structured
1762 format, and querying for objects via API or the dashboard. Keys are strings
1763 with a maximum length of 64 characters. Values are strings with a maximum
1764 length of 512 characters, booleans, or numbers.
1765
1766 - `String = String`
1767
1768 - `Float = Float`
1769
1770 - `UnionMember2 = bool`
1771
1772 - `chunking_strategy: FileChunkingStrategy`
1773
1774 The strategy used to chunk the file.
1775
1776 - `class StaticFileChunkingStrategyObject`
1777
1778 - `static: StaticFileChunkingStrategy`
1779
1780 - `chunk_overlap_tokens: Integer`
1781
1782 The number of tokens that overlap between chunks. The default value is `400`.
1783
1784 Note that the overlap must not exceed half of `max_chunk_size_tokens`.
1785
1786 - `max_chunk_size_tokens: Integer`
1787
1788 The maximum number of tokens in each chunk. The default value is `800`. The minimum value is `100` and the maximum value is `4096`.
1789
1790 - `type: :static`
1791
1792 Always `static`.
1793
1794 - `:static`
1795
1796 - `class OtherFileChunkingStrategyObject`
1797
1798 This is returned when the chunking strategy is unknown. Typically, this is because the file was indexed before the `chunking_strategy` concept was introduced in the API.
1799
1800 - `type: :other`
1801
1802 Always `other`.
1803
1804 - `:other`
1805
1806### Example
1807
1808```ruby
1809require "openai"
1810
1811openai = OpenAI::Client.new(api_key: "My API Key")
1812
1813vector_store_file = openai.vector_stores.files.update(
1814 "file-abc123",
1815 vector_store_id: "vs_abc123",
1816 attributes: {foo: "string"}
1817)
1818
1819puts(vector_store_file)
1820```
1821
1822#### Response
1823
1824```json
1825{
1826 "id": "id",
1827 "created_at": 0,
1828 "last_error": {
1829 "code": "server_error",
1830 "message": "message"
1831 },
1832 "object": "vector_store.file",
1833 "status": "in_progress",
1834 "usage_bytes": 0,
1835 "vector_store_id": "vector_store_id",
1836 "attributes": {
1837 "foo": "string"
1838 },
1839 "chunking_strategy": {
1840 "static": {
1841 "chunk_overlap_tokens": 0,
1842 "max_chunk_size_tokens": 100
1843 },
1844 "type": "static"
1845 }
1846}
1847```
1848
1849## Retrieve vector store file
1850
1851`vector_stores.files.retrieve(file_id, **kwargs) -> VectorStoreFile`
1852
1853**get** `/vector_stores/{vector_store_id}/files/{file_id}`
1854
1855Retrieves a vector store file.
1856
1857### Parameters
1858
1859- `vector_store_id: String`
1860
1861- `file_id: String`
1862
1863### Returns
1864
1865- `class VectorStoreFile`
1866
1867 A list of files attached to a vector store.
1868
1869 - `id: String`
1870
1871 The identifier, which can be referenced in API endpoints.
1872
1873 - `created_at: Integer`
1874
1875 The Unix timestamp (in seconds) for when the vector store file was created.
1876
1877 - `last_error: LastError{ code, message}`
1878
1879 The last error associated with this vector store file. Will be `null` if there are no errors.
1880
1881 - `code: :server_error | :unsupported_file | :invalid_file`
1882
1883 One of `server_error`, `unsupported_file`, or `invalid_file`.
1884
1885 - `:server_error`
1886
1887 - `:unsupported_file`
1888
1889 - `:invalid_file`
1890
1891 - `message: String`
1892
1893 A human-readable description of the error.
1894
1895 - `object: :"vector_store.file"`
1896
1897 The object type, which is always `vector_store.file`.
1898
1899 - `:"vector_store.file"`
1900
1901 - `status: :in_progress | :completed | :cancelled | :failed`
1902
1903 The status of the vector store file, which can be either `in_progress`, `completed`, `cancelled`, or `failed`. The status `completed` indicates that the vector store file is ready for use.
1904
1905 - `:in_progress`
1906
1907 - `:completed`
1908
1909 - `:cancelled`
1910
1911 - `:failed`
1912
1913 - `usage_bytes: Integer`
1914
1915 The total vector store usage in bytes. Note that this may be different from the original file size.
1916
1917 - `vector_store_id: String`
1918
1919 The ID of the [vector store](https://platform.openai.com/docs/api-reference/vector-stores/object) that the [File](https://platform.openai.com/docs/api-reference/files) is attached to.
1920
1921 - `attributes: Hash[Symbol, String | Float | bool]`
1922
1923 Set of 16 key-value pairs that can be attached to an object. This can be
1924 useful for storing additional information about the object in a structured
1925 format, and querying for objects via API or the dashboard. Keys are strings
1926 with a maximum length of 64 characters. Values are strings with a maximum
1927 length of 512 characters, booleans, or numbers.
1928
1929 - `String = String`
1930
1931 - `Float = Float`
1932
1933 - `UnionMember2 = bool`
1934
1935 - `chunking_strategy: FileChunkingStrategy`
1936
1937 The strategy used to chunk the file.
1938
1939 - `class StaticFileChunkingStrategyObject`
1940
1941 - `static: StaticFileChunkingStrategy`
1942
1943 - `chunk_overlap_tokens: Integer`
1944
1945 The number of tokens that overlap between chunks. The default value is `400`.
1946
1947 Note that the overlap must not exceed half of `max_chunk_size_tokens`.
1948
1949 - `max_chunk_size_tokens: Integer`
1950
1951 The maximum number of tokens in each chunk. The default value is `800`. The minimum value is `100` and the maximum value is `4096`.
1952
1953 - `type: :static`
1954
1955 Always `static`.
1956
1957 - `:static`
1958
1959 - `class OtherFileChunkingStrategyObject`
1960
1961 This is returned when the chunking strategy is unknown. Typically, this is because the file was indexed before the `chunking_strategy` concept was introduced in the API.
1962
1963 - `type: :other`
1964
1965 Always `other`.
1966
1967 - `:other`
1968
1969### Example
1970
1971```ruby
1972require "openai"
1973
1974openai = OpenAI::Client.new(api_key: "My API Key")
1975
1976vector_store_file = openai.vector_stores.files.retrieve("file-abc123", vector_store_id: "vs_abc123")
1977
1978puts(vector_store_file)
1979```
1980
1981#### Response
1982
1983```json
1984{
1985 "id": "id",
1986 "created_at": 0,
1987 "last_error": {
1988 "code": "server_error",
1989 "message": "message"
1990 },
1991 "object": "vector_store.file",
1992 "status": "in_progress",
1993 "usage_bytes": 0,
1994 "vector_store_id": "vector_store_id",
1995 "attributes": {
1996 "foo": "string"
1997 },
1998 "chunking_strategy": {
1999 "static": {
2000 "chunk_overlap_tokens": 0,
2001 "max_chunk_size_tokens": 100
2002 },
2003 "type": "static"
2004 }
2005}
2006```
2007
2008## Delete vector store file
2009
2010`vector_stores.files.delete(file_id, **kwargs) -> VectorStoreFileDeleted`
2011
2012**delete** `/vector_stores/{vector_store_id}/files/{file_id}`
2013
2014Delete a vector store file. This will remove the file from the vector store but the file itself will not be deleted. To delete the file, use the [delete file](https://platform.openai.com/docs/api-reference/files/delete) endpoint.
2015
2016### Parameters
2017
2018- `vector_store_id: String`
2019
2020- `file_id: String`
2021
2022### Returns
2023
2024- `class VectorStoreFileDeleted`
2025
2026 - `id: String`
2027
2028 - `deleted: bool`
2029
2030 - `object: :"vector_store.file.deleted"`
2031
2032 - `:"vector_store.file.deleted"`
2033
2034### Example
2035
2036```ruby
2037require "openai"
2038
2039openai = OpenAI::Client.new(api_key: "My API Key")
2040
2041vector_store_file_deleted = openai.vector_stores.files.delete("file_id", vector_store_id: "vector_store_id")
2042
2043puts(vector_store_file_deleted)
2044```
2045
2046#### Response
2047
2048```json
2049{
2050 "id": "id",
2051 "deleted": true,
2052 "object": "vector_store.file.deleted"
2053}
2054```
2055
2056## Retrieve vector store file content
2057
2058`vector_stores.files.content(file_id, **kwargs) -> Page<FileContentResponse>`
2059
2060**get** `/vector_stores/{vector_store_id}/files/{file_id}/content`
2061
2062Retrieve the parsed contents of a vector store file.
2063
2064### Parameters
2065
2066- `vector_store_id: String`
2067
2068- `file_id: String`
2069
2070### Returns
2071
2072- `class FileContentResponse`
2073
2074 - `text: String`
2075
2076 The text content
2077
2078 - `type: String`
2079
2080 The content type (currently only `"text"`)
2081
2082### Example
2083
2084```ruby
2085require "openai"
2086
2087openai = OpenAI::Client.new(api_key: "My API Key")
2088
2089page = openai.vector_stores.files.content("file-abc123", vector_store_id: "vs_abc123")
2090
2091puts(page)
2092```
2093
2094#### Response
2095
2096```json
2097{
2098 "data": [
2099 {
2100 "text": "text",
2101 "type": "type"
2102 }
2103 ],
2104 "has_more": true,
2105 "next_page": "next_page",
2106 "object": "vector_store.file_content.page"
2107}
2108```
2109
2110## Domain Types
2111
2112### Vector Store File
2113
2114- `class VectorStoreFile`
2115
2116 A list of files attached to a vector store.
2117
2118 - `id: String`
2119
2120 The identifier, which can be referenced in API endpoints.
2121
2122 - `created_at: Integer`
2123
2124 The Unix timestamp (in seconds) for when the vector store file was created.
2125
2126 - `last_error: LastError{ code, message}`
2127
2128 The last error associated with this vector store file. Will be `null` if there are no errors.
2129
2130 - `code: :server_error | :unsupported_file | :invalid_file`
2131
2132 One of `server_error`, `unsupported_file`, or `invalid_file`.
2133
2134 - `:server_error`
2135
2136 - `:unsupported_file`
2137
2138 - `:invalid_file`
2139
2140 - `message: String`
2141
2142 A human-readable description of the error.
2143
2144 - `object: :"vector_store.file"`
2145
2146 The object type, which is always `vector_store.file`.
2147
2148 - `:"vector_store.file"`
2149
2150 - `status: :in_progress | :completed | :cancelled | :failed`
2151
2152 The status of the vector store file, which can be either `in_progress`, `completed`, `cancelled`, or `failed`. The status `completed` indicates that the vector store file is ready for use.
2153
2154 - `:in_progress`
2155
2156 - `:completed`
2157
2158 - `:cancelled`
2159
2160 - `:failed`
2161
2162 - `usage_bytes: Integer`
2163
2164 The total vector store usage in bytes. Note that this may be different from the original file size.
2165
2166 - `vector_store_id: String`
2167
2168 The ID of the [vector store](https://platform.openai.com/docs/api-reference/vector-stores/object) that the [File](https://platform.openai.com/docs/api-reference/files) is attached to.
2169
2170 - `attributes: Hash[Symbol, String | Float | bool]`
2171
2172 Set of 16 key-value pairs that can be attached to an object. This can be
2173 useful for storing additional information about the object in a structured
2174 format, and querying for objects via API or the dashboard. Keys are strings
2175 with a maximum length of 64 characters. Values are strings with a maximum
2176 length of 512 characters, booleans, or numbers.
2177
2178 - `String = String`
2179
2180 - `Float = Float`
2181
2182 - `UnionMember2 = bool`
2183
2184 - `chunking_strategy: FileChunkingStrategy`
2185
2186 The strategy used to chunk the file.
2187
2188 - `class StaticFileChunkingStrategyObject`
2189
2190 - `static: StaticFileChunkingStrategy`
2191
2192 - `chunk_overlap_tokens: Integer`
2193
2194 The number of tokens that overlap between chunks. The default value is `400`.
2195
2196 Note that the overlap must not exceed half of `max_chunk_size_tokens`.
2197
2198 - `max_chunk_size_tokens: Integer`
2199
2200 The maximum number of tokens in each chunk. The default value is `800`. The minimum value is `100` and the maximum value is `4096`.
2201
2202 - `type: :static`
2203
2204 Always `static`.
2205
2206 - `:static`
2207
2208 - `class OtherFileChunkingStrategyObject`
2209
2210 This is returned when the chunking strategy is unknown. Typically, this is because the file was indexed before the `chunking_strategy` concept was introduced in the API.
2211
2212 - `type: :other`
2213
2214 Always `other`.
2215
2216 - `:other`
2217
2218### Vector Store File Deleted
2219
2220- `class VectorStoreFileDeleted`
2221
2222 - `id: String`
2223
2224 - `deleted: bool`
2225
2226 - `object: :"vector_store.file.deleted"`
2227
2228 - `:"vector_store.file.deleted"`
2229
2230### File Content Response
2231
2232- `class FileContentResponse`
2233
2234 - `text: String`
2235
2236 The text content
2237
2238 - `type: String`
2239
2240 The content type (currently only `"text"`)
2241
2242# File Batches
2243
2244## Create vector store file batch
2245
2246`vector_stores.file_batches.create(vector_store_id, **kwargs) -> VectorStoreFileBatch`
2247
2248**post** `/vector_stores/{vector_store_id}/file_batches`
2249
2250Create a vector store file batch.
2251
2252### Parameters
2253
2254- `vector_store_id: String`
2255
2256- `attributes: Hash[Symbol, String | Float | bool]`
2257
2258 Set of 16 key-value pairs that can be attached to an object. This can be
2259 useful for storing additional information about the object in a structured
2260 format, and querying for objects via API or the dashboard. Keys are strings
2261 with a maximum length of 64 characters. Values are strings with a maximum
2262 length of 512 characters, booleans, or numbers.
2263
2264 - `String = String`
2265
2266 - `Float = Float`
2267
2268 - `UnionMember2 = bool`
2269
2270- `chunking_strategy: FileChunkingStrategyParam`
2271
2272 The chunking strategy used to chunk the file(s). If not set, will use the `auto` strategy. Only applicable if `file_ids` is non-empty.
2273
2274 - `class AutoFileChunkingStrategyParam`
2275
2276 The default strategy. This strategy currently uses a `max_chunk_size_tokens` of `800` and `chunk_overlap_tokens` of `400`.
2277
2278 - `type: :auto`
2279
2280 Always `auto`.
2281
2282 - `:auto`
2283
2284 - `class StaticFileChunkingStrategyObjectParam`
2285
2286 Customize your own chunking strategy by setting chunk size and chunk overlap.
2287
2288 - `static: StaticFileChunkingStrategy`
2289
2290 - `chunk_overlap_tokens: Integer`
2291
2292 The number of tokens that overlap between chunks. The default value is `400`.
2293
2294 Note that the overlap must not exceed half of `max_chunk_size_tokens`.
2295
2296 - `max_chunk_size_tokens: Integer`
2297
2298 The maximum number of tokens in each chunk. The default value is `800`. The minimum value is `100` and the maximum value is `4096`.
2299
2300 - `type: :static`
2301
2302 Always `static`.
2303
2304 - `:static`
2305
2306- `file_ids: Array[String]`
2307
2308 A list of [File](https://platform.openai.com/docs/api-reference/files) IDs that the vector store should use. Useful for tools like `file_search` that can access files. If `attributes` or `chunking_strategy` are provided, they will be applied to all files in the batch. The maximum batch size is 2000 files. This endpoint is recommended for multi-file ingestion and helps reduce per-vector-store write request pressure. Mutually exclusive with `files`.
2309
2310- `files: Array[File{ file_id, attributes, chunking_strategy}]`
2311
2312 A list of objects that each include a `file_id` plus optional `attributes` or `chunking_strategy`. Use this when you need to override metadata for specific files. The global `attributes` or `chunking_strategy` will be ignored and must be specified for each file. The maximum batch size is 2000 files. This endpoint is recommended for multi-file ingestion and helps reduce per-vector-store write request pressure. Mutually exclusive with `file_ids`.
2313
2314 - `file_id: String`
2315
2316 A [File](https://platform.openai.com/docs/api-reference/files) ID that the vector store should use. Useful for tools like `file_search` that can access files. For multi-file ingestion, we recommend [`file_batches`](https://platform.openai.com/docs/api-reference/vector-stores-file-batches/createBatch) to minimize per-vector-store write requests.
2317
2318 - `attributes: Hash[Symbol, String | Float | bool]`
2319
2320 Set of 16 key-value pairs that can be attached to an object. This can be
2321 useful for storing additional information about the object in a structured
2322 format, and querying for objects via API or the dashboard. Keys are strings
2323 with a maximum length of 64 characters. Values are strings with a maximum
2324 length of 512 characters, booleans, or numbers.
2325
2326 - `String = String`
2327
2328 - `Float = Float`
2329
2330 - `UnionMember2 = bool`
2331
2332 - `chunking_strategy: FileChunkingStrategyParam`
2333
2334 The chunking strategy used to chunk the file(s). If not set, will use the `auto` strategy. Only applicable if `file_ids` is non-empty.
2335
2336### Returns
2337
2338- `class VectorStoreFileBatch`
2339
2340 A batch of files attached to a vector store.
2341
2342 - `id: String`
2343
2344 The identifier, which can be referenced in API endpoints.
2345
2346 - `created_at: Integer`
2347
2348 The Unix timestamp (in seconds) for when the vector store files batch was created.
2349
2350 - `file_counts: FileCounts{ cancelled, completed, failed, 2 more}`
2351
2352 - `cancelled: Integer`
2353
2354 The number of files that where cancelled.
2355
2356 - `completed: Integer`
2357
2358 The number of files that have been processed.
2359
2360 - `failed: Integer`
2361
2362 The number of files that have failed to process.
2363
2364 - `in_progress: Integer`
2365
2366 The number of files that are currently being processed.
2367
2368 - `total: Integer`
2369
2370 The total number of files.
2371
2372 - `object: :"vector_store.files_batch"`
2373
2374 The object type, which is always `vector_store.file_batch`.
2375
2376 - `:"vector_store.files_batch"`
2377
2378 - `status: :in_progress | :completed | :cancelled | :failed`
2379
2380 The status of the vector store files batch, which can be either `in_progress`, `completed`, `cancelled` or `failed`.
2381
2382 - `:in_progress`
2383
2384 - `:completed`
2385
2386 - `:cancelled`
2387
2388 - `:failed`
2389
2390 - `vector_store_id: String`
2391
2392 The ID of the [vector store](https://platform.openai.com/docs/api-reference/vector-stores/object) that the [File](https://platform.openai.com/docs/api-reference/files) is attached to.
2393
2394### Example
2395
2396```ruby
2397require "openai"
2398
2399openai = OpenAI::Client.new(api_key: "My API Key")
2400
2401vector_store_file_batch = openai.vector_stores.file_batches.create("vs_abc123")
2402
2403puts(vector_store_file_batch)
2404```
2405
2406#### Response
2407
2408```json
2409{
2410 "id": "id",
2411 "created_at": 0,
2412 "file_counts": {
2413 "cancelled": 0,
2414 "completed": 0,
2415 "failed": 0,
2416 "in_progress": 0,
2417 "total": 0
2418 },
2419 "object": "vector_store.files_batch",
2420 "status": "in_progress",
2421 "vector_store_id": "vector_store_id"
2422}
2423```
2424
2425## Retrieve vector store file batch
2426
2427`vector_stores.file_batches.retrieve(batch_id, **kwargs) -> VectorStoreFileBatch`
2428
2429**get** `/vector_stores/{vector_store_id}/file_batches/{batch_id}`
2430
2431Retrieves a vector store file batch.
2432
2433### Parameters
2434
2435- `vector_store_id: String`
2436
2437- `batch_id: String`
2438
2439### Returns
2440
2441- `class VectorStoreFileBatch`
2442
2443 A batch of files attached to a vector store.
2444
2445 - `id: String`
2446
2447 The identifier, which can be referenced in API endpoints.
2448
2449 - `created_at: Integer`
2450
2451 The Unix timestamp (in seconds) for when the vector store files batch was created.
2452
2453 - `file_counts: FileCounts{ cancelled, completed, failed, 2 more}`
2454
2455 - `cancelled: Integer`
2456
2457 The number of files that where cancelled.
2458
2459 - `completed: Integer`
2460
2461 The number of files that have been processed.
2462
2463 - `failed: Integer`
2464
2465 The number of files that have failed to process.
2466
2467 - `in_progress: Integer`
2468
2469 The number of files that are currently being processed.
2470
2471 - `total: Integer`
2472
2473 The total number of files.
2474
2475 - `object: :"vector_store.files_batch"`
2476
2477 The object type, which is always `vector_store.file_batch`.
2478
2479 - `:"vector_store.files_batch"`
2480
2481 - `status: :in_progress | :completed | :cancelled | :failed`
2482
2483 The status of the vector store files batch, which can be either `in_progress`, `completed`, `cancelled` or `failed`.
2484
2485 - `:in_progress`
2486
2487 - `:completed`
2488
2489 - `:cancelled`
2490
2491 - `:failed`
2492
2493 - `vector_store_id: String`
2494
2495 The ID of the [vector store](https://platform.openai.com/docs/api-reference/vector-stores/object) that the [File](https://platform.openai.com/docs/api-reference/files) is attached to.
2496
2497### Example
2498
2499```ruby
2500require "openai"
2501
2502openai = OpenAI::Client.new(api_key: "My API Key")
2503
2504vector_store_file_batch = openai.vector_stores.file_batches.retrieve("vsfb_abc123", vector_store_id: "vs_abc123")
2505
2506puts(vector_store_file_batch)
2507```
2508
2509#### Response
2510
2511```json
2512{
2513 "id": "id",
2514 "created_at": 0,
2515 "file_counts": {
2516 "cancelled": 0,
2517 "completed": 0,
2518 "failed": 0,
2519 "in_progress": 0,
2520 "total": 0
2521 },
2522 "object": "vector_store.files_batch",
2523 "status": "in_progress",
2524 "vector_store_id": "vector_store_id"
2525}
2526```
2527
2528## Cancel vector store file batch
2529
2530`vector_stores.file_batches.cancel(batch_id, **kwargs) -> VectorStoreFileBatch`
2531
2532**post** `/vector_stores/{vector_store_id}/file_batches/{batch_id}/cancel`
2533
2534Cancel a vector store file batch. This attempts to cancel the processing of files in this batch as soon as possible.
2535
2536### Parameters
2537
2538- `vector_store_id: String`
2539
2540- `batch_id: String`
2541
2542### Returns
2543
2544- `class VectorStoreFileBatch`
2545
2546 A batch of files attached to a vector store.
2547
2548 - `id: String`
2549
2550 The identifier, which can be referenced in API endpoints.
2551
2552 - `created_at: Integer`
2553
2554 The Unix timestamp (in seconds) for when the vector store files batch was created.
2555
2556 - `file_counts: FileCounts{ cancelled, completed, failed, 2 more}`
2557
2558 - `cancelled: Integer`
2559
2560 The number of files that where cancelled.
2561
2562 - `completed: Integer`
2563
2564 The number of files that have been processed.
2565
2566 - `failed: Integer`
2567
2568 The number of files that have failed to process.
2569
2570 - `in_progress: Integer`
2571
2572 The number of files that are currently being processed.
2573
2574 - `total: Integer`
2575
2576 The total number of files.
2577
2578 - `object: :"vector_store.files_batch"`
2579
2580 The object type, which is always `vector_store.file_batch`.
2581
2582 - `:"vector_store.files_batch"`
2583
2584 - `status: :in_progress | :completed | :cancelled | :failed`
2585
2586 The status of the vector store files batch, which can be either `in_progress`, `completed`, `cancelled` or `failed`.
2587
2588 - `:in_progress`
2589
2590 - `:completed`
2591
2592 - `:cancelled`
2593
2594 - `:failed`
2595
2596 - `vector_store_id: String`
2597
2598 The ID of the [vector store](https://platform.openai.com/docs/api-reference/vector-stores/object) that the [File](https://platform.openai.com/docs/api-reference/files) is attached to.
2599
2600### Example
2601
2602```ruby
2603require "openai"
2604
2605openai = OpenAI::Client.new(api_key: "My API Key")
2606
2607vector_store_file_batch = openai.vector_stores.file_batches.cancel("batch_id", vector_store_id: "vector_store_id")
2608
2609puts(vector_store_file_batch)
2610```
2611
2612#### Response
2613
2614```json
2615{
2616 "id": "id",
2617 "created_at": 0,
2618 "file_counts": {
2619 "cancelled": 0,
2620 "completed": 0,
2621 "failed": 0,
2622 "in_progress": 0,
2623 "total": 0
2624 },
2625 "object": "vector_store.files_batch",
2626 "status": "in_progress",
2627 "vector_store_id": "vector_store_id"
2628}
2629```
2630
2631## List vector store files in a batch
2632
2633`vector_stores.file_batches.list_files(batch_id, **kwargs) -> CursorPage<VectorStoreFile>`
2634
2635**get** `/vector_stores/{vector_store_id}/file_batches/{batch_id}/files`
2636
2637Returns a list of vector store files in a batch.
2638
2639### Parameters
2640
2641- `vector_store_id: String`
2642
2643- `batch_id: String`
2644
2645- `after: String`
2646
2647 A cursor for use in pagination. `after` is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, ending with obj_foo, your subsequent call can include after=obj_foo in order to fetch the next page of the list.
2648
2649- `before: String`
2650
2651 A cursor for use in pagination. `before` is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, starting with obj_foo, your subsequent call can include before=obj_foo in order to fetch the previous page of the list.
2652
2653- `filter: :in_progress | :completed | :failed | :cancelled`
2654
2655 Filter by file status. One of `in_progress`, `completed`, `failed`, `cancelled`.
2656
2657 - `:in_progress`
2658
2659 - `:completed`
2660
2661 - `:failed`
2662
2663 - `:cancelled`
2664
2665- `limit: Integer`
2666
2667 A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 20.
2668
2669- `order: :asc | :desc`
2670
2671 Sort order by the `created_at` timestamp of the objects. `asc` for ascending order and `desc` for descending order.
2672
2673 - `:asc`
2674
2675 - `:desc`
2676
2677### Returns
2678
2679- `class VectorStoreFile`
2680
2681 A list of files attached to a vector store.
2682
2683 - `id: String`
2684
2685 The identifier, which can be referenced in API endpoints.
2686
2687 - `created_at: Integer`
2688
2689 The Unix timestamp (in seconds) for when the vector store file was created.
2690
2691 - `last_error: LastError{ code, message}`
2692
2693 The last error associated with this vector store file. Will be `null` if there are no errors.
2694
2695 - `code: :server_error | :unsupported_file | :invalid_file`
2696
2697 One of `server_error`, `unsupported_file`, or `invalid_file`.
2698
2699 - `:server_error`
2700
2701 - `:unsupported_file`
2702
2703 - `:invalid_file`
2704
2705 - `message: String`
2706
2707 A human-readable description of the error.
2708
2709 - `object: :"vector_store.file"`
2710
2711 The object type, which is always `vector_store.file`.
2712
2713 - `:"vector_store.file"`
2714
2715 - `status: :in_progress | :completed | :cancelled | :failed`
2716
2717 The status of the vector store file, which can be either `in_progress`, `completed`, `cancelled`, or `failed`. The status `completed` indicates that the vector store file is ready for use.
2718
2719 - `:in_progress`
2720
2721 - `:completed`
2722
2723 - `:cancelled`
2724
2725 - `:failed`
2726
2727 - `usage_bytes: Integer`
2728
2729 The total vector store usage in bytes. Note that this may be different from the original file size.
2730
2731 - `vector_store_id: String`
2732
2733 The ID of the [vector store](https://platform.openai.com/docs/api-reference/vector-stores/object) that the [File](https://platform.openai.com/docs/api-reference/files) is attached to.
2734
2735 - `attributes: Hash[Symbol, String | Float | bool]`
2736
2737 Set of 16 key-value pairs that can be attached to an object. This can be
2738 useful for storing additional information about the object in a structured
2739 format, and querying for objects via API or the dashboard. Keys are strings
2740 with a maximum length of 64 characters. Values are strings with a maximum
2741 length of 512 characters, booleans, or numbers.
2742
2743 - `String = String`
2744
2745 - `Float = Float`
2746
2747 - `UnionMember2 = bool`
2748
2749 - `chunking_strategy: FileChunkingStrategy`
2750
2751 The strategy used to chunk the file.
2752
2753 - `class StaticFileChunkingStrategyObject`
2754
2755 - `static: StaticFileChunkingStrategy`
2756
2757 - `chunk_overlap_tokens: Integer`
2758
2759 The number of tokens that overlap between chunks. The default value is `400`.
2760
2761 Note that the overlap must not exceed half of `max_chunk_size_tokens`.
2762
2763 - `max_chunk_size_tokens: Integer`
2764
2765 The maximum number of tokens in each chunk. The default value is `800`. The minimum value is `100` and the maximum value is `4096`.
2766
2767 - `type: :static`
2768
2769 Always `static`.
2770
2771 - `:static`
2772
2773 - `class OtherFileChunkingStrategyObject`
2774
2775 This is returned when the chunking strategy is unknown. Typically, this is because the file was indexed before the `chunking_strategy` concept was introduced in the API.
2776
2777 - `type: :other`
2778
2779 Always `other`.
2780
2781 - `:other`
2782
2783### Example
2784
2785```ruby
2786require "openai"
2787
2788openai = OpenAI::Client.new(api_key: "My API Key")
2789
2790page = openai.vector_stores.file_batches.list_files("batch_id", vector_store_id: "vector_store_id")
2791
2792puts(page)
2793```
2794
2795#### Response
2796
2797```json
2798{
2799 "data": [
2800 {
2801 "id": "id",
2802 "created_at": 0,
2803 "last_error": {
2804 "code": "server_error",
2805 "message": "message"
2806 },
2807 "object": "vector_store.file",
2808 "status": "in_progress",
2809 "usage_bytes": 0,
2810 "vector_store_id": "vector_store_id",
2811 "attributes": {
2812 "foo": "string"
2813 },
2814 "chunking_strategy": {
2815 "static": {
2816 "chunk_overlap_tokens": 0,
2817 "max_chunk_size_tokens": 100
2818 },
2819 "type": "static"
2820 }
2821 }
2822 ],
2823 "first_id": "file-abc123",
2824 "has_more": false,
2825 "last_id": "file-abc456",
2826 "object": "list"
2827}
2828```
2829
2830## Domain Types
2831
2832### Vector Store File Batch
2833
2834- `class VectorStoreFileBatch`
2835
2836 A batch of files attached to a vector store.
2837
2838 - `id: String`
2839
2840 The identifier, which can be referenced in API endpoints.
2841
2842 - `created_at: Integer`
2843
2844 The Unix timestamp (in seconds) for when the vector store files batch was created.
2845
2846 - `file_counts: FileCounts{ cancelled, completed, failed, 2 more}`
2847
2848 - `cancelled: Integer`
2849
2850 The number of files that where cancelled.
2851
2852 - `completed: Integer`
2853
2854 The number of files that have been processed.
2855
2856 - `failed: Integer`
2857
2858 The number of files that have failed to process.
2859
2860 - `in_progress: Integer`
2861
2862 The number of files that are currently being processed.
2863
2864 - `total: Integer`
2865
2866 The total number of files.
2867
2868 - `object: :"vector_store.files_batch"`
2869
2870 The object type, which is always `vector_store.file_batch`.
2871
2872 - `:"vector_store.files_batch"`
2873
2874 - `status: :in_progress | :completed | :cancelled | :failed`
2875
2876 The status of the vector store files batch, which can be either `in_progress`, `completed`, `cancelled` or `failed`.
2877
2878 - `:in_progress`
2879
2880 - `:completed`
2881
2882 - `:cancelled`
2883
2884 - `:failed`
2885
2886 - `vector_store_id: String`
2887
2888 The ID of the [vector store](https://platform.openai.com/docs/api-reference/vector-stores/object) that the [File](https://platform.openai.com/docs/api-reference/files) is attached to.