code: def validate_pipeline_input(
      graph: networkx.MultiDiGraph, input_values: Dict[str, Any]
  ) -> Dict[str, Any]:
      """
      Make sure the pipeline is properly built and that the input received makes sense.
      Returns the input values, validated and updated at need.
      """
      if not any(
          sockets for sockets in find_pipeline_inputs(graph).values()
      ):
          raise PipelineValidationError("This pipeline has no inputs.")
  
      # Make sure the input keys are all nodes of the pipeline
      unknown_components = [
          key for key in input_values.keys() if not key in graph.nodes
      ]
      if unknown_components:
          all_inputs = describe_pipeline_inputs_as_string(graph)
          raise ValueError(
              f"Pipeline received data for unknown component(s): {', '.join(unknown_components)}\n\n{all_inputs}"
          )
  
      # Make sure all necessary sockets are connected
      _validate_input_sockets_are_connected(graph, input_values)
  
      # Make sure that the pipeline input is only sent to nodes that won't receive data from other nodes
      _validate_nodes_receive_only_expected_input(graph, input_values)
  
      return input_values
  
file_path: haystack/haystack/core/pipeline/validation.py
imports: from typing import Dict, Any
  import logging
  import networkx
  from haystack.core.errors import PipelineValidationError
  from haystack.core.component.sockets import InputSocket
  from haystack.core.pipeline.descriptions import find_pipeline_inputs, describe_pipeline_inputs_as_string
label_desc: Use image node_id 1 for calling a global function with example usage: validate_pipeline_input(graph, input_values) and returns: input_values