Cannot terminate request if StrOutputParser() is in chain #30090
Unanswered
jimmyparadm
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Checked other resources
Commit to Help
Example Code
Description
I am building a python flask web app using langchain and ollama. I want to make sure ollama can stop processing request when the client terminate the connection. With the code above, when client disconnects, it does not trigger the GeneratorExit block until ollama finish processing the request.
I tried removing StrOutputParser() from the chain and repeat the steps. When the client disconnects, the GeneratorExit block is triggered instantly and ollama also stops processing the request right away.
I test this using cmd with command below:
curl -X POST -H "Content-Type: application/json" http://localhost:5001/stream
After the stream starts, I use crtl+c to disconnect the connection.
System Info
System Information
Package Information
Optional packages not installed
Other Dependencies
Beta Was this translation helpful? Give feedback.
All reactions