chainlit
chainlit copied to clipboard
ConversationalRetrievalChain returning question first while streaming
I have created simple chatbot using ConversationalRetrievalChain. I am trying to stream the answer using code below.
@cl.on_message async def main(message: cl.Message): chain = cl.user_session.get("chain") # type: ConversationalRetrievalChain cb = cl.LangchainCallbackHandler( stream_final_answer=True, force_stream_final_answer=True ) cb.answer_reached = True res = await chain.acall(message.content, callbacks=[cb])
Streaming is working as expected but I am getting question first in my output and then answer.
I tried to use different strings in answer_prefix_tokens as well but nothing changed.