Replies: 1 comment
-
🤖 Hello, The issue you're experiencing might be due to the fact that the To prevent this issue, you can modify your code to keep the connection open until all your questions have been answered. You can achieve this by creating a new method that accepts an array of questions and iterates over them, calling the async function askQuestions(chain, questions, chatHistory = "") {
for (const question of questions) {
const res = await chain.call({ question, chat_history: chatHistory });
console.log(res);
chatHistory += `${question}\n${res.text}`;
}
}
/* Ask it a series of questions */
const questions = ["What did the president say about Justice Breyer?", "Was that nice?"];
askQuestions(chain, questions); In this example, the In the context shared, the You can find more information about how the I hope this helps! If you have any other questions, feel free to ask. Best, Sources
This response is meant to be useful and save you time. It is not meant to be a precise solution, but rather a starting point for your own research. Help me be more useful! Please leave a 👍 if this is helpful and 👎 if it is irrelevant. If you want to continue the conversation, start your reply with @dosu-bot. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
I'm trying to stream the response from ConversationalRetrievalQAChain. It works the first time but when you ask another question with a chat history it streams out the modified question and then my code closes the controller. When that actual answer is returned the streaming causes an error because the controller is already closed. Is there any way around this or have I fault in my code?
My code is like this:
`const encoder = new TextEncoder();
const decoder = new TextDecoder();
const stream: ReadableStream = new ReadableStream({
async start(controller) {
Beta Was this translation helpful? Give feedback.
All reactions