class_docstr: An internal class to simplify creation of prebuilt pipeline for indexing documents into a DocumentStore. Indexing
  pipeline automatically detect the file type of the input files and converts them into Documents. The supported
  file types are: .txt, .pdf, and .html
class_docstr_tok: ["An","internal","class","to","simplify","creation","of","prebuilt","pipeline","for","indexing","documents","into","a","DocumentStore",".","Indexing","pipeline","automatically","detect","the","file","type","of","the","input","files","and","converts","them","into","Documents",".","The","supported","file","types","are",":",".txt",",",".pdf",",","and",".html"]
docstr: :param document_store: An instance of a DocumentStore to index documents into.
  :param embedding_model: The name of the model to use for document embeddings.
  :param supported_mime_types: List of MIME types to support in the pipeline. If not given,
                               defaults to ["text/plain", "application/pdf", "text/html"].
docstr_tok: [":","param","document_store",":","An","instance","of","a","DocumentStore","to","index","documents","into",".",":","param","embedding_model",":","The","name","of","the","model","to","use","for","document","embeddings",".",":","param","supported_mime_types",":","List","of","MIME","types","to","support","in","the","pipeline",".","If","not","given",",","defaults","to","[","``","text\/plain","''",",","``","application\/pdf","''",",","``","text\/html","''","]","."]
code: def __init__(
      self,
      document_store: DocumentStore,
      embedding_model: Optional[str] = None,
      embedding_model_kwargs: Optional[Dict[str, Any]] = None,
      supported_mime_types: Optional[List[str]] = None,
  ):
      """
      :param document_store: An instance of a DocumentStore to index documents into.
      :param embedding_model: The name of the model to use for document embeddings.
      :param supported_mime_types: List of MIME types to support in the pipeline. If not given,
                                   defaults to ["text/plain", "application/pdf", "text/html"].
      """
  
      if supported_mime_types is None:
          supported_mime_types = ["text/plain", "text/html"]
  
      self.pipeline = Pipeline()
      self.pipeline.add_component(
          "file_type_router",
          FileTypeRouter(mime_types=supported_mime_types),
      )
      converters_used: List[str] = []
      # Add converters dynamically based on MIME types
      if "text/plain" in supported_mime_types:
          self.pipeline.add_component(
              "text_file_converter", TextFileToDocument()
          )
          self.pipeline.connect(
              "file_type_router.text/plain",
              "text_file_converter.sources",
          )
          converters_used.append("text_file_converter")
  
      if "application/pdf" in supported_mime_types:
          from haystack.components.converters import PyPDFToDocument
  
          self.pipeline.add_component(
              "pdf_file_converter", PyPDFToDocument()
          )
          self.pipeline.connect(
              "file_type_router.application/pdf",
              "pdf_file_converter.sources",
          )
          converters_used.append("pdf_file_converter")
  
      if "text/html" in supported_mime_types:
          from haystack.components.converters import HTMLToDocument
  
          self.pipeline.add_component(
              "html_file_converter", HTMLToDocument()
          )
          self.pipeline.connect(
              "file_type_router.text/html",
              "html_file_converter.sources",
          )
          converters_used.append("html_file_converter")
  
      # Add remaining common components
      self.pipeline.add_component("document_joiner", DocumentJoiner())
      self.pipeline.add_component("document_cleaner", DocumentCleaner())
      self.pipeline.add_component(
          "document_splitter", DocumentSplitter()
      )
  
      # Connect converters to joiner, if they exist
      for converter_name in converters_used:
          self.pipeline.connect(
              f"{converter_name}.documents", "document_joiner.documents"
          )
  
      # Connect joiner to cleaner and splitter
      self.pipeline.connect(
          "document_joiner.documents", "document_cleaner.documents"
      )
      self.pipeline.connect(
          "document_cleaner.documents", "document_splitter.documents"
      )
  
      if embedding_model:
          embedder_instance = self._find_embedder(
              embedding_model, embedding_model_kwargs
          )
          self.pipeline.add_component(
              "storage_sink",
              DocumentWriter(document_store=document_store),
          )
          self.pipeline.add_component("writer", embedder_instance)
          self.pipeline.connect("writer", "storage_sink")
      else:
          self.pipeline.add_component(
              "writer", DocumentWriter(document_store=document_store)
          )
  
      self.pipeline.connect(
          "document_splitter.documents", "writer.documents"
      )
  
      # this is more of a sanity check for the maintainer of the pipeline, to make sure that the pipeline is
      # configured correctly
      if len(self.pipeline.inputs()) < 1:
          raise RuntimeError(
              "IndexingPipeline needs at least one input component."
          )
      if len(self.pipeline.outputs()) < 1:
          raise RuntimeError(
              "IndexingPipeline needs at least one output component."
          )
  
imports: import os
  import re
  from pathlib import Path
  from tempfile import NamedTemporaryFile
  from typing import Optional, List, Any, Dict
  from typing import Union, Type
  from haystack import Pipeline
  from haystack.components.converters import TextFileToDocument
  from haystack.components.embedders import SentenceTransformersDocumentEmbedder, OpenAIDocumentEmbedder
  from haystack.components.fetchers import LinkContentFetcher
  from haystack.components.preprocessors import DocumentCleaner, DocumentSplitter
  from haystack.components.routers import FileTypeRouter
  from haystack.components.joiners import DocumentJoiner
  from haystack.components.writers import DocumentWriter
  from haystack.document_stores.types import DocumentStore
label_desc: Use image node_id 1 to create a new _IndexingPipeline object  with example: obj = _IndexingPipeline(document_store, embedding_model, embedding_model_kwargs, supported_mime_types)