@@ -6618,6 +6618,22 @@ paths:
6618
6618
endpoint="/v1/chat/completions",
6619
6619
completion_window="24h"
6620
6620
)
6621
+ node : |
6622
+ import OpenAI from "openai";
6623
+
6624
+ const openai = new OpenAI();
6625
+
6626
+ async function main() {
6627
+ const batch = await openai.batches.create({
6628
+ input_file_id: "file-abc123",
6629
+ endpoint: "/v1/chat/completions",
6630
+ completion_window: "24h"
6631
+ });
6632
+
6633
+ console.log(batch);
6634
+ }
6635
+
6636
+ main();
6621
6637
response : |
6622
6638
{
6623
6639
"id": "batch_abc123",
@@ -6684,6 +6700,25 @@ paths:
6684
6700
curl https://api.openai.com/v1/batches?limit=2 \
6685
6701
-H "Authorization: Bearer $OPENAI_API_KEY" \
6686
6702
-H "Content-Type: application/json"
6703
+ python : |
6704
+ from openai import OpenAI
6705
+ client = OpenAI()
6706
+
6707
+ client.batches.list()
6708
+ node : |
6709
+ import OpenAI from "openai";
6710
+
6711
+ const openai = new OpenAI();
6712
+
6713
+ async function main() {
6714
+ const list = await openai.batches.list();
6715
+
6716
+ for await (const batch of list) {
6717
+ console.log(batch);
6718
+ }
6719
+ }
6720
+
6721
+ main();
6687
6722
response : |
6688
6723
{
6689
6724
"object": "list",
@@ -6759,6 +6794,18 @@ paths:
6759
6794
client = OpenAI()
6760
6795
6761
6796
client.batches.retrieve("batch_abc123")
6797
+ node : |
6798
+ import OpenAI from "openai";
6799
+
6800
+ const openai = new OpenAI();
6801
+
6802
+ async function main() {
6803
+ const batch = await openai.batches.retrieve("batch_abc123");
6804
+
6805
+ console.log(batch);
6806
+ }
6807
+
6808
+ main();
6762
6809
response : &batch_object |
6763
6810
{
6764
6811
" id " : " batch_abc123" ,
@@ -6826,6 +6873,18 @@ paths:
6826
6873
client = OpenAI()
6827
6874
6828
6875
client.batches.cancel("batch_abc123")
6876
+ node : |
6877
+ import OpenAI from "openai";
6878
+
6879
+ const openai = new OpenAI();
6880
+
6881
+ async function main() {
6882
+ const batch = await openai.batches.cancel("batch_abc123");
6883
+
6884
+ console.log(batch);
6885
+ }
6886
+
6887
+ main();
6829
6888
response : |
6830
6889
{
6831
6890
"id": "batch_abc123",
@@ -10793,10 +10852,13 @@ components:
10793
10852
type : string
10794
10853
description : The ID of the file to attach to the message.
10795
10854
tools :
10855
+ description : The tools to add this file to.
10796
10856
type : array
10797
10857
items :
10798
- type : string
10799
- enum : ["file_search", "code_interpreter"]
10858
+ oneOf :
10859
+ - $ref : " #/components/schemas/AssistantToolsCode"
10860
+ - $ref : " #/components/schemas/AssistantToolsFileSearch"
10861
+ x-oaiExpandable : true
10800
10862
description : A list of files attached to the message, and the tools they were added to.
10801
10863
nullable : true
10802
10864
metadata :
@@ -10923,10 +10985,13 @@ components:
10923
10985
type : string
10924
10986
description : The ID of the file to attach to the message.
10925
10987
tools :
10988
+ description : The tools to add this file to.
10926
10989
type : array
10927
10990
items :
10928
- type : string
10929
- enum : ["file_search", "code_interpreter"]
10991
+ oneOf :
10992
+ - $ref : " #/components/schemas/AssistantToolsCode"
10993
+ - $ref : " #/components/schemas/AssistantToolsFileSearch"
10994
+ x-oaiExpandable : true
10930
10995
description : A list of files attached to the message, and the tools they should be added to.
10931
10996
required :
10932
10997
- file_id
0 commit comments