Unable to upload file from blob storage link--Assistant api v2

I am using node js for assistants api v2.

The below code works if file is locally stored.

    const fileData = await openai.files.create({
      file: fs.createReadStream(local_file_path.pdf),
      purpose: "assistants",
    });

but, in production file are stored in blob storage.


    const fileData = await openai.files.create({
      file: axios.get(blob_file_url, { responseType: 'stream' }),
      purpose: "assistants",
    });

This gives me error in assistants api v2

When I used axios for assistants api v1 it worked.

The error is as follows

BadRequestError: 400 ‘file’ is a required property
at APIError.generate (E:\node_modules\openai\error.js:45:20)
at OpenAI.makeStatusError (E:\node_modules\openai\core.js:263:33)
at OpenAI.makeRequest (E:\node_modules\openai\core.js:306:30)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async uploadFiles (E:\app-openai.js:16:22)
at async assistantFunction (E:\app-openai.js:50:27) {
status: 400,
headers: {
‘access-control-allow-origin’: ‘*’,
‘alt-svc’: ‘h3=“:443”; ma=86400’,
‘cf-cache-status’: ‘DYNAMIC’,
‘cf-ray’: ‘88af95693b9680bb-BOM’,
connection: ‘keep-alive’,
‘content-length’: ‘142’,
‘content-type’: ‘application/json’,
date: ‘Tue, 28 May 2024 16:22:28 GMT’,
‘openai-organization’: ‘legalgpt-india-llp’,
‘openai-processing-ms’: ‘19’,
‘openai-version’: ‘2020-10-01’,
server: ‘cloudflare’,
‘set-cookie’: ‘__cf_bm=aG8rporsn9mNeuF5zI5qM0uEKdpihsAVzvq0DM1dueg-1716913348-1.0.1.1-nMj8mYU8Det4an.lGPwiflylll0z0tE3ElIE9_bl6qc840qS4MA0Yele1Nlui14A0MrNuEBacwrrripsxGdSUw; path=/; expires=Tue, 28-May-24 16:52:28 GMT; domain=.api.openai.com; HttpOnly; Secure; SameSite=None, _cfuvid=6b_m5tPV7kgvfEOPFtw0MPYejpyGKSgaPs9TN5KqTxM-1716913348296-0.0.1.1-604800000; path=/; domain=.api.openai.com; HttpOnly; Secure; SameSite=None’,
‘strict-transport-security’: ‘max-age=15724800; includeSubDomains’,
‘x-request-id’: ‘req_67482caf60ca2662472dd01a9c5b1944’
},
request_id: ‘req_67482caf60ca2662472dd01a9c5b1944’,
error: {
message: “‘file’ is a required property”,
type: ‘invalid_request_error’,
param: null,
code: null
},
code: null,
param: null,
type: ‘invalid_request_error’
}