Document objects that LangChain text splitters produce without any transformation.
DocumentPayload schema
Each item in the documents array must conform to the following structure:Fields
string
required
The exact text to locate and highlight in the PDF. The service normalises whitespace before searching, so minor differences in spacing between your chunk and the PDF text layer are handled automatically. Do not truncate or paraphrase the chunk — pass the full string as produced by your text splitter.
integer
default:"0"
The 0-indexed page number of the PDF page where this chunk appears. The service uses this value to narrow its search to a single page; it does not scan the entire document for each chunk. If omitted, the service defaults to page
0. If the value is out of range for the given PDF, the chunk is silently skipped.LangChain integration
If you are using LangChain to load and split your PDF, theDocument objects produced by a text splitter already contain the fields you need. You can pass them to the API with minimal conversion:
PyMuPDFLoader and PyPDFLoader — populate metadata["page"] automatically with 0-indexed values, so you can often pass the splitter output directly without any manual page-number handling.