?
DataSourceStats
TypeHow a corpus was built and what is in it, as returned by stats().
What stats() returns: document and chunk counts, documents by ingest state, storage, and the pipeline the corpus was built with. That pipeline is the configuration actually in effect, which is not necessarily the platform default and not necessarily the newest, since a corpus keeps its configuration until someone migrates it. Changing it is an explicit, owner-triggered rebuild.
DataSourceStats.ts
interface DataSourceStats { exists: boolean documentCount: number counts: { total, done, processing, error } chunkCount: number storageBytes: number lastIngestedAt: string | null pipeline: { version, embeddingModelId, dimensions, chunking, contextual, images } | null }
Fields
exists
boolean
False for a corpus nothing has created yet; everything else then reads zero.
documentCount
number
Documents in the corpus.
counts
{ total, done, processing, error }
Documents by ingest state.
chunkCount
number
Total chunks across the corpus.
storageBytes
number
Original document bytes, not index size.
lastIngestedAt
string | null
When a document last finished processing.
pipeline
{ ... } | null
The configuration these documents were built with: embedding model, dimensions, chunking, contextual, and image settings.
Read the pipeline
const s = await Policies.stats(); s.pipeline?.chunking.maxChars; // chunk size in effect s.counts.error; // documents that failed