class_docstr: Splits a list of text documents into a list of text documents with shorter texts.
  This is useful for splitting documents with long texts that otherwise would not fit into the maximum text length of language models.
docstr: Splits the documents by split_by after split_length units with an overlap of split_overlap units.
  Returns a list of documents with the split texts.
  A metadata field "source_id" is added to each document to keep track of the original document that was split.
  Other metadata are copied from the original document.
  :param documents: The documents to split.
  :return: A list of documents with the split texts.
code: def run(self, documents: List[Document]):
      """
      Splits the documents by split_by after split_length units with an overlap of split_overlap units.
      Returns a list of documents with the split texts.
      A metadata field "source_id" is added to each document to keep track of the original document that was split.
      Other metadata are copied from the original document.
      :param documents: The documents to split.
      :return: A list of documents with the split texts.
      """
  
      if not isinstance(documents, list) or (
          documents and not isinstance(documents[0], Document)
      ):
          raise TypeError(
              "DocumentSplitter expects a List of Documents as input."
          )
  
      split_docs = []
      for doc in documents:
          if doc.content is None:
              raise ValueError(
                  f"DocumentSplitter only works with text documents but document.content for document ID {doc.id} is None."
              )
          units = self._split_into_units(doc.content, self.split_by)
          text_splits = self._concatenate_units(
              units, self.split_length, self.split_overlap
          )
          metadata = deepcopy(doc.meta)
          metadata["source_id"] = doc.id
          split_docs += [
              Document(content=txt, meta=metadata)
              for txt in text_splits
          ]
      return {"documents": split_docs}
  
file_path: haystack/haystack/components/preprocessors/document_splitter.py
imports: from copy import deepcopy
  from typing import List, Literal
  from more_itertools import windowed
  from haystack import component, Document
label_desc: Use image node_id 2 for calling the DocumentSplitter obj's underlying member method code with example usage: obj.run(documents) and returns: dict