langchain_community.document_loaders.pdf.MathpixPDFLoader

class langchain_community.document_loaders.pdf.MathpixPDFLoader(file_path: str, processed_file_format: str = 'md', max_wait_time_seconds: int = 500, should_clean_pdf: bool = False, extra_request_data: Optional[Dict[str, Any]] = None, **kwargs: Any)[source]

使用`Mathpix`服务加载`PDF`文件。

使用文件路径进行初始化。

参数:

file_path: 用于加载的文件。 processed_file_format: 处理后文件的格式。默认为”md”。 max_wait_time_seconds: 等待服务器响应的最长时间。默认为500。 should_clean_pdf: 清理PDF文件的标志。默认为False。 extra_request_data: 额外的请求数据。 **kwargs: 额外的关键字参数。

Attributes

data

source

url

Methods

__init__(file_path[, processed_file_format, ...])

使用文件路径进行初始化。

alazy_load()

一个用于文档的惰性加载器。

aload()

将数据加载到文档对象中。

clean_pdf(contents)

清理PDF文件。

get_processed_pdf(pdf_id)

lazy_load()

一个用于文档的惰性加载器。

load()

将数据加载到文档对象中。

load_and_split([text_splitter])

加载文档并分割成块。块作为文档返回。

send_pdf()

wait_for_processing(pdf_id)

等待处理完成。

Parameters
  • file_path (str) –

  • processed_file_format (str) –

  • max_wait_time_seconds (int) –

  • should_clean_pdf (bool) –

  • extra_request_data (Optional[Dict[str, Any]]) –

  • kwargs (Any) –

Return type

None

__init__(file_path: str, processed_file_format: str = 'md', max_wait_time_seconds: int = 500, should_clean_pdf: bool = False, extra_request_data: Optional[Dict[str, Any]] = None, **kwargs: Any) None[source]

使用文件路径进行初始化。

参数:

file_path: 用于加载的文件。 processed_file_format: 处理后文件的格式。默认为”md”。 max_wait_time_seconds: 等待服务器响应的最长时间。默认为500。 should_clean_pdf: 清理PDF文件的标志。默认为False。 extra_request_data: 额外的请求数据。 **kwargs: 额外的关键字参数。

Parameters
  • file_path (str) –

  • processed_file_format (str) –

  • max_wait_time_seconds (int) –

  • should_clean_pdf (bool) –

  • extra_request_data (Optional[Dict[str, Any]]) –

  • kwargs (Any) –

Return type

None

async alazy_load() AsyncIterator[Document]

一个用于文档的惰性加载器。

Return type

AsyncIterator[Document]

async aload() List[Document]

将数据加载到文档对象中。

Return type

List[Document]

clean_pdf(contents: str) str[source]

清理PDF文件。

参数:

contents: 一个PDF文件的内容。

返回值:

Parameters

contents (str) –

Return type

str

get_processed_pdf(pdf_id: str) str[source]
Parameters

pdf_id (str) –

Return type

str

lazy_load() Iterator[Document]

一个用于文档的惰性加载器。

Return type

Iterator[Document]

load() List[Document][source]

将数据加载到文档对象中。

Return type

List[Document]

load_and_split(text_splitter: Optional[TextSplitter] = None) List[Document]

加载文档并分割成块。块作为文档返回。

不要覆盖此方法。应该被视为已弃用!

参数:
text_splitter: 用于分割文档的TextSplitter实例。

默认为RecursiveCharacterTextSplitter。

返回:

文档列表。

Parameters

text_splitter (Optional[TextSplitter]) –

Return type

List[Document]

send_pdf() str[source]
Return type

str

wait_for_processing(pdf_id: str) None[source]

等待处理完成。

参数:

pdf_id: 一个PDF id。

返回值:无

Parameters

pdf_id (str) –

Return type

None

Examples using MathpixPDFLoader