-
Notifications
You must be signed in to change notification settings - Fork 74
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
Handling Closed Connections #76
Comments
Hey @awtkns! Really glad to see this library being used in a bigger project. I don't have a solution right now but I will start investigating. I believe this is a critical feature for all users. P.S. I'll look into github sponsors as well 😄 |
@awtkns i've published a new version with a possible fix:
let me know if the error rate reduces. I will keep this issue open until then. |
Unfortunately after upgrading to @ajndkr thanks for all your help :) |
I don’t think missing dependencies is an issue here. Manually setting the session object and then closing it at the end should have worked. I’ll keep investigating for a better solution. In the meantime, it’ll be good to know if the error rate has atleast decreased with the new version, if not resolved completely. |
Unfortunately the error rate has not seem to go down. 😢 This is how we are receiving the stream in the front end. We are using fetch here instead of eventsources as the streaming response didn't seem to work with JS eventsource. |
Thanks for the update! It appears we are dealing with nested awaitable functions which are unaffected when the session is closed. I hope to find a solution soon 🤞 |
@awtkns published a new version: I haven't been able to reproduce the "unclosed connection" error locally with the latest changes. So I'm really hoping we've arrived at a solution. |
I can confirm it looks like connection are being closed properly now! Thanks for your help! |
Recently we merged some changes into reworkd/AgentGPT#631 which enabled streaming on AgentGPT using lanarky!
After merging, I noticed an increase error rate due to what I assume is lanarky not closing the connection to openai if the client (React in our cases) closes the SSE stream early. This happens, for example, when the user closes the page while in the middle of a chat completion being streamed.
I was wondering if there was a way / best practice to close the connection to openai in the case mentioned above? Error details below for context.
Sample Implementation
Error
Thanks for the amazing work! You should setup github sponsors 😉
The text was updated successfully, but these errors were encountered: