mirror of
https://github.com/open-webui/pipelines.git
synced 2026-07-21 10:05:26 -04:00
Question: LangChain Agent / Runnable Interface method to return working stream / generator #70
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @TiFaBl on GitHub (Jun 30, 2024).
Hey all, I started using pipelines and really like the approach. I am currently trying to build a LangChain SQL Agent as a pipeline and facing some issues getting the output / stream / generator / iter correct.
When I initiate it in the on_startup: function, it works as expected.
But when I use that pipeline from the webui, I get a network error on the webui instance and the following error on the pipeline instance:
AttributeError: 'AddableDict' object has no attribute 'startswith'It does work if I use the invoke() function on the LangChain Agent and select the output from the dict but of course this doesn't stream responses
I assume, my key questions is: Which method of a LangChain Agent / Runnable Interface must be used - or how must it subsequently be manipulated - to get the correct Generator / Iter to return in the pipe() function? The return type of pipe only says Generator, and that is what I am returning, but there appear to be further requirements as it can't contain an AddableDict.
Any documentation is welcome as well.
@dukai289 commented on GitHub (Jul 3, 2024):
参考examples/pipelines/providers/anthropic_manifold_pipeline.py这个里面的例子,先实现stream_response函数进行yield,再在pipe函数里调用这个函数进行return
@dukai289 commented on GitHub (Jul 3, 2024):
@TiFaBl 参考我上面的回答
@TiFaBl commented on GitHub (Aug 1, 2024):
@dukai289 thanks! While I couldn't read your response / don't speak that language, the path to the function in the example anthropic pipeline was sufficient to figure it out.
In case anyone else is ending up, here is my solution: