code: def eval(
      runnable: Union[Pipeline, Component],
      inputs: List[Dict[str, Any]],
      expected_outputs: List[Dict[str, Any]],
  ) -> EvaluationResult:
      """
      Evaluates the provided Pipeline or component based on the given inputs and expected outputs.
  
      This function facilitates the evaluation of a given runnable (either a Pipeline or a component) using the provided
      inputs and corresponding expected outputs.
  
      :param runnable: The runnable (Pipeline or component) used for evaluation.
      :param inputs: List of inputs used for evaluation.
      :param expected_outputs: List of expected outputs used for evaluation.
  
      :return: An instance of EvaluationResult containing information about the evaluation, including the runnable,
      inputs, outputs, and expected outputs.
      """
  
      outputs = []
  
      # Check that expected outputs has the correct shape
      if len(inputs) != len(expected_outputs):
          raise ValueError(
              f"The number of inputs ({len(inputs)}) does not match the number of expected outputs "
              f"({len(expected_outputs)}). Please ensure that each input has a corresponding expected output."
          )
  
      for input_ in inputs:
          output = runnable.run(input_)
          outputs.append(output)
  
      return EvaluationResult(
          runnable, inputs, outputs, expected_outputs
      )
  
file_path: haystack/haystack/evaluation/eval.py
imports: from typing import Any, Callable, Dict, List, Union
  from haystack import Pipeline
  from haystack.core.component import Component
  from haystack.evaluation.metrics import Metric, MetricsResult
label_desc: Use image node_id 1 for calling a global function with example usage: eval(runnable, inputs, expected_outputs) and returns: EvaluationResult