André Gomes
 · Head of Product and Entrepreneur

How to create a json file from a variable and send the file to an external API?

I need to send an openai database file for training.

I have a variable that contains a json array with the response from another external request I made.

However, I cannot create the json file and load it into memory from a variable.

The open IA API only accepts the file type object and no other way like file URL or something like that.

How do I create the file from a json variable and load it in the request for open IA?

Docs: https://platform.openai.com/docs/api-reference/files/create

Thanks for your help! ❤️

1
2 replies