code: def test_to_dict(self, mock_check_valid_model):
      # Initialize the HuggingFaceTGIChatGenerator object with valid parameters
      generator = HuggingFaceTGIChatGenerator(
          model="NousResearch/Llama-2-7b-chat-hf",
          token="token",
          generation_kwargs={"n": 5},
          stop_words=["stop", "words"],
          streaming_callback=lambda x: x,
      )
  
      # Call the to_dict method
      result = generator.to_dict()
      init_params = result["init_parameters"]
  
      # Assert that the init_params dictionary contains the expected keys and values
      assert init_params["model"] == "NousResearch/Llama-2-7b-chat-hf"
      assert init_params["token"] is None
      assert init_params["generation_kwargs"] == {
          "n": 5,
          "stop_sequences": ["stop", "words"],
      }
  
imports: from unittest.mock import patch, MagicMock, Mock
  import pytest
  from huggingface_hub.inference._text_generation import TextGenerationStreamResponse, Token, StreamDetails, FinishReason
  from huggingface_hub.utils import RepositoryNotFoundError
  from haystack.components.generators.chat import HuggingFaceTGIChatGenerator
  from haystack.dataclasses import StreamingChunk, ChatMessage
label_desc: Use image node_id 2 for calling the TestHuggingFaceTGIChatGenerator obj's underlying member method code with example usage: obj.test_to_dict(mock_check_valid_model) without return types