Reference

DataSourceChunk

Type
One chunk exactly as it was indexed, as returned by chunks().

One chunk of a document exactly as it was indexed, as chunks() returns it. It carries the chunk's index, its text, the page and heading path it came from, and either character offsets into the extracted markdown or a boundingBox for PDFs. Reading these shows why a document does or does not match a query.

DataSourceChunk.ts
interface DataSourceChunk {
  index: number
  text: string
  pageNumber: number
  headingPath: string[]
  charStart: number | null
  charEnd: number | null
  boundingBox?: { topLeftX, topLeftY, bottomRightX, bottomRightY }
  vector?: string
}
Fields
index
number
0-based position in the document.
text
string
The chunk's indexed text.
pageNumber
number
Page the chunk came from.
headingPath
string[]
Enclosing headings, outermost first.
charStart
number | null
Offset into the page's extracted markdown. Null for PDFs, which carry a boundingBox instead.
charEnd
number | null
End offset, paired with charStart.
boundingBox?
{ ...corners }
Region of the page, for PDFs.
vector?
string
On requestbase64 of a Float32Array. Only when vectors: true was passed.
Inspect the split
const chunks = await Policies.chunks(documentId);
chunks[0].headingPath; // [0, 1]