langchain icon indicating copy to clipboard operation
langchain copied to clipboard

Can you assist \ provide an example how to stream response when using an agent?

Open moraneden opened this issue 1 year ago • 4 comments

moraneden avatar Apr 08 '23 10:04 moraneden

Also curious on this one, I think it's just not possible at the moment right?

I mean streaming intermediate steps doesn't make that much sense, and you can already get feedback on the steps being executed using return_intermediate_step = True ( which I also haven't been able to use yet see #3091 ).

But getting a stream response for the final answer would be great. Or somehow receiving token callbacks for the final response?

tbscode avatar Apr 08 '23 16:04 tbscode

+1 for this. As @tbscode said, I don't really care about sending intermediate steps, I just want to reduce the perceived latency by my end user when they ask things that take awhile.

jakesteelman avatar Apr 14 '23 14:04 jakesteelman

Any updates on this?

pelyhe avatar May 08 '23 14:05 pelyhe

i thought this was possible using callbacks? see my response for chains here https://github.com/hwchase17/langchain/discussions/4444#discussioncomment-5893732

I think the langchain docs cover it for agents here https://python.langchain.com/en/latest/modules/callbacks/getting_started.html#using-multiple-handlers-passing-in-handlers

sarulnat avatar May 13 '23 19:05 sarulnat

Hi, @moraneden! I'm Dosu, and I'm here to help the LangChain team manage their backlog. I wanted to let you know that we are marking this issue as stale.

From what I understand, you opened this issue requesting assistance or an example on how to stream a response when using an agent. There have been some interesting discussions in the comments, with tbscode and jakesteelman expressing interest in having a stream response to reduce perceived latency. pelyhe also asked for updates, and sarulnat suggested using callbacks as a possible solution.

However, it seems that sarulnat's suggestion to use callbacks has resolved the issue.

Before we close this issue, we wanted to check with you if it is still relevant to the latest version of the LangChain repository. If it is, please let us know by commenting on the issue. Otherwise, feel free to close the issue yourself, or it will be automatically closed in 7 days.

Thank you for your contribution to the LangChain repository!

dosubot[bot] avatar Sep 21 '23 16:09 dosubot[bot]