Skip to content

The agent engineering platform.

(text-splitters): Small Fix in `_process_html` for HTMLSemanticPreservingSplitter to properly extract the metadata. (#29215)

Mohammad Mohtashim288613d36180
diff --git a/libs/text-splitters/langchain_text_splitters/html.py b/libs/text-splitters/langchain_text_splitters/html.py
index 212a9abaa7..3613937d99 100644
--- a/libs/text-splitters/langchain_text_splitters/html.py
+++ b/libs/text-splitters/langchain_text_splitters/html.py
@@ -696,7 +696,7 @@ class HTMLSemanticPreservingSplitter(BaseDocumentTransformer):
placeholder_count: int,
) -> Tuple[List[Document], Dict[str, str], List[str], Dict[str, str], int]:
for elem in element:
- if elem.name.lower() in ["html", "body", "div"]:
+ if elem.name.lower() in ["html", "body", "div", "main"]:
children = elem.find_all(recursive=False)
(
documents,