code: def mock_auto_tokenizer():
      """
      In the original mock_auto_tokenizer fixture, we were mocking the transformers.AutoTokenizer.from_pretrained
      method directly, but we were not providing a return value for this method. Therefore, when from_pretrained
      was called within HuggingFaceTGIChatGenerator, it returned None because that's the default behavior of a
      MagicMock object when a return value isn't specified.
  
      We will update the mock_auto_tokenizer fixture to return a MagicMock object when from_pretrained is called
      in another PR. For now, we will use this fixture to mock the AutoTokenizer.from_pretrained method.
      """
  
      with patch(
          "transformers.AutoTokenizer.from_pretrained", autospec=True
      ) as mock_from_pretrained:
          mock_tokenizer = MagicMock()
          mock_from_pretrained.return_value = mock_tokenizer
          yield mock_tokenizer
  
file_path: haystack/test/components/generators/conftest.py
imports: from datetime import datetime
  from typing import Iterator
  from unittest.mock import patch, MagicMock
  import pytest
  from openai import Stream
  from openai.types.chat import ChatCompletionChunk
  from openai.types.chat.chat_completion_chunk import ChoiceDelta, Choice
label_desc: Use image node_id 1 for calling a global function with example usage: mock_auto_tokenizer() without return types