BaseChain<MemoryType extends BaseMemory> constructor
const
BaseChain<MemoryType extends BaseMemory> ({
- MemoryType? memory,
- ChainOptions? defaultOptions,
Base class for creating structured sequences of calls to components.
Chains should be used to encode a sequence of calls to components like models, document retrievers, other chains, etc., and provide a simple interface to this sequence.
The BaseChain interface makes it easy to create apps that are:
- Stateful: add Memory to any Chain to give it state.
- Observable: pass Callbacks to a Chain to execute additional functionality, like logging, outside the main sequence of component calls.
- Composable: the Chain API is flexible enough that it is easy to combine Chains with other components, including other Chains.
The main methods exposed by chains are:
Implementation
const BaseChain({
this.memory,
final ChainOptions? defaultOptions,
}) : super(defaultOptions: defaultOptions ?? const ChainOptions());