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