diff --git a/.deploy/process-batch.js b/.deploy/process-batch.js new file mode 100644 index 0000000..1febecb --- /dev/null +++ b/.deploy/process-batch.js @@ -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; +}