-
| 
         Can I add RetrievalAAChain and ConversationaChain to a SimpleSequentialChain?... and I would also want to add some LLMChain Would look something kind of like this:  | 
  
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
| 
         🤖 Yes, you can add multiple types of chains such as  Here is an example of how you can add multiple chains to a  const chain1 = new RetrievalQAChain({
  combineDocumentsChain: loadQAStuffChain(model),
  retriever: vectorStore.asRetriever(),
  returnSourceDocuments: true,
});
const chain2 = new ConversationChain({
  // your configuration here
});
const chain3 = new LLMChain({
  // your configuration here
});
const overallChain = new SimpleSequentialChain({
  chains: [chain1, chain2, chain3],
  verbose: true,
});Please ensure that each chain in the  For more information, you can refer to the following sources: 
 I hope this helps! If you have any other questions, feel free to ask. 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.
-
| 
         Yes, you can definitely add multiple chains, including  const chain1 = new ConversationChain({
  memory: new BufferMemory({ returnMessages: true, memoryKey: "history" }),
  prompt: chatPrompt,
  llm: chat,
});
const chain2 = new RetrievalQAChain({
  combineDocumentsChain: loadQAStuffChain(model),
  retriever: vectorStore.asRetriever(),
  returnSourceDocuments: true,
});
// Create instances of your additional chains (e.g., LLMChain)
const chain3 = new LLMChain(/* parameters */);
// Add all the chains to the SimpleSequentialChain
const overallChain = new SimpleSequentialChain({
  chains: [chain1, chain2, chain3 /* Add other chains here */],
  verbose: true,
});In this corrected code: 
 This way, you have a sequence of chains within   | 
  
Beta Was this translation helpful? Give feedback.
🤖
Yes, you can add multiple types of chains such as
RetrievalQAChain,ConversationChain, andLLMChainto aSimpleSequentialChain. TheSimpleSequentialChainclass in the langchainjs codebase does allow for the addition of multiple types of chains. However, it's important to note that each chain used inSimpleSequentialChainshould have exactly one input and one output. This is validated in the_validateChainsmethod of theSimpleSequentialChainclass. If a chain does not meet these criteria, an error will be thrown.Here is an example of how you can add multiple chains to a
SimpleSequentialChain: