langchainjs icon indicating copy to clipboard operation
langchainjs copied to clipboard

Stream ConversationalRetrievalQAChain is not working

Open mohamedcherifmo opened this issue 1 year ago • 10 comments

I'm using a pinecone vector with OpenAIChat model in a ConversationalRetrievalQAChain, it works as intended when im not streaming the output however if I change the OpenAIChat to streaming true as per the below code snippet it fails with the following error "TypeError: stream.getReader is not a function"

 const model = new OpenAIChat({
        streaming: true,
  callbackManager: CallbackManager.fromHandlers({
    async handleLLMNewToken(token: string) {
      console.log(token);
    },
  }),
    });

This is in a nextjs API route

mohamedcherifmo avatar Mar 31 '23 04:03 mohamedcherifmo