openai-node
openai-node copied to clipboard
replace axios with fetch
Describe the feature or improvement you're requesting
- Axios is not compatible with other runtimes (for example Edge).
- Significant reduction in size
- Fetch support for all runtimes (browser, node, edge, deno, workers)
- The fetch lib could optionally be passed as a dependency
ref: https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API
Additional context
When running current version with axios on the Edge I got this error:
An error occurred during OpenAI request [TypeError: adapter is not a function]
@dominiksipowicz temporary solution: https://github.com/dan-kwiat/openai-edge
@dan-kwiat
temporary solution: https://github.com/dan-kwiat/openai-edge
Wow, that was quick. This is a great start. At this point, I just call directly REST endpoints with native fetch so it's a super nice thing to have!
Here it is 🎉 cc @dominiksipowicz : https://github.com/openai/openai-node/pull/45#issuecomment-1371569799
Hi all, we have an upcoming version v4.0.0 that uses fetch and works on Edge runtimes; please give it a try and let us know in the thread whether it suits your needs!