Skip to content

Commit fd8579a

Browse files
authored
set the memory limit for pandoc to 4GB (#29)
fixes: #28 Signed-off-by: Alexander Piskun <[email protected]>
1 parent 8d6bba1 commit fd8579a

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

context_chat_backend/chain/ingest/doc_loader.py

+6-6
Original file line numberDiff line numberDiff line change
@@ -41,23 +41,23 @@ def _load_csv(file: BinaryIO) -> str:
4141

4242

4343
def _load_epub(file: BinaryIO) -> str:
44-
return convert_text(str(file.read()), 'plain', 'epub').strip()
44+
return convert_text(str(file.read()), 'plain', 'epub', extra_args=["+RTS", "-M4096m", "-RTS"]).strip()
4545

4646

4747
def _load_docx(file: BinaryIO) -> str:
48-
return convert_text(str(file.read()), 'plain', 'docx').strip()
48+
return convert_text(str(file.read()), 'plain', 'docx', extra_args=["+RTS", "-M4096m", "-RTS"]).strip()
4949

5050

5151
def _load_ppt_x(file: BinaryIO) -> str:
5252
return _temp_file_wrapper(file, lambda fp: UnstructuredPowerPointLoader(fp).load()).strip()
5353

5454

5555
def _load_rtf(file: BinaryIO) -> str:
56-
return convert_text(str(file.read()), 'plain', 'rtf').strip()
56+
return convert_text(str(file.read()), 'plain', 'rtf', extra_args=["+RTS", "-M4096m", "-RTS"]).strip()
5757

5858

5959
def _load_rst(file: BinaryIO) -> str:
60-
return convert_text(str(file.read()), 'plain', 'rst').strip()
60+
return convert_text(str(file.read()), 'plain', 'rst', extra_args=["+RTS", "-M4096m", "-RTS"]).strip()
6161

6262

6363
def _load_xml(file: BinaryIO) -> str:
@@ -71,7 +71,7 @@ def _load_xlsx(file: BinaryIO) -> str:
7171

7272

7373
def _load_odt(file: BinaryIO) -> str:
74-
return convert_text(str(file.read()), 'plain', 'odt').strip()
74+
return convert_text(str(file.read()), 'plain', 'odt', extra_args=["+RTS", "-M4096m", "-RTS"]).strip()
7575

7676

7777
def _load_email(file: BinaryIO, ext: str = 'eml') -> str | None:
@@ -96,7 +96,7 @@ def attachment_partitioner(
9696

9797

9898
def _load_org(file: BinaryIO) -> str:
99-
return convert_text(str(file.read()), 'plain', 'org').strip()
99+
return convert_text(str(file.read()), 'plain', 'org', extra_args=["+RTS", "-M4096m", "-RTS"]).strip()
100100

101101

102102
# -- LOADER FUNCTION MAP -- #

0 commit comments

Comments
 (0)