Skip to content

Commit

Permalink
Create process-batch.js
Browse files Browse the repository at this point in the history
Signed-off-by: Dr. J K Edwards <[email protected]>
  • Loading branch information
josefkedwards authored Feb 10, 2025
1 parent 7acf70f commit c016c69
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions .deploy/process-batch.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import { axios } from "@pipedream/platform"

export async function processBatch(batchFile) {
const response = await axios({
method: 'POST',
url: 'https://api.openai.com/v1/batches',
headers: {
'Authorization': `Bearer ${process.env.OPENAI_API_KEY}`,
'Content-Type': 'application/json'
},
data: {
input_file_id: batchFile,
endpoint: "/v1/chat/completions",
completion_window: "24h"
}
});

return response.data;
}

0 comments on commit c016c69

Please sign in to comment.