Skip to content

The agent engineering platform.

Improvement[Community] Improve Document Loaders and Splitters (#27568)

ZhangShenao455ab7d714a0
diff --git a/libs/community/langchain_community/document_loaders/pdf.py b/libs/community/langchain_community/document_loaders/pdf.py
index b01ffea8ef..528d34c43b 100644
--- a/libs/community/langchain_community/document_loaders/pdf.py
+++ b/libs/community/langchain_community/document_loaders/pdf.py
@@ -178,7 +178,7 @@ class PyPDFLoader(BasePDFLoader):
loader = PyPDFLoader(
file_path = "./example_data/layout-parser-paper.pdf",
- password = "my-pasword",
+ password = "my-password",
extract_images = True,
# headers = None
# extraction_mode = "plain",
@@ -572,7 +572,8 @@ class MathpixPDFLoader(BasePDFLoader):
response = requests.get(url, headers=self._mathpix_headers)
return response.content.decode("utf-8")
- def clean_pdf(self, contents: str) -> str:
+ @staticmethod
+ def clean_pdf(contents: str) -> str:
"""Clean the PDF file.
Args:
diff --git a/libs/text-splitters/langchain_text_splitters/character.py b/libs/text-splitters/langchain_text_splitters/character.py
index 85124b39de..f65c38869d 100644
--- a/libs/text-splitters/langchain_text_splitters/character.py
+++ b/libs/text-splitters/langchain_text_splitters/character.py
@@ -465,7 +465,7 @@ class RecursiveCharacterTextSplitter(TextSplitter):
"\n\\\\begin{verse}",
"\n\\\\begin{verbatim}",
# Now split by math environments
- "\n\\\begin{align}",
+ "\n\\\\begin{align}",
"$$",
"$",
# Now split by the normal type of lines