code: def _extract_and_check_predictions(
      extractor, texts, expected, batch_size
  ):
      docs = [Document(content=text) for text in texts]
      outputs = extractor.run(documents=docs, batch_size=batch_size)[
          "documents"
      ]
      assert all(id(a) == id(b) for a, b in zip(docs, outputs))
      predicted = [
          NamedEntityExtractor.get_stored_annotations(doc)
          for doc in outputs
      ]
  
      _check_predictions(predicted, expected)
  
file_path: haystack/e2e/pipelines/test_named_entity_extractor.py
imports: import pytest
  from haystack import Document, Pipeline, ComponentError
  from haystack.components.extractors import NamedEntityAnnotation, NamedEntityExtractor, NamedEntityExtractorBackend
label_desc: Use image node_id 8 for calling a global function with example usage: _extract_and_check_predictions(extractor, texts, expected, batch_size) without return types