async def arun_multi(
        self,
        module_input_dict: Dict[str, Any],
        callback_manager: Optional[CallbackManager] = None,
        batch: bool = False,
    ) -> Dict[str, Any]:
        """Run the pipeline for multiple roots."""
        callback_manager = callback_manager or self.callback_manager
        self.set_callback_manager(callback_manager)
        with self.callback_manager.as_trace("query"):
            with self.callback_manager.event(
                CBEventType.QUERY,
                payload={EventPayload.QUERY_STR: json.dumps(module_input_dict)},
            ) as query_event:
                if batch:
                    outputs: Dict[str, Any] = {}

                    batch_lengths = {
                        len(values)
                        for subdict in module_input_dict.values()
                        for values in subdict.values()
                    }

                    if len(batch_lengths) != 1:
                        raise ValueError("Length of batch inputs must be the same.")

                    batch_size = next(iter(batch_lengths))

                    # List individual outputs from batch multi input.
                    inputs = [
                        {
                            key: {
                                inner_key: inner_val[i]
                                for inner_key, inner_val in value.items()
                            }
                            for key, value in module_input_dict.items()
                        }
                        for i in range(batch_size)
                    ]

                    jobs = [self._arun_multi(input) for input in inputs]
                    results = await run_jobs(jobs, workers=len(jobs))

                    for result in results:
                        outputs = self.merge_dicts(outputs, result[0])

                    return outputs
                else:
                    outputs, _ = await self._arun_multi(module_input_dict)
                    return outputs
Run the pipeline for multiple roots.
llama-index-core/llama_index/core/query_pipeline/query.py