Question: What's the purpose of "LangChain.Core\Chains\StackableChains"
evolcano opened this issue · 3 comments
Hi! I'm learing the Rep, and confused about "LangChain.Core\Chains\StackableChains".
StackableChains is an extension of BaseStackableChain, and normally other chains extended BaseChain. I can't find the difference of BaseStackableChain and BaseChain.
My question is:
- What's the difference of BaseStackableChain and BaseChain? What's the meaning of "Stackable"?
- When will I use StackableChains?
Thanks! Great job!
Hi, @evolcano and thank you for interest in our project. As you have noticed, we have 2 base classes BaseChain and BaseStackableChain.
BaseChain is legacy class. It was there first and it is used in classes that replicating original LangChain API. But this original API was not easy to use. And, when python version developers realized this, thay came out with LCEL. Which is better, but still hard to use. They are still trying to improve.
At this moment we dicided that we will not follow python developers experiments and will take our own path. This is how we came with concept of stackable Chains. They are easy to understand, read and use. Stackable means that each chain is independent and can stack on top of other chains.
The answer to your second question is simple: Always. You can check our wiki to see different use cases and, if you dont find one you interested in, - just create an issue with request to make it.
I got it ! And I found your stack operation which similar to LangChain:
public static StackChain operator |(BaseStackableChain a, BaseStackableChain b)
{
return new StackChain(a, b);
}
Thanks!