-
Notifications
You must be signed in to change notification settings - Fork 6
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
error while trying to get streamed api #9
Comments
I'm having the same problem from yesterday night. Any solution please? |
+1 |
Any luck finding a solution? This started happening around same time OpenAI reported possible DDoD attack. Could they have shut won something streamed-gpt was using? |
With some research I noticed that the latest OpenAI API V4 update changed the way streamed answers come from the API endpoint. No longer it is needed to parse the response which makes this package obsolete. Now listening to stream is as easy as follows: `import OpenAI from "openai"; const openai = new OpenAI(); const completion = await openai.chat.completions.create({ for await (const chunk of completion) { ` |
You rock. Thanks @GuiriDelNorte |
Describe the bug
I am getting the following error:
Error reading stream: SyntaxError: Unexpected end of JSON input at JSON.parse (<anonymous>) at /Volumes/Work/Web Development Current/UAskMe/uaskme-backend/node_modules/streamed-chatgpt-api/index.js:14:38 at processStream (/Volumes/Work/Web Development Current/UAskMe/uaskme-backend/node_modules/streamed-chatgpt-api/index.js:128:17) at process.processTicksAndRejections (node:internal/process/task_queues:95:5) at async fetchStreamedChat (/Volumes/Work/Web Development Current/UAskMe/uaskme-backend/node_modules/streamed-chatgpt-api/index.js:183:5) at async fetchStreamedChatContent (/Volumes/Work/Web Development Current/UAskMe/uaskme-backend/node_modules/streamed-chatgpt-api/index.js:11:9)
To Reproduce
Steps to reproduce the behavior:
Here is how i send request to get streamed answer:
fetchStreamedChatContent( { apiKey: process.env.OPENAI_API_KEY, messageInput: messages, maxTokens, temperature, model, }, (content) => { successStream(content); completeResponse += content; }, () => { return resolve(completeResponse); }, (error) => { console.log("I'm sorry, there was an error processing your request."); console.log(error); return resolve(completeResponse); } );
Expected behavior
It is supposed to return answer in streamed format
Screenshots
Desktop (please complete the following information):
The text was updated successfully, but these errors were encountered: