def _run_multi(
        self, module_input_dict: Dict[str, Any], show_intermediates: bool = False
    ) -> Tuple[Dict[str, Any], Dict[str, ComponentIntermediates]]:
        """Run the pipeline for multiple roots."""
        self._validate_inputs(module_input_dict)

        run_state = self.get_run_state(module_input_dict)

        # Add root inputs to all_module_inputs
        next_module_keys = self.get_next_module_keys(run_state)

        while True:
            for module_key in next_module_keys:
                module = run_state.module_dict[module_key]
                module_input = run_state.all_module_inputs[module_key]

                if self.verbose:
                    print_debug_input(module_key, module_input)
                output_dict = module.run_component(**module_input)

                if (
                    show_intermediates
                    and module_key not in run_state.intermediate_outputs
                ):
                    run_state.intermediate_outputs[module_key] = ComponentIntermediates(
                        inputs=module_input, outputs=output_dict
                    )

                self.process_component_output(
                    output_dict,
                    module_key,
                    run_state,
                )

            next_module_keys = self.get_next_module_keys(
                run_state,
            )
            if not next_module_keys:
                run_state.result_outputs[module_key] = output_dict
                break

        return run_state.result_outputs, run_state.intermediate_outputs
Run the pipeline for multiple roots.
llama-index-core/llama_index/core/query_pipeline/query.py