class_docstr: Resolves the HuggingFaceTGIGenerator.
code: def resolve(self, model_key: str, api_key: str) -> Any:
      hf = HfApi()
      try:
          hf.model_info(model_key)
          return HuggingFaceTGIGenerator(
              model=model_key,
              token=api_key,
              generation_kwargs={"max_new_tokens": 1024},
          )
      except Exception:
          return None
  
imports: import re
  from abc import ABC, abstractmethod
  from typing import Optional, Any
  from huggingface_hub import HfApi
  from haystack import Pipeline
  from haystack.components.builders.answer_builder import AnswerBuilder
  from haystack.components.builders.prompt_builder import PromptBuilder
  from haystack.components.embedders import SentenceTransformersTextEmbedder
  from haystack.components.generators import OpenAIGenerator, HuggingFaceTGIGenerator
  from haystack.components.retrievers.in_memory import InMemoryEmbeddingRetriever
  from haystack.dataclasses import Answer
  from haystack.document_stores.types import DocumentStore
  from haystack.document_stores.in_memory import InMemoryDocumentStore
label_desc: Use image node_id 1 for calling the _HuggingFaceTGIGeneratorResolved obj's underlying member method code with example usage: obj.resolve(model_key, api_key) and returns: HuggingFaceTGIGenerator, None