Chains
Chains are connected sequences of stacks that allow you to build complex, multi-step workflows in ModularMind. They enable the output of one stack to become the input for the next, creating a powerful and flexible way to tackle sophisticated tasks.
Why chains are useful?
- Sequencing: Chains allow you to break down complex processes into smaller, more manageable steps. By connecting stacks in a specific order, you can create a logical flow of instructions that guide your AI assistant through a series of tasks.
- Automation: By chaining together multiple stacks, you can automate repetitive tasks or complex processes that require multiple steps. This saves time and effort by streamlining your workflow and reducing the need for manual intervention.
- Reusability: Once you’ve created a chain, you can reuse it in multiple workflows by connecting it to different input sources or modifying the output to suit different requirements. This promotes consistency and efficiency across your AI interactions.
- Scalability: Chains can scale to accommodate complex tasks that involve multiple AI models, data sources, or user inputs. By connecting stacks in a chain, you can build sophisticated workflows that leverage the full power of ModularMind’s AI capabilities.
Usage
You can create a chain by dragging the handle with the link icon of one stack on top of the next. This chains the first stack to the second, allowing the output of the first stack to be fed as a prompt to the second stack.
You can also quickly create a chain by dragging the chain handle of one stack on an empty space on the board. This will create a new stack and chain the previous stack to it. The Add a Prompt
panel will appear to help you add the instructions for the second stack.
You can chain a stack with multiple stacks, allowing you to create complex workflows. This way, you can use the output of one stack as input for multiple subsequent stacks, enabling you to build sophisticated AI assistants that can handle a wide range of tasks.
Breaking a Chain
To break a chain, open the details panel of the stack you want to disconnect by clicking on it. Then, hover over the placeholder prompt that represents the output of the previous stack and click on the Unlink
button. This will disconnect the two stacks, allowing you to rearrange or modify your workflow as needed. If you have run the chain before, this action will preserve the output of the previous stack as a prompt in the next stack.
Running a Chain
To run a chain, hover over any stack in the chain and click the RUN CHAIN button. This initiates the execution of the root stacks and continues through the subsequent stacks in sequence until all stacks have been run. The outputs of each stack will be displayed in an output card, allowing you to review the results of each step in the entire chain.
Best Practices
- Keep it modular: Create smaller, focused stacks that can be easily rearranged or reused.
- Use clear naming conventions: Label your stacks and prompts descriptively for easy understanding.
- Test incrementally: Verify each step of your chain works as expected before moving to the next.
- Optimize for reusability: Design chains with components that can be repurposed in other workflows.
By mastering chains in ModularMind, you can create sophisticated AI-powered workflows that significantly enhance their productivity and problem-solving capabilities.