haystack icon indicating copy to clipboard operation
haystack copied to clipboard

feat: add generator of StreamingHandler into pipeline output.

Open yuanwu2017 opened this issue 2 years ago • 3 comments

Is your feature request related to a problem? Please describe. We are using the haystack to setup a streaming chatbot demo with LLM. But haystack doesn't have the streaming mode RestAPI. We found that the streaming mode RestAPI needs a streaming generator to get the tokens from handler.

Describe the solution you'd like

  1. Add the streaming mode parameters in the promptNode run function, support the dynamically enabling and disabling.
  2. Add the TextIteratorStreamer object into pipeline output and run the pipe() of prompt node in new thread. It can simplify the implementation of streaming RestAPI and support the non-blocked mode.

Describe alternatives you've considered Implement a stremer handler(customer Iterator object) in rest_api and pass it in pipeline.run. It needs to run entire pipeline in other thread or coroutine.

Additional context Add any other context or screenshots about the feature request here.

yuanwu2017 avatar May 12 '23 07:05 yuanwu2017

@yuanwu2017 @julian-risch I suggest we don't close this feature request but add it to the REST API task for V2 as a reminder that users ask for it

vblagoje avatar Jul 11 '23 06:07 vblagoje

@vblagoje sounds fair 👍 Will be good to have this use case in mind once we re-design the REST API.

julian-risch avatar Jul 11 '23 10:07 julian-risch

Blocked by https://github.com/deepset-ai/hayhooks/issues/9

masci avatar May 10 '24 05:05 masci

Won't fix in 1.x, let's use https://github.com/deepset-ai/hayhooks/issues/9 to track the feature in 2.x

masci avatar May 25 '24 07:05 masci