Interface: DocumentBlock
@providerprotocol/ai / @providerprotocol/ai / DocumentBlock
Interface: DocumentBlock
Section titled “Interface: DocumentBlock”Defined in: src/types/content.ts:275
Document content block.
Contains a document (PDF or plain text) with its source and metadata. Supports PDF documents via base64 encoding or URL, and plain text content.
Example
Section titled “Example”// PDF document from base64const pdfBlock: DocumentBlock = { type: 'document', source: { type: 'base64', data: 'JVBERi0xLjQK...' }, mimeType: 'application/pdf', title: 'Annual Report'};
// Plain text documentconst textDoc: DocumentBlock = { type: 'document', source: { type: 'text', data: 'Document contents here...' }, mimeType: 'text/plain'};Properties
Section titled “Properties”mimeType
Section titled “mimeType”mimeType:
string
Defined in: src/types/content.ts:283
MIME type of the document (‘application/pdf’ or ‘text/plain’)
source
Section titled “source”source:
DocumentSource
Defined in: src/types/content.ts:280
The document data source
title?
Section titled “title?”
optionaltitle:string
Defined in: src/types/content.ts:286
Optional document title (used for citations)
type:
"document"
Defined in: src/types/content.ts:277
Discriminator for document blocks