langserve
langserve copied to clipboard
Stream endpoint doesn't work with GZipMiddleware
I was struggling to understand why a RemoteRunnable.stream was not working from langchain JS in the browser
Disabling GZipMiddleware in FastAPI made it work again.
Not sure if it's a Starlette/Uvicorn issue or LangServe but might be useful to fix/report.
https://github.com/tiangolo/fastapi/discussions/8448
Does that sound like the same issue?
Not sure about the langserve underlying implementation. Here the streaming response is initiated in the browser correctly (with text/event-stream) from langchainJS, when the OpenAI API finishes, all the streaming events are returned.
Like if we were awaiting for the whole response and delivering at once (return instead of yield)