Document Processor
Document processing utilities for loading and splitting PDFs.
load_and_split_pdf(paper_id, pdf_url, paper_metadata, config, **kwargs)
Load a PDF and split it into chunks.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
paper_id
|
str
|
Unique identifier for the paper. |
required |
pdf_url
|
str
|
URL to the PDF. |
required |
paper_metadata
|
Dict[str, Any]
|
Metadata about the paper (e.g. Title, Authors, etc.). |
required |
config
|
Any
|
Configuration object with |
required |
metadata_fields
|
List of additional metadata keys to propagate into each |
required | |
documents_dict
|
Dictionary where split chunks will also be stored under keys of the form "{paper_id}_{chunk_index}" (passed via kwargs). |
required |
Returns:
Type | Description |
---|---|
List[Document]
|
A list of Document chunks, each with updated metadata. |
Source code in aiagents4pharma/talk2scholars/tools/pdf/utils/document_processor.py
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 |
|