3.4.0
Introducing Parallel Branches
This release introduce the ability of the workflow component to run parallel branches: https://docs.neuron-ai.dev/workflow/loops-and-branches#parallel-branches
When you want to call the execution of multiple branches in parallel, you need to return the special event ParallelEvent from your node.
use NeuronAI\Workflow\Events\ParallelEvent;
class DocumentProcessing extends Node
{
public function __invoke(StartEvent $event, WorkflowState $state): ParallelEvent
{
// Node logic here...
// Finally return a ParallelEvent
return new ParallelEvent([
'text' => new TextProcessEvent(),
'image' => new ImageProcessEvent(),
]);
}
}