You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Confirm this is a feature request for the Node library and not the underlying OpenAI API.
This is a feature request for the Node library
Describe the feature or improvement you're requesting
Hello,
I am currently using the openai-node package for my project, and I have a question regarding the 'Accept' header in the request made at this specific code snippet: core.ts.
In the mentioned code, the 'Accept' header is set to "application/json". However, when the 'stream' option is set to true, the response I receive is in the format of "text/event-stream".
I am using a unified API platform that converts API interfaces from different platforms to OPENAI format. Due to some platforms validating the 'Accept' header value, I am facing issues with the API requests failing.
Could you please confirm if setting the 'Accept' header to "application/json" in the mentioned code is compliant with the specifications? if it should be modified based on the expected response type?
Thank you for your assistance.
Additional context
No response
The text was updated successfully, but these errors were encountered:
Hi, thanks for your request here. You're correct that the server responds with Content-Type: text/event-stream, so that'd likely be a more appropriate Accept: header to send. We'll look into fixing this; in the meantime, you can send Accept manually yourself like so:
conststream=awaitopenai.chat.completions.create({model: 'gpt-4',messages: [{role: 'user',content: 'Say this is a test'}],stream: true,},{headers: {Accept: 'text/event-stream'}},);
Confirm this is a feature request for the Node library and not the underlying OpenAI API.
Describe the feature or improvement you're requesting
Hello,
I am currently using the openai-node package for my project, and I have a question regarding the 'Accept' header in the request made at this specific code snippet: core.ts.
In the mentioned code, the 'Accept' header is set to "application/json". However, when the 'stream' option is set to true, the response I receive is in the format of "text/event-stream".
I am using a unified API platform that converts API interfaces from different platforms to OPENAI format. Due to some platforms validating the 'Accept' header value, I am facing issues with the API requests failing.
Could you please confirm if setting the 'Accept' header to "application/json" in the mentioned code is compliant with the specifications? if it should be modified based on the expected response type?
Thank you for your assistance.
Additional context
No response
The text was updated successfully, but these errors were encountered: