ReferenceAsk
Remy Reference/agent/dataSources.add
?

dataSources.add

Adds a document from bytes and ingests it in the background, so re-adding identical bytes is free.
DataSource.add(content, { filename, contentType?, metadata?, entities?, budgetDollars? }) → AddResult

Adds a document and returns as soon as it is queued, since extraction and embedding run in the background and take a while, so poll documents() for status rather than assume the content is searchable on return. Documents are content-addressed, so re-adding the same bytes is a free no-op, and re-adding identical bytes with different metadata or entities updates them in place, also free. entities names what the document is about as your own ids, and every passage carries them, so an entities filter finds them. Reach for this only when users upload documents that must become searchable (a build-time corpus loads from the CLI instead); supported formats are pdf, docx, pptx, xlsx, plain text, markdown, csv, and html.

Parameters
content
Buffer | Uint8Array | string
RequiredThe document contents.
filename
string
RequiredThe extension selects the extraction route, so it is required.
contentType
string
MIME type.
metadata
DocumentMetadata
Scalar tags, up to 16 keys, filterable at search time. Supplying metadata replaces the whole object.
entities
string[]
What the document is about, as your own ids (up to 256). Every passage carries them. Supplying them replaces the set; [] clears it.
budgetDollars
number
On a mapped source, caps the job that builds an object's documents past the first thousand.
Add an uploaded document
const { document } = await Policies.add(buffer, {
  filename: 'policy.pdf',
  contentType: 'application/pdf',
  metadata: { department: 'legal', year: 2026 },
  entities: ['P-101A'],
});
// document.status is 4; poll documents() until 5